| | |
| | | System.out.println(base64); |
| | | return ResultBody.ok().data(base64); |
| | | } |
| | | |
| | | //数据封装 |
| | | public SaasClientPay fengData(AlipayTradePrecreateModel model){ |
| | | SaasClientPay saasClientPay = new SaasClientPay(); |
| | |
| | | saasClientPay.setCreateTime(new Date()); |
| | | return saasClientPay; |
| | | } |
| | | |
| | | @ApiOperation(value = "取消订单,支付超时、支付结果未知是可撤销,超过24小时不可撤销-------暂时没有配置") |
| | | @PostMapping("/cancel") |
| | | public ResultBody cancel() throws Exception{ //取消订单,支付超时、支付结果未知是可撤销,超过24小时不可撤销 |
| | |
| | | log.error("eeeeeeeeeeeeeeeewwwwwwwwwwww:"); |
| | | if(requestMap.get("trade_status").equals("TRADE_SUCCESS")){ |
| | | log.error("wwwwwwwwwww"); |
| | | //更新状态 out_trade_no |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("out_trade_no", requestMap.get("out_trade_no")); |
| | | queryWrapper.eq("pay_status", 0); |
| | | List<SaasClientPay> list = saasClientPayService.list(queryWrapper); |
| | | if (!list.isEmpty()) { |
| | | SaasClientPay saasClientPay = list.get(0); |
| | | saasClientPay.setPayTime(DateUtils.parseDate(requestMap.get("gmt_payment"))); |
| | | saasClientPay.setPayStatus(2); |
| | | saasClientPay.setTradeNo(requestMap.get("trade_no")); |
| | | boolean b = saasClientPayService.saveOrUpdate(saasClientPay); |
| | | } |
| | | } |
| | | log.error("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); |
| | | System.out.println("异步通知 "+ Instant.now()); |
| | |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | @ApiOperation(value = "订单支付成功后同步返回地址") |
| | | @PostMapping("/return") |
| | | public ResultBody returnUrl(HttpServletRequest request,Map<String,Object> map) throws Exception{ //订单支付成功后同步返回地址 |
| | |
| | | return ResultBody.failed().data("false"); |
| | | } |
| | | } |
| | | |
| | | private Map<String,String> getRequestMap(Map<String,String[]> requestParams){ |
| | | Map<String,String> params = new HashMap<>(); |
| | | for (String name : requestParams.keySet()) { |
| | |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | private boolean check(Map<String,String[]> requestParams) throws Exception{ //对return、notify参数进行验签 |
| | | Map<String, String> requestMap = this.getRequestMap(requestParams); |
| | | return AlipaySignature.rsaCheckV1(requestMap, alipayProperties.getAlipayPublicKey(), |