...
|
...
|
@@ -12,8 +12,6 @@ import org.springframework.stereotype.Service; |
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
import static com.yohoufo.order.constants.InviteConstant.INVITER_TYPE_STORED_SELLER;
|
|
|
|
|
|
/**
|
|
|
* @author LUOXC
|
|
|
* @date 2019/4/3 12:38
|
...
|
...
|
@@ -49,27 +47,27 @@ public class InviterSettleService { |
|
|
// 计算结算金额
|
|
|
int settlementId = settlement.getId();
|
|
|
log.info("settle for {} calculate settle amount for settlement {}.", uid, settlementId);
|
|
|
// 计算入驻商家邀请的结算金额
|
|
|
BigDecimal settleAmountOfStoredSeller = calculateSettleAmountOfStoredSeller(uid, settlementId);
|
|
|
log.info("settle for {} calculate settle amount for settlement {}, the amount of stored seller is {}.",
|
|
|
uid, settlementId, settleAmountOfStoredSeller);
|
|
|
// 一级代理人邀请的结算金额
|
|
|
BigDecimal settleAmountOfAgent = BigDecimal.ZERO;
|
|
|
// type1方式结算金额
|
|
|
BigDecimal settleAmountOfType1 = calculateSettleAmountOfType1(uid, settlementId);
|
|
|
log.info("settle for {} calculate settle amount for settlement {}, the amount of type1 is {}.",
|
|
|
uid, settlementId, settleAmountOfType1);
|
|
|
// type2方式结算金额
|
|
|
BigDecimal settleAmountOfType2 = BigDecimal.ZERO;
|
|
|
// 更新结算金额
|
|
|
settlement.setSettleAmount(settleAmountOfStoredSeller.add(settleAmountOfAgent));
|
|
|
settlement.setSettleAmount(settleAmountOfType1.add(settleAmountOfType2));
|
|
|
inviteSettlementMapper.updateByUidAndId(settlement);
|
|
|
log.info("settle for {} end settle amount for settlement {} is {}.", uid, settlementId, settlement.getSettleAmount());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计算入驻商家邀请的结算金额
|
|
|
* type1方式结算金额
|
|
|
*
|
|
|
* @param uid
|
|
|
* @param settlementId
|
|
|
* @return
|
|
|
*/
|
|
|
private BigDecimal calculateSettleAmountOfStoredSeller(int uid, int settlementId) {
|
|
|
int type = INVITER_TYPE_STORED_SELLER;
|
|
|
private BigDecimal calculateSettleAmountOfType1(int uid, int settlementId) {
|
|
|
int type = 1;
|
|
|
inviteSettlementItemMapper.updateToSettled(
|
|
|
uid,
|
|
|
type,
|
...
|
...
|
|