| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.constant.AmountConstant; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | |
| | | import com.ruoyi.system.service.TOrderBillService; |
| | | import com.ruoyi.system.service.TPayOrderService; |
| | | import com.ruoyi.system.service.TTenantService; |
| | | import com.taxi591.bankapi.BankProperties; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | |
| | | public String createAppletUrl(String orderNo){ |
| | | return ""+orderNo; |
| | | JSONObject param = new JSONObject(); |
| | | param.put("input1",orderNo); |
| | | StringBuffer sb = new StringBuffer(); |
| | | sb.append(BankProperties.H5_BANK_URL) |
| | | .append("?code=").append("JF-EPAY2025030510983") |
| | | .append("&userInput=") |
| | | .append(URLEncoder.encode(param.toJSONString())) |
| | | .append("&showBill=0"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (bill == null) { |
| | | throw new ServiceException("账单不存在"); |
| | | } |
| | | //计算欠费金额:租金+违约金-实收金额 |
| | | long rent = caculateRentFee(bill); |
| | | //欠费金额转成单位分比较 |
| | | long rent = bill.getOutstandingMoney().multiply(AmountConstant.b100) |
| | | .setScale(2,RoundingMode.HALF_DOWN).longValue(); |
| | | if (rent==0){ |
| | | throw new ServiceException("该账单已缴费"); |
| | | } |
| | | if (rent>dto.getAmount()){ |
| | | if (rent<dto.getAmount()){ |
| | | throw new ServiceException("支付金额超过了账单欠费金额"); |
| | | } |
| | | |
| | |
| | | orderBills.add(new TOrderBill(orderNo,bill.getId())); |
| | | return bill; |
| | | }).collect(Collectors.toList()); |
| | | long sumRent = bills.stream().mapToLong((bill) -> caculateRentFee(bill)).sum(); |
| | | //欠费金额转成单位分比较 |
| | | long sumRent = bills.stream().mapToLong((bill) |
| | | -> bill.getOutstandingMoney().multiply(AmountConstant.b100) |
| | | .setScale(2,RoundingMode.HALF_DOWN).longValue()) |
| | | .sum(); |
| | | if (sumRent==0){ |
| | | throw new ServiceException("账单已缴费"); |
| | | } |