新零售支付全家桶


接收付款通知消息

<p>编写UnionPayController.java</p> <pre><code class="language-java">@RequestMapping("/recvBackResponse") @ApiOperation("接收银联付款通知") public void recvBackResponse(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); HashMap&lt;String, String&gt; reqParam = new HashMap&lt;&gt;(); Enumeration&lt;String&gt; enumeration = request.getParameterNames(); while (enumeration.hasMoreElements()) { String name = enumeration.nextElement(); String value = request.getParameter(name); reqParam.put(name, value); } Map&lt;String, String&gt; valideData = null; if (!reqParam.isEmpty()) { Iterator&lt;Map.Entry&lt;String, String&gt;&gt; it = reqParam.entrySet().iterator(); valideData = new HashMap&lt;String, String&gt;(reqParam.size()); while (it.hasNext()) { Map.Entry&lt;String, String&gt; e = it.next(); String key = (String) e.getKey(); String value = (String) e.getValue(); value = new String(value.getBytes("UTF-8"), "UTF-8"); valideData.put(key, value); } } //重要!验证签名前不要修改reqParam中的键值对的内容,否则会验签不过 if (!acpService.validate(valideData, "UTF-8")) { //验签失败,需解决验签问题 System.out.println("签名验证失败"); response.setCharacterEncoding("UTF-8"); Writer writer = response.getWriter(); writer.write("签名验证失败"); writer.close(); } else { System.out.println("后端通知签名验证成功"); String respCode = request.getParameter("respCode"); String queryId = request.getParameter("queryId"); String code = request.getParameter("orderId"); if ("00".equals(respCode)) { UpdateWrapper updateWrapper = new UpdateWrapper(); updateWrapper.eq("code", code); updateWrapper.set("status", 2); updateWrapper.set("payment_type", 3); updateWrapper.set("prepay_id", queryId); orderService.update(updateWrapper); } response.setCharacterEncoding("UTF-8"); Writer writer = response.getWriter(); writer.write("ok"); writer.close(); } } </code></pre>

页面列表

ITEM_HTML