| | |
| | | import com.dsh.activity.model.response.HuiminAgreementVO; |
| | | import com.dsh.activity.model.response.HuiminCardVO; |
| | | import com.dsh.activity.service.*; |
| | | import com.dsh.activity.util.PayMoneyUtil; |
| | | |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import com.dsh.activity.util.UUIDUtil; |
| | |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | @Resource |
| | | private PayMoneyUtil payMoneyUtil; |
| | | // @Resource |
| | | // private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | @Autowired |
| | |
| | | */ |
| | | @PostMapping("/aliPayHuiminCallback") |
| | | public void aliPayHuiminCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if (null != map) { |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>().eq(TPayHuimin::getCode, out_trade_no)); |
| | | if (one!=null){ |
| | | if (one.getStatus()==2){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | one.setOrderNumber(transaction_id); |
| | | one.setStatus(2); |
| | | one.setPaymentTime(new Date()); |
| | | payHuiminService.updateById(one); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // try { |
| | | // System.err.println("==========回调"); |
| | | // Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | // if (null != map) { |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>().eq(TPayHuimin::getCode, out_trade_no)); |
| | | // if (one!=null){ |
| | | // if (one.getStatus()==2){ |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.write("success"); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // }else{ |
| | | // one.setOrderNumber(transaction_id); |
| | | // one.setStatus(2); |
| | | // one.setPaymentTime(new Date()); |
| | | // payHuiminService.updateById(one); |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | /** |
| | | * 惠民卡微信支付回调接口 |
| | | */ |
| | | @PostMapping("/weixinPayHuiminCallback") |
| | | public void weixinPayHuiminCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if (null != map) { |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>().eq(TPayHuimin::getCode, out_trade_no)); |
| | | if (one!=null){ |
| | | if (one.getStatus()==2){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | one.setOrderNumber(transaction_id); |
| | | one.setStatus(2); |
| | | one.setPaymentTime(new Date()); |
| | | payHuiminService.updateById(one); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // try { |
| | | // Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | // if (null != map) { |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // String result = map.get("result"); |
| | | // TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>().eq(TPayHuimin::getCode, out_trade_no)); |
| | | // if (one!=null){ |
| | | // if (one.getStatus()==2){ |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.write(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // }else{ |
| | | // one.setOrderNumber(transaction_id); |
| | | // one.setStatus(2); |
| | | // one.setPaymentTime(new Date()); |
| | | // payHuiminService.updateById(one); |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | /** |
| | | * 惠民卡微信退款回调 |
| | |
| | | @ResponseBody |
| | | @PostMapping("/wxRefundHuiminCallback") |
| | | public void wxRefundHuiminCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | Map<String, String> map = payMoneyUtil.wxRefundCallback(request); |
| | | if(null != map){ |
| | | String refund_id = map.get("refund_id"); |
| | | String out_refund_no = map.get("out_refund_no"); |
| | | String result = map.get("result"); |
| | | TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>() |
| | | .eq(TPayHuimin::getCode, out_refund_no)); |
| | | one.setRefundStatus(2); |
| | | one.setRefundTime(new Date()); |
| | | one.setStatus(3); |
| | | one.setRefundNumber(refund_id); |
| | | payHuiminService.updateById(one); |
| | | PrintWriter out = null; |
| | | try { |
| | | out = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | out.println(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | // Map<String, String> map = payMoneyUtil.wxRefundCallback(request); |
| | | // if(null != map){ |
| | | // String refund_id = map.get("refund_id"); |
| | | // String out_refund_no = map.get("out_refund_no"); |
| | | // String result = map.get("result"); |
| | | // TPayHuimin one = payHuiminService.getOne(new LambdaQueryWrapper<TPayHuimin>() |
| | | // .eq(TPayHuimin::getCode, out_refund_no)); |
| | | // one.setRefundStatus(2); |
| | | // one.setRefundTime(new Date()); |
| | | // one.setStatus(3); |
| | | // one.setRefundNumber(refund_id); |
| | | // payHuiminService.updateById(one); |
| | | // PrintWriter out = null; |
| | | // try { |
| | | // out = response.getWriter(); |
| | | // } catch (IOException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // out.println(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | } |
| | | } |