| | |
| | | String amount = String.valueOf(erpProcurement.getPayMoney().multiply(new BigDecimal("100")).intValue()); |
| | | |
| | | TCrmSupplier supplier = crmSupplierService.getById(erpProcurement.getSupplierId()); |
| | | String trans_type ="41"; |
| | | if("WECHAT".equals(type)){ |
| | | trans_type= "51"; |
| | | } |
| | | |
| | | |
| | | String apiPath = "sit/api/v3/labs/trans/preorder"; |
| | |
| | | "\t\t\"settle_type\": \"1\",\n" + |
| | | "\t\t\"total_amount\": " + amount + ",\n" + |
| | | "\t\t\"account_type\": \"" + type + "\",\n" + |
| | | "\t\t\"trans_type\": \"41\"\n" + |
| | | "\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) { |
| | |
| | | erpProcurement.setStatus(2); |
| | | erpProcurement.setTermNo(supplier.getTermNo()); |
| | | erpProcurement.setAccountType(type); |
| | | erpProcurement.setTransType("41"); |
| | | erpProcurement.setTransType(trans_type); |
| | | erpProcurementService.updateById(erpProcurement); |
| | | |
| | | return R.ok(responseStr); |
| | |
| | | |
| | | 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", "822641048160MMJ"); |
| | | map1.put("recv_no", "SR2024000006413"); |
| | | // 手续费 |
| | | BigDecimal bigDecimal = allMoney.multiply(new BigDecimal("0.038")).setScale(2, RoundingMode.HALF_UP); |
| | | payMoney = payMoney.subtract(bigDecimal); |
| | |
| | | |
| | | |
| | | 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"); |
| | |
| | | return jsonObject; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "退款") |
| | | @PostMapping(value = "/refundOrder") |
| | | @SneakyThrows |
| | | public R<?> refundOrder(@RequestParam String id, String type, HttpServletRequest request) { |
| | | public R<?> refundOrder(@RequestParam String id, HttpServletRequest request) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | try { |
| | | // 先退分账 在退订单 |
| | |
| | | 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()); |
| | |
| | | // } |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | // TODO hzt |
| | | map1.put("recv_no", "dsadasda"); |
| | | 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() + ""); |
| | |
| | | |
| | | |
| | | 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); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.fail(500, "调用支付宝支付预下单接口错误"); |
| | | return R.fail(500, "退款失败请联系平台管理员"); |
| | | } |
| | | |
| | | |