| | |
| | | */ |
| | | @RequestMapping({"thirdPartyRecharge.do"}) |
| | | @ResponseBody |
| | | public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,HttpServletRequest request) { |
| | | public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,@RequestParam("type") Integer type,HttpServletRequest request) { |
| | | payLock.lock(); |
| | | try { |
| | | if (payCreated.get()) { |
| | | return ServerResponse.createByErrorMsg("当前充值人数过多,请稍后重试", request); |
| | | } |
| | | if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("1000")) < 0){ |
| | | return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:1000", request); |
| | | if (!isIntegerGreaterThan100(tradeAmoun)) { |
| | | return ServerResponse.createByErrorMsg("请输入整数!",request); |
| | | } |
| | | if(null == type){ |
| | | return ServerResponse.createByErrorMsg("请选择支付通道!",request); |
| | | } |
| | | if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("5000")) < 0){ |
| | | return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:5000", request); |
| | | } |
| | | |
| | | payCreated.set(true); |
| | | return payService.thirdPartyRecharge(request,tradeAmoun); |
| | | return payService.thirdPartyRecharge(request,tradeAmoun,type); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ServerResponse.createByErrorMsg("获取充值链接异常,请稍后重试", request); |
| | |
| | | payCreated.set(false); |
| | | } |
| | | } |
| | | |
| | | // 判断字符串是否是整数且大于100 |
| | | public static boolean isIntegerGreaterThan100(String str) { |
| | | try { |
| | | int number = Integer.parseInt(str); // 尝试将字符串转换为整数 |
| | | return number > 100; // 判断是否大于100 |
| | | } catch (NumberFormatException e) { |
| | | return false; // 如果转换失败,说明不是整数 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 充值异步接收地址 |
| | | * 充值1异步接收地址 |
| | | */ |
| | | @PostMapping({"rechargeCallback.do"}) |
| | | public void rechargeCallback(PaymentResponse vo, HttpServletResponse response) throws IOException { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 代付回调通知 |
| | | * 充值2异步接收地址 |
| | | */ |
| | | @PostMapping({"noticePayment.do"}) |
| | | public void noticePayment(TradeResultVO vo,HttpServletResponse response) throws IOException { |
| | | iUserWithdrawService.noticePayment(vo,response); |
| | | @PostMapping({"rechargeCallbackTwo.do"}) |
| | | public void rechargeCallbackTwo(@RequestParam("status") String status, |
| | | @RequestParam("merchantid") String merchantid, |
| | | @RequestParam("out_trade_no") String outTradeNo, |
| | | @RequestParam("total_fee") String totalFee, |
| | | @RequestParam("poundage") String poundage, |
| | | @RequestParam("account_fee") String accountFee, |
| | | @RequestParam("sign") String sign, HttpServletResponse response) throws IOException { |
| | | TransactionStatusVo vo = new TransactionStatusVo(); |
| | | vo.setStatus(status); |
| | | vo.setMerchantid(merchantid); |
| | | vo.setOut_trade_no(outTradeNo); |
| | | vo.setTotal_fee(totalFee); |
| | | vo.setPoundage(poundage); |
| | | vo.setAccount_fee(accountFee); |
| | | vo.setSign(sign); |
| | | payService.rechargeCallbackTwo(vo,response); |
| | | } |
| | | } |