liujie
3 天以前 87dc04e8ef1580218961acbda378f0fd0e5bec89
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysOrderController.java
@@ -151,6 +151,7 @@
                    "\t\t\"trans_type\": \""+trans_type+"\"\n" +
                    "\t}\n" +
                    "}";
            String authorization = getAuthorization(body);
            org.apache.http.HttpResponse response = post(LakalaConfig.getServerUrl() + apiPath, body, authorization);
            if (response.getStatusLine().getStatusCode() != 200) {
@@ -244,24 +245,24 @@
            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", "SR2024000144253");
            map1.put("recv_no", "SR2024000006413");
            // 手续费
            BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP);
            payMoney = payMoney.subtract(bigDecimal);
@@ -280,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");
@@ -445,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());
@@ -471,7 +481,7 @@
//            }
            HashMap<String, Object> map1 = new HashMap<>();
            // TODO hzt
            map1.put("recv_no", "SR2024000144253");
            map1.put("recv_no", "SR2024000006413");
            map1.put("amt", erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + "");
            objects.add(map1);
            map.put("total_amt",erpProcurement.getMoney().multiply(BigDecimal.valueOf(100)).intValue() + "");
@@ -480,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);