private static void sendCheck(Map<String, String> params, String baseUrl) { // LoanNoList + PlatformMoneymoremore + AuditType + RandomTimeStamp + Remark1 + Remark2 + // Remark3 + ReturnURL + NotifyURL StringBuilder sBuilder = new StringBuilder(); sBuilder.append(StringUtil.strFormat(params.get("LoanNoList"))); sBuilder.append(StringUtil.strFormat(params.get("PlatformMoneymoremore"))); sBuilder.append(StringUtil.strFormat(params.get("AuditType"))); sBuilder.append(StringUtil.strFormat(params.get("RandomTimeStamp"))); sBuilder.append(StringUtil.strFormat(params.get("Remark1"))); sBuilder.append(StringUtil.strFormat(params.get("Remark2"))); sBuilder.append(StringUtil.strFormat(params.get("Remark3"))); sBuilder.append(StringUtil.strFormat(params.get("ReturnURL"))); sBuilder.append(StringUtil.strFormat(params.get("NotifyURL"))); RsaHelper rsa = RsaHelper.getInstance(); String signInfo = rsa.signData(sBuilder.toString(), privateKey); params.put("SignInfo", signInfo); String body = httpClientService.post(baseUrl, params); Gson gson = new Gson(); Map<String, String> returnParams = gson.fromJson(body, Map.class); // try { // checkBuyProcessor(returnParams); // } catch (SignatureException e) { // e.printStackTrace(); // } catch (ResultCodeException e) { // e.printStackTrace(); // } }
public void init(Map<String, Object> param) { super.init(param); this.WithdrawMoneymoremore = StringUtil.strFormat(param.get("WithdrawMoneymoremore")); this.FeeWithdraws = StringUtil.strFormat(param.get("FeeWithdraws")); this.WithdrawsState = StringUtil.strFormat(param.get("WithdrawsState")); this.WithdrawsTime = StringUtil.strFormat(param.get("WithdrawsTime")); this.PlatformAuditState = StringUtil.strFormat(param.get("PlatformAuditState")); this.PlatformAuditTime = StringUtil.strFormat(param.get("PlatformAuditTime")); this.WithdrawsBackTime = StringUtil.strFormat(param.get("WithdrawsBackTime")); }
public String getSign(String privateKey) { StringBuilder sBuilder = new StringBuilder(); // WithdrawMoneymoremore + PlatformMoneymoremore + OrderNo + Amount + FeePercent + FeeMax // + FeeRate + CardNo + CardType + BankCode + BranchBankName + Province + City // + RandomTimeStamp + Remark1 + Remark2 + Remark3 + ReturnURL + NotifyURL sBuilder.append(StringUtil.strFormat(withdrawMoneymoremore)); sBuilder.append(StringUtil.strFormat(platformMoneymoremore)); sBuilder.append(StringUtil.strFormat(orderNo)); sBuilder.append(StringUtil.strFormat(amount)); sBuilder.append(StringUtil.strFormat(feePercent)); sBuilder.append(StringUtil.strFormat(feeMax)); sBuilder.append(StringUtil.strFormat(feeRate)); sBuilder.append(StringUtil.strFormat(cardNo)); sBuilder.append(StringUtil.strFormat(cardType)); sBuilder.append(StringUtil.strFormat(bankCode)); sBuilder.append(StringUtil.strFormat(branchBankName)); sBuilder.append(StringUtil.strFormat(province)); sBuilder.append(StringUtil.strFormat(city)); sBuilder.append(StringUtil.strFormat(randomTimeStamp)); sBuilder.append(StringUtil.strFormat(remark1)); sBuilder.append(StringUtil.strFormat(remark2)); sBuilder.append(StringUtil.strFormat(remark3)); sBuilder.append(StringUtil.strFormat(returnURL)); sBuilder.append(StringUtil.strFormat(notifyURL)); RsaHelper rsa = RsaHelper.getInstance(); return rsa.signData(sBuilder.toString(), privateKey); }
public static boolean checkSingleCashStream(Integer cashStreamId) throws Exception { CashStream cashStream = cashStreamDao.find(cashStreamId); if (cashStream == null) return true; if (cashStream.getChiefamount().add(cashStream.getInterest()).compareTo(new BigDecimal(0)) == 0) { return true; } String baseUrl = innerService.getBaseUrl(IInnerThirdPaySupportService.ACTION_ORDERQUERY); Map<String, String> params = new HashMap<String, String>(); params.put("PlatformMoneymoremore", platformMoneymoremore); if (cashStream.getAction() == CashStream.ACTION_CASH || (cashStream.getAction() == CashStream.ACTION_RECHARGE && "提现退回".equals(cashStream.getDescription()))) params.put("Action", "2"); else if (cashStream.getAction() == CashStream.ACTION_RECHARGE) params.put("Action", "1"); StringBuilder sBuilder = new StringBuilder(); sBuilder.append(StringUtil.strFormat(params.get("PlatformMoneymoremore"))); sBuilder.append(StringUtil.strFormat(params.get("Action"))); String body = ""; // if(cashStream.getAction()==CashStream.ACTION_PAY || // cashStream.getAction()==CashStream.ACTION_UNFREEZE) // { if (cashStream.getLoanNo() != null) { params.put("LoanNo", cashStream.getLoanNo()); sBuilder.append(StringUtil.strFormat(params.get("LoanNo"))); RsaHelper rsa = RsaHelper.getInstance(); params.put("SignInfo", rsa.signData(sBuilder.toString(), privateKey)); body = httpClientService.post(baseUrl, params); } else { params.put("OrderNo", String.valueOf(cashStream.getId())); sBuilder.append(StringUtil.strFormat(params.get("OrderNo"))); RsaHelper rsa = RsaHelper.getInstance(); params.put("SignInfo", rsa.signData(sBuilder.toString(), privateKey)); body = httpClientService.post(baseUrl, params); } try { boolean flag = false; if (cashStream.getAction() == CashStream.ACTION_RECHARGE) { flag = checkRechargeResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_AWARD) { flag = checkAwardResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_CASH) { flag = checkWithDrawResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_REPAY || cashStream.getAction() == CashStream.ACTION_PURCHASEBACK || cashStream.getAction() == CashStream.ACTION_TEMPDEBT) { flag = checkPayBackResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_SYNCHRONIZE) { flag = checkSynchronizeResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_PAY || cashStream.getAction() == CashStream.ACTION_PURCHASE) { flag = checkPayResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_FREEZE) { flag = checkFreezeResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_UNFREEZE) { flag = checkUnFreezeResult(cashStream, body); } else if (cashStream.getAction() == CashStream.ACTION_STORECHANGE) { flag = checkStoreResult(cashStream, body); } else { throw new Exception("现金流[ID:" + cashStream.getId() + "]有问题: 未知状态!"); } return flag; } catch (Exception e) { e.printStackTrace(); throw e; } }