| | |
| | | if(proportionPercent.compareTo(BigDecimal.ZERO)>0){ |
| | | PaymentDelaytransHFTXVo result = new PaymentDelaytransHFTXVo(); |
| | | // 计算分成金额 |
| | | int amount = orderMoney.multiply(proportionPercent).setScale(0, RoundingMode.UP).intValue(); |
| | | int amount = orderMoney.multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).intValue(); |
| | | BigDecimal multiply = orderMoney.multiply(proportionPercent.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); |
| | | log.info("订单分账:{} 分账金额: {}", orderNo, amount); |
| | | if (amount > 0) { |
| | |
| | | |
| | | //分账对象 |
| | | JSONArray acctInfos = new JSONArray(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("div_amt", String.format("%.2f", multiply.doubleValue())); |
| | | jsonObject.put("huifu_id", vo.getHuifuId()); |
| | | acctInfos.add(jsonObject); |
| | | if(multiply.compareTo(BigDecimal.ZERO) > 0){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("div_amt", String.format("%.2f", multiply.doubleValue())); |
| | | jsonObject.put("huifu_id", vo.getHuifuId()); |
| | | acctInfos.add(jsonObject); |
| | | } |
| | | //平台商户 |
| | | double pt_amount = orderMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | JSONObject jsonObject1 = new JSONObject(); |
| | | jsonObject1.put("div_amt", String.format("%.2f", pt_amount)); |
| | | jsonObject1.put("huifu_id", "6666000141216769"); |
| | | acctInfos.add(jsonObject1); |
| | | BigDecimal pt_amount = orderMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN); |
| | | if(pt_amount.compareTo(BigDecimal.ZERO) > 0){ |
| | | JSONObject jsonObject1 = new JSONObject(); |
| | | jsonObject1.put("div_amt", String.format("%.2f", pt_amount.doubleValue())); |
| | | jsonObject1.put("huifu_id", "6666000141216769"); |
| | | acctInfos.add(jsonObject1); |
| | | } |
| | | |
| | | R<PaymentDelaytransHFTXVo> hftxVoR = HuiFuTianXiaUtil.paymentDelaytrans(request.getOutOrderNo(), org_req_date, outTradeNo, acctInfos); |
| | | if(hftxVoR.getCode() != 200){ |
| | | throw new ServiceException(hftxVoR.getMsg()); |