xuhy
3 天以前 62b287b8fc5d0b4d3ac3cfd5b748f256b8693505
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysOrderController.java
@@ -245,21 +245,21 @@
            BigDecimal allMoney = erpProcurement.getPayMoney();
            // 平台应得分账
            BigDecimal payMoney = erpProcurement.getPayMoney();
            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);
            }
//            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");
@@ -281,9 +281,18 @@
            String jsonString = JSON.toJSONString(reqMap);
            post.body(jsonString);
            HttpResponse response = post.execute();
            String responseStr = response.body();
//            String authorization1 = getAuthorization(jsonString);
//            post.header("Authorization", SCHEMA + " " + authorization);
//
//            post.body(jsonString);
//            HttpResponse response = post.execute();
//            String responseStr = response.body();
            String authorization1 = getAuthorization(jsonString);
            org.apache.http.HttpResponse response1 = post(LakalaConfig.getServerUrl() + "sit/api/v3/sacs/separate", jsonString, authorization1);
            String responseStr = IOUtils.toString(response1.getEntity().getContent(), ENCODING);
            JSONObject jsonObject = JSONObject.parseObject(responseStr);
            if ("成功".equals(jsonObject.getString("msg"))) {
                Object o1 = jsonObject.get("resp_data");
@@ -446,7 +455,7 @@
            String outTradeNo = time + str;
            // 操作分账
            HttpRequest post = HttpUtil.createPost(LakalaConfig.getServerUrl() + "sit/api/v3/sacs/fallback");
//            HttpRequest post = HttpUtil.createPost(LakalaConfig.getServerUrl() + "sit/api/v3/sacs/fallback");
            HashMap<String, Object> reqMap = new HashMap<>();
            reqMap.put("version", "3.0");
            reqMap.put("req_time", DateUtils.dateTimeNow());
@@ -481,9 +490,15 @@
            String jsonString = JSON.toJSONString(reqMap);
            post.body(jsonString);
            HttpResponse response = post.execute();
            String responseStr = response.body();
            String authorization1 = getAuthorization(jsonString);
            org.apache.http.HttpResponse response1 = post(LakalaConfig.getServerUrl() + "sit/api/v3/sacs/fallback", jsonString, authorization1);
            String responseStr = IOUtils.toString(response1.getEntity().getContent(), ENCODING);
//            post.body(jsonString);
//            HttpResponse response = post.execute();
//            String responseStr = response.body();
            return R.ok(responseStr);