| | |
| | | @RequestMapping({"thirdPartyRecharge.do"}) |
| | | @ResponseBody |
| | | public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,@RequestParam("type") Integer type,HttpServletRequest request) { |
| | | payLock.lock(); |
| | | try { |
| | | if (payCreated.get()) { |
| | | return ServerResponse.createByErrorMsg("当前充值人数过多,请稍后重试", request); |
| | | } |
| | | if (!isIntegerGreaterThan100(tradeAmoun)) { |
| | | return ServerResponse.createByErrorMsg("请输入整数!",request); |
| | | } |
| | | if(null == type){ |
| | | return ServerResponse.createByErrorMsg("请选择支付通道!",request); |
| | | } |
| | | if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("1000")) < 0){ |
| | | return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:1000", request); |
| | | } |
| | | |
| | | payCreated.set(true); |
| | | return payService.thirdPartyRecharge(request,tradeAmoun,type); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ServerResponse.createByErrorMsg("获取充值链接异常,请稍后重试", request); |
| | | } finally{ |
| | | payLock.unlock(); |
| | | payCreated.set(false); |
| | | } |
| | | return ServerResponse.createBySuccess("请联系客服充值"); |
| | | // payLock.lock(); |
| | | // try { |
| | | // |
| | | // if (payCreated.get()) { |
| | | // return ServerResponse.createByErrorMsg("当前充值人数过多,请稍后重试", request); |
| | | // } |
| | | // if (!isIntegerGreaterThan100(tradeAmoun)) { |
| | | // return ServerResponse.createByErrorMsg("请输入整数!",request); |
| | | // } |
| | | // if(null == type){ |
| | | // return ServerResponse.createByErrorMsg("请选择支付通道!",request); |
| | | // } |
| | | // if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("1000")) < 0){ |
| | | // return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:1000", request); |
| | | // } |
| | | // |
| | | // payCreated.set(true); |
| | | // return payService.thirdPartyRecharge(request,tradeAmoun,type); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return ServerResponse.createByErrorMsg("获取充值链接异常,请稍后重试", request); |
| | | // } finally{ |
| | | // payLock.unlock(); |
| | | // payCreated.set(false); |
| | | // } |
| | | } |
| | | // 判断字符串是否是整数且大于100 |
| | | public static boolean isIntegerGreaterThan100(String str) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 充值1异步接收地址 |
| | | */ |
| | | @PostMapping({"rechargeCallback.do"}) |
| | | public void rechargeCallback(PaymentResponse vo, HttpServletResponse response) throws IOException { |
| | | payService.rechargeCallback(vo,response); |
| | | } |
| | | |
| | | /** |
| | | * 充值2异步接收地址 |
| | | */ |
| | | @PostMapping({"rechargeCallbackTwo.do"}) |
| | | public void rechargeCallbackTwo(TransactionStatusVo vo, HttpServletResponse response) throws IOException { |
| | | payService.rechargeCallbackTwo(vo,response); |
| | | } |
| | | // /** |
| | | // * 充值1异步接收地址 |
| | | // */ |
| | | // @PostMapping({"rechargeCallback.do"}) |
| | | // public void rechargeCallback(PaymentResponse vo, HttpServletResponse response) throws IOException { |
| | | // payService.rechargeCallback(vo,response); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 充值2异步接收地址 |
| | | // */ |
| | | // @PostMapping({"rechargeCallbackTwo.do"}) |
| | | // public void rechargeCallbackTwo(TransactionStatusVo vo, HttpServletResponse response) throws IOException { |
| | | // payService.rechargeCallbackTwo(vo,response); |
| | | // } |
| | | } |