Merge remote-tracking branch 'origin/cc_20250529_franchise_fee' into cc_20250529_franchise_fee

This commit is contained in:
苏竹红
2025-06-05 15:50:43 +08:00
2 changed files with 17 additions and 0 deletions

View File

@@ -163,8 +163,24 @@ public class LinePayServiceImpl implements LinePayService {
if (StringUtils.isBlank(userId)) {
throw new ServiceException(ErrorCodeEnum.ACCESS_TOKEN_INVALID);
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
//判断付款人最多2人可重复
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(request.getShopId());
//判断缴费金额不能大于未缴费金额
BigDecimal total = list.stream()
.map(LinePayDO::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
//应缴金额
BigDecimal amountDue = new BigDecimal(franchiseFeeDO.getYearFranchiseFee())
.add(new BigDecimal(franchiseFeeDO.getLoanMargin()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearFee()))
.add(new BigDecimal(franchiseFeeDO.getFirstYearManageFee()))
.add(new BigDecimal(franchiseFeeDO.getPerformanceBond()));
//未缴费金额
BigDecimal amountUnpaid = amountDue.subtract(total);
if( request.getAmount().compareTo(amountUnpaid) > 0 ){
throw new ServiceException(ErrorCodeEnum.PAY_AMOUNT_ERROR);
}
Set<String> payUserList = list.stream().map(LinePayDO::getPayUserName).collect(Collectors.toSet());
if (!payUserList.contains(request.getPayUserName()) && payUserList.size() >= 2) {
throw new ServiceException(ErrorCodeEnum.PAY_USER_NAME_ERROR);