| | |
| | | "}"; |
| | | |
| | | String authorization = getAuthorization(body); |
| | | System.err.println("支付请求"+body); |
| | | org.apache.http.HttpResponse response = post(LakalaConfig.getServerUrl() + apiPath, body, authorization); |
| | | if (response.getStatusLine().getStatusCode() != 200) { |
| | | return R.fail(500, "请求失败,statusCode " + response.getStatusLine() |
| | | + IOUtils.toString(response.getEntity().getContent(), ENCODING)); |
| | | } |
| | | String responseStr = IOUtils.toString(response.getEntity().getContent(), ENCODING); |
| | | System.err.println("支付结果"+responseStr); |
| | | |
| | | |
| | | erpProcurement.setPayNumber(outTradeNo); |
| | |
| | | map.put("merchant_no", erpProcurement.getMerchantNo()); |
| | | map.put("log_no", erpProcurement.getPayTransactionId()); |
| | | map.put("log_date", DateUtils.dateTime()); |
| | | map.put("cal_type", "0"); |
| | | map.put("notify_url", "http://221.182.45.100:8089/t-sys-order/messageSeparateHandle"); |
| | | String time = DateUtils.dateTimeNow(); |
| | | |
| | |
| | | // 平台应得分账 |
| | | BigDecimal payMoney = erpProcurement.getMoney(); |
| | | ArrayList<HashMap<String, Object>> objects = new ArrayList<>(); |
| | | // 根据供应商id分组 |
| | | Map<String, List<TErpProcurementGoods>> collect = list.stream().collect(Collectors.groupingBy(TErpProcurementGoods::getSupplierId)); |
| | | // for (Map.Entry<String, List<TErpProcurementGoods>> entry : collect.entrySet()) { |
| | | // HashMap<String, Object> map1 = new HashMap<>(); |
| | | // String supplierId = entry.getKey(); |
| | | // TCrmSupplier supplier = crmSupplierService.getById(supplierId); |
| | | // List<TErpProcurementGoods> value = entry.getValue(); |
| | | // BigDecimal reduce = value.stream().map(TErpProcurementGoods::getSupplierMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // payMoney = payMoney.subtract(reduce); |
| | | // map1.put("recv_no", supplier.getRecvMerchantNo()); |
| | | // map1.put("separate_value", reduce.multiply(BigDecimal.valueOf(100)).intValue() + ""); |
| | | //// objects.add(map1); |
| | | // } |
| | | |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | //TODO hzt |
| | | map1.put("recv_no", "SR2024000006413"); |
| | | map1.put("recv_no", "SR2024021195402"); |
| | | // 手续费 |
| | | BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP); |
| | | payMoney = payMoney.subtract(bigDecimal); |
| | |
| | | if(payMoney.doubleValue()>0){ |
| | | objects.add(map1); |
| | | } |
| | | |
| | | // 根据供应商id分组 |
| | | Map<String, List<TErpProcurementGoods>> collect = list.stream().collect(Collectors.groupingBy(TErpProcurementGoods::getSupplierId)); |
| | | for (Map.Entry<String, List<TErpProcurementGoods>> entry : collect.entrySet()) { |
| | | HashMap<String, Object> map2 = new HashMap<>(); |
| | | String supplierId = entry.getKey(); |
| | | TCrmSupplier supplier = crmSupplierService.getById(supplierId); |
| | | // List<TErpProcurementGoods> value = entry.getValue(); |
| | | // BigDecimal reduce = value.stream().map(TErpProcurementGoods::getSupplierMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // payMoney = payMoney.subtract(reduce); |
| | | map2.put("recv_merchant_no", supplier.getRecvMerchantNo()); |
| | | int count = allMoney.subtract(payMoney).multiply(BigDecimal.valueOf(100)).intValue(); |
| | | if(count>0){ |
| | | map2.put("separate_value", count+ ""); |
| | | |
| | | objects.add(map2); |
| | | } |
| | | } |
| | | |
| | | erpProcurement.setMoney(payMoney); |
| | | erpProcurement.setOutSeparateNo(outTradeNo); |
| | | erpProcurementService.updateById(erpProcurement); |
| | |
| | | JSONArray jsonArray = JSONArray.parseArray(detail_datas.toString()); |
| | | if("SEPARATE".equals(cmd_type.toString())){ |
| | | TErpProcurement erpProcurement = erpProcurementService.getOne(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getOutSeparateNo, o.toString())); |
| | | if ( erpProcurement!=null && "SUCCESS".equals(status)) { |
| | | if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()!=1) { |
| | | erpProcurement.setRefundStatus(1); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | // 修改分账状态 |
| | |
| | | } |
| | | }else if("FALLBACK".equals(cmd_type.toString())){ |
| | | TErpProcurement erpProcurement = erpProcurementService.getOne(new LambdaQueryWrapper<TErpProcurement>().eq(TErpProcurement::getRefundOutSeparateNo, o.toString())); |
| | | if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()==1) { |
| | | if ( erpProcurement!=null && "SUCCESS".equals(status) && erpProcurement.getRefundStatus()!=2) { |
| | | erpProcurement.setRefundStatus(2); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | List<TErpProcurementGoods> list1 = erpProcurementGoodsService.list(new LambdaQueryWrapper<TErpProcurementGoods>().eq(TErpProcurementGoods::getProcurementId, erpProcurement.getId())); |
| | |
| | | // } |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | // TODO hzt |
| | | map1.put("recv_no", "SR2024000006413"); |
| | | map1.put("recv_no", "SR2024021195402"); |
| | | map1.put("amt", erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); |
| | | objects.add(map1); |
| | | map.put("total_amt",erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + ""); |