Commit e09659a09f2b3d7e4bcc8ad516ef1051d28884bc
Merge branch 'master' of https://git.oschina.net/zte-its/rnt-wx.git
Conflicts: src/main/java/com/rnt/service/IRainQueryService.java src/main/resources/a_little_config.txt src/main/webapp/static/js/url.js
Showing
8 changed files
with
398 additions
and
260 deletions
src/main/java/com/rnt/commo/enums/ErrorType.java
| ... | ... | @@ -2,16 +2,19 @@ package com.rnt.commo.enums; |
| 2 | 2 | |
| 3 | 3 | public enum ErrorType { |
| 4 | 4 | |
| 5 | - WX_NO_BIND("1004","用户未绑定"), | |
| 5 | + | |
| 6 | 6 | SYSTEM_ERROR("1000", "系统错误"), |
| 7 | 7 | APP_ERROR("1001", "应用错误"), |
| 8 | 8 | BIZ_ERROR("1002", "业务错误:%s"), |
| 9 | 9 | PARAMM_NULL("1003", "入参不能为空:[%s]"), |
| 10 | 10 | RAND_CODE_ERROE("1004", "验证码验证失败!"), |
| 11 | 11 | NO_PARKING_MSG("1005", "无停车记录!"), |
| 12 | + WX_NO_BIND("1006","用户未绑定"), | |
| 13 | + ORDER_NO_EXISTS("1007","订单不存在"), | |
| 12 | 14 | BIZ_SUCCESS("8888", "成功"), |
| 13 | 15 | URL_REDIRECT("-1111", "业务URL跳转"); |
| 14 | 16 | |
| 17 | + | |
| 15 | 18 | private String code; |
| 16 | 19 | private String msg; |
| 17 | 20 | ... | ... |
src/main/java/com/rnt/commo/enums/OrderTypeEnum.java
| ... | ... | @@ -37,7 +37,12 @@ public enum OrderTypeEnum { |
| 37 | 37 | |
| 38 | 38 | /**订单明细类型 */ |
| 39 | 39 | ORDER_DETAIL_TYPE_BUY_CARD(1,"购卡"), |
| 40 | - ORDER_DETAIL_TYPE_RENEW_CARD(2,"续费"); | |
| 40 | + ORDER_DETAIL_TYPE_RENEW_CARD(2,"续费"), | |
| 41 | + | |
| 42 | + /***封闭停车场 1、道闸*/ | |
| 43 | + ORDER_SOURCE_TYPE_IN(1,"道闸"), | |
| 44 | + /**开放停车场 2 地磁*/ | |
| 45 | + ORDER_SOURCE_TYPE_OUT(2,"地磁"); | |
| 41 | 46 | |
| 42 | 47 | |
| 43 | 48 | private Integer value; | ... | ... |
src/main/java/com/rnt/controller/ParkLotController.java
| ... | ... | @@ -15,6 +15,7 @@ import com.jfinal.log.Log; |
| 15 | 15 | import com.jfinal.plugin.activerecord.Page; |
| 16 | 16 | import com.rnt.commo.enums.ErrorType; |
| 17 | 17 | import com.rnt.model.zf.ParkCardCoupons; |
| 18 | +import com.rnt.service.IRainQueryService; | |
| 18 | 19 | import com.rnt.service.ParkCardCouponsService; |
| 19 | 20 | import com.rnt.service.ParkLotService; |
| 20 | 21 | import com.rnt.service.PersonCardCouponsService; |
| ... | ... | @@ -190,4 +191,21 @@ public class ParkLotController extends Controller { |
| 190 | 191 | this.renderJson(result); |
| 191 | 192 | } |
| 192 | 193 | |
| 194 | + /** | |
| 195 | + * 抬杆通知走车 | |
| 196 | + */ | |
| 197 | + public void passHandrail() { | |
| 198 | + String orderId = getPara("orderId"); | |
| 199 | + BizResult<String> result = new BizResult<>(); | |
| 200 | + IRainQueryService service = Duang.duang(IRainQueryService.class); | |
| 201 | + try { | |
| 202 | + result = service.passHandrail(orderId); | |
| 203 | + } catch (Exception e) { | |
| 204 | + result.setErrorMessage(ErrorType.APP_ERROR, "抬杆通知失败!"); | |
| 205 | + logger.error("支付成功,抬杆通知失败!", e); | |
| 206 | + } | |
| 207 | + logger.info("支付成功,抬杆通知 result=" + JSONObject.toJSONString(result)); | |
| 208 | + renderJson(result); | |
| 209 | + } | |
| 210 | + | |
| 193 | 211 | } | ... | ... |
src/main/java/com/rnt/service/IRainQueryService.java
| 1 | 1 | package com.rnt.service; |
| 2 | 2 | |
| 3 | +import java.math.BigDecimal; | |
| 3 | 4 | import java.util.HashMap; |
| 4 | 5 | import java.util.Map; |
| 5 | 6 | |
| 6 | 7 | import org.beetl.sql.core.kit.StringKit; |
| 7 | 8 | |
| 8 | -import com.alibaba.fastjson.JSON; | |
| 9 | 9 | import com.alibaba.fastjson.JSONObject; |
| 10 | + | |
| 10 | 11 | import com.jfinal.kit.Prop; |
| 11 | 12 | import com.jfinal.kit.PropKit; |
| 12 | 13 | import com.jfinal.log.Log; |
| 14 | +import com.rnt.commo.enums.ErrorType; | |
| 15 | +import com.rnt.commo.enums.OrderTypeEnum; | |
| 13 | 16 | import com.rnt.model.park.IrainPknoRelation; |
| 17 | +import com.rnt.model.zf.Order; | |
| 18 | +import com.rnt.model.zf.OrderDetailPark; | |
| 14 | 19 | import com.rnt.utils.HttpClientTutorial; |
| 15 | 20 | import com.rnt.utils.MD5Utils; |
| 16 | 21 | import com.zteits.clouds.api.dto.park.param.RoadsideRequest; |
| 22 | +import com.rnt.vo.BizResult; | |
| 17 | 23 | |
| 18 | 24 | /** |
| 19 | 25 | * 艾润费用查询service.<br/> |
| 20 | - * | |
| 26 | + * | |
| 21 | 27 | * Copyright: Copyright (c) 2017 zteits |
| 22 | - * | |
| 28 | + * | |
| 23 | 29 | * @ClassName: IRainQueryService.java |
| 24 | - * @Description: | |
| 30 | + * @Description: | |
| 25 | 31 | * @version: v1.0.0 |
| 26 | 32 | * @author: wangfs |
| 27 | - * @date: 2017年6月13日 上午9:25:31 | |
| 33 | + * @date: 2017年6月13日 上午9:25:31 | |
| 28 | 34 | * Modification History: |
| 29 | 35 | * Date Author Version Description |
| 30 | - *---------------------------------------------------------* | |
| 36 | + * ---------------------------------------------------------* | |
| 31 | 37 | * 2017年6月13日 wangfs v1.0.0 创建 |
| 32 | 38 | */ |
| 33 | 39 | public class IRainQueryService { |
| 34 | - private static final Log logger = Log.getLog(IRainQueryService.class); | |
| 40 | + private static final Log logger = Log.getLog(IRainQueryService.class); | |
| 35 | 41 | |
| 36 | 42 | /** |
| 37 | 43 | * 调用艾润查询费用接口.<br/> |
| ... | ... | @@ -134,7 +140,7 @@ public class IRainQueryService { |
| 134 | 140 | * @param json |
| 135 | 141 | * @return |
| 136 | 142 | */ |
| 137 | - private static Map<String, String> jsonToMapForIrunResult(String json) { | |
| 143 | + private Map<String, String> jsonToMapForIrunResult(String json) { | |
| 138 | 144 | |
| 139 | 145 | JSONObject jsobj = JSONObject.parseObject(json); |
| 140 | 146 | Map<String, String> map = new HashMap<String, String>(); |
| ... | ... | @@ -170,33 +176,117 @@ public class IRainQueryService { |
| 170 | 176 | return map; |
| 171 | 177 | } |
| 172 | 178 | |
| 173 | - public static void main(String[] args) { | |
| 174 | - /**Map<String, String> map = new HashMap<String, String>(); | |
| 175 | - Prop prop = PropKit.use("a_little_config.txt"); | |
| 176 | - Long time = System.currentTimeMillis(); | |
| 177 | - String md5 = MD5Utils.enMD5(prop.get("irain.appid")+prop.get("irain.appsecret")+time); | |
| 178 | - Map<String, Object> params = new HashMap<>(); | |
| 179 | - params.put("appid", prop.get("irain.appid")); | |
| 180 | - params.put("sign", md5); | |
| 181 | - params.put("timestamp", time); | |
| 182 | - params.put("vpl_number", "苏BV291U"); | |
| 183 | - params.put("park_code", "734861a1e8656ffa51bdd90829941ca9"); | |
| 184 | - String rs = ""; | |
| 185 | - try { | |
| 186 | - logger.info("irain 查询停车费用入参:" + JSONObject.toJSONString(params)); | |
| 187 | - rs = HttpClientTutorial.httpPostRequest(prop.get("irain.url")+"/bill/Query", params); | |
| 188 | - logger.info("irain 查询停车费用返回:" + JSONObject.toJSONString(rs)); | |
| 189 | - if (StringKit.isNotBlank(rs) && !"NO_PARK_RECORD".equals(JSONObject.parseObject(rs).get("code"))) { | |
| 190 | - System.out.println(rs); | |
| 191 | - map = jsonToMapForIrunResult(rs); | |
| 192 | - System.out.println("------"+JSONObject.toJSON(map)); | |
| 193 | - }else{ | |
| 194 | - logger.info("调用艾润费用查询接口:无停车记录"); | |
| 195 | - } | |
| 196 | - | |
| 197 | - } catch (Exception e) { | |
| 198 | - logger.info("irain 查询停车费用出错:" + e); | |
| 199 | - }*/ | |
| 200 | - queryBillRoadside("101332467802357239808"); | |
| 201 | - } | |
| 179 | + | |
| 180 | + | |
| 181 | + /*** | |
| 182 | + * 支付完成,停车通过栏杆 | |
| 183 | + */ | |
| 184 | + | |
| 185 | + public BizResult<String> passHandrail(String orderId) throws Exception { | |
| 186 | + BizResult<String> bizResult = new BizResult<>(); | |
| 187 | + logger.info(" 支付完成,通知抬杆 ----start--- req=" + orderId); | |
| 188 | + Order order = Order.dao.findFirst("SELECT * FROM td_b_order t where t.order_id = ?", orderId); | |
| 189 | + if (null == order) { | |
| 190 | + logger.info(" 支付完成,通知抬杆 订单不存在 orderId=" + orderId); | |
| 191 | + bizResult.setErrorMessage(ErrorType.ORDER_NO_EXISTS, "订单不存在"); | |
| 192 | + return bizResult; | |
| 193 | + } | |
| 194 | + | |
| 195 | + if (order.getSourceType().equals(OrderTypeEnum.ORDER_SOURCE_TYPE_IN)) { | |
| 196 | + /** | |
| 197 | + * 艾润通知 | |
| 198 | + */ | |
| 199 | + bizResult = passIRail(order.getCarNumber(), order.getParkId(), order.getOrderTotalFee()); | |
| 200 | + logger.info("艾润抬杆通知 返回为: bizResult=" + JSONObject.toJSONString(bizResult)); | |
| 201 | + | |
| 202 | + } else if (order.getSourceType().equals(OrderTypeEnum.ORDER_SOURCE_TYPE_OUT)) { | |
| 203 | + /** | |
| 204 | + * 青岛 | |
| 205 | + */ | |
| 206 | + bizResult = passQD(order); | |
| 207 | + | |
| 208 | + } else { | |
| 209 | + logger.info("支付完成,通知抬杆 未知的订单来源类型: orderSourceType=" + order.getSourceType()); | |
| 210 | + bizResult.setErrorMessage(ErrorType.BIZ_ERROR, "未知的订单来源类型"); | |
| 211 | + } | |
| 212 | + | |
| 213 | + return bizResult; | |
| 214 | + | |
| 215 | + } | |
| 216 | + | |
| 217 | + /** | |
| 218 | + * 艾润抬杆设置 | |
| 219 | + */ | |
| 220 | + private BizResult<String> passIRail(String vpl_number, String park_code, BigDecimal amount) throws Exception { | |
| 221 | + BizResult<String> bizResult = new BizResult<>(); | |
| 222 | + //1.查询停车场关系映射表-获取艾润停车场查询费用编码 ztetis-park.irain_pkno_relation | |
| 223 | + StringBuffer sql = new StringBuffer("select a.irain_pkno1"); | |
| 224 | + sql.append(" from irain_pkno_relation a"); | |
| 225 | + sql.append(" where a.park_lotpkno = ?"); | |
| 226 | + String rs = ""; | |
| 227 | + IrainPknoRelation irainPknoRelation = new IrainPknoRelation().findFirst(sql.toString(), park_code); | |
| 228 | + | |
| 229 | + if (irainPknoRelation != null && StringKit.isNotBlank(irainPknoRelation.getIrainPkno2())) { | |
| 230 | + /**** 以下为模拟入参 实际入参 由app提供-------------------------------------*/ | |
| 231 | + Prop prop = PropKit.use("a_little_config.txt"); | |
| 232 | + Long time = System.currentTimeMillis(); | |
| 233 | + String md5 = MD5Utils.enMD5(prop.get("irain.appid") + prop.get("irain.appsecret") + time); | |
| 234 | + Map<String, Object> params = new HashMap<>(); | |
| 235 | + params.put("appid", prop.get("irain.appid")); | |
| 236 | + params.put("sign", md5); | |
| 237 | + params.put("timestamp", time); | |
| 238 | + params.put("vpl_number", vpl_number); | |
| 239 | + //要用进出场上报的那个编码 | |
| 240 | + params.put("park_code", irainPknoRelation.getIrainPkno2()); | |
| 241 | + params.put("amount", amount.intValue()); | |
| 242 | + | |
| 243 | + logger.info("开始通知irain 支付已经完成:" + JSONObject.toJSONString(params)); | |
| 244 | + rs = HttpClientTutorial.httpPostRequest(prop.get("irain.url") + "/pay/Issued", params); | |
| 245 | + logger.info("结束通知irain 支付已经完成::" + rs); | |
| 246 | + JSONObject result = JSONObject.parseObject(rs); | |
| 247 | + | |
| 248 | + if ("OK".equals(result.getString("message"))) { | |
| 249 | + bizResult.setData("通知成功!"); | |
| 250 | + } else { | |
| 251 | + bizResult.setErrorMessage(ErrorType.BIZ_ERROR, "通知irain 支付已经完成失败!"); | |
| 252 | + | |
| 253 | + } | |
| 254 | + return bizResult; | |
| 255 | + | |
| 256 | + } else { | |
| 257 | + logger.info("没有查询到艾润进出场上报编码"); | |
| 258 | + bizResult.setErrorMessage(ErrorType.BIZ_ERROR, "未查询到艾润进出场上报编码"); | |
| 259 | + return bizResult; | |
| 260 | + } | |
| 261 | + | |
| 262 | + } | |
| 263 | + | |
| 264 | + /** | |
| 265 | + * 青岛抬杆设置 | |
| 266 | + */ | |
| 267 | + private BizResult<String> passQD(Order order) throws Exception { | |
| 268 | + BizResult<String> bizResult = new BizResult<>(); | |
| 269 | + String url = PropKit.get("qd.retrun_fee_url"); | |
| 270 | + OrderDetailPark orderDetailPark = OrderDetailPark.dao.findFirst( | |
| 271 | + "SELECT * FROM td_b_order_detail_park t where t.order_id = ?", order.getOrderId()); | |
| 272 | + | |
| 273 | + Map<String, Object> params = new HashMap<>(); | |
| 274 | + params.put("orderCode", orderDetailPark.getRecordId()); | |
| 275 | + params.put("amount", order.getOrderTotalFee().intValue()); | |
| 276 | + params.put("orderPay", order.getOrderPayedFee().intValue()); | |
| 277 | + params.put("payType", 1); | |
| 278 | + | |
| 279 | + logger.info("开始通知irain 支付已经完成:" + JSONObject.toJSONString(params)); | |
| 280 | + String rs = HttpClientTutorial.httpPostRequest(url, JSONObject.toJSONString(params)); | |
| 281 | + logger.info("结束通知irain 支付已经完成:" + rs); | |
| 282 | + JSONObject result = JSONObject.parseObject(rs); | |
| 283 | + if ("1".equals(result.getString("status"))) { | |
| 284 | + bizResult.setData("通知成功!"); | |
| 285 | + } else { | |
| 286 | + bizResult.setErrorMessage(ErrorType.BIZ_ERROR, "通知青岛 支付已经完成失败!"); | |
| 287 | + } | |
| 288 | + return bizResult; | |
| 289 | + } | |
| 290 | + | |
| 291 | + | |
| 202 | 292 | } | ... | ... |
src/main/java/com/rnt/utils/HttpClientTutorial.java
| ... | ... | @@ -95,30 +95,25 @@ public class HttpClientTutorial { |
| 95 | 95 | return getResult(httpPost); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public static String httpPostRequest(String url, String jsonParam) throws UnsupportedEncodingException { | |
| 99 | - HttpPost httpPost = new HttpPost(url); | |
| 100 | - if (null != jsonParam) { | |
| 101 | - //解决中文乱码问题 | |
| 102 | - StringEntity entity = new StringEntity(jsonParam, "utf-8"); | |
| 103 | - entity.setContentEncoding("UTF-8"); | |
| 104 | - entity.setContentType("application/json"); | |
| 105 | - httpPost.setEntity(entity); | |
| 106 | - } | |
| 107 | - return getResult(httpPost); | |
| 108 | - } | |
| 109 | 98 | |
| 110 | 99 | public static String httpPostRequest(String url, JSONObject jsonParam) throws UnsupportedEncodingException { |
| 111 | - HttpPost httpPost = new HttpPost(url); | |
| 100 | + | |
| 101 | + return httpPostRequest(url,jsonParam.toJSONString()); | |
| 102 | + } | |
| 103 | + | |
| 104 | + public static String httpPostRequest(String url, String jsonParam) throws UnsupportedEncodingException { | |
| 105 | + HttpPost httpPost = new HttpPost(url); | |
| 112 | 106 | if (null != jsonParam) { |
| 113 | 107 | //解决中文乱码问题 |
| 114 | - StringEntity entity = new StringEntity(jsonParam.toString(), "utf-8"); | |
| 108 | + StringEntity entity = new StringEntity(jsonParam, "utf-8"); | |
| 115 | 109 | entity.setContentEncoding("UTF-8"); |
| 116 | 110 | entity.setContentType("application/json"); |
| 117 | 111 | httpPost.setEntity(entity); |
| 118 | - } | |
| 119 | - return getResult(httpPost); | |
| 120 | - } | |
| 121 | - | |
| 112 | + } | |
| 113 | + return getResult(httpPost); | |
| 114 | + } | |
| 115 | + | |
| 116 | + | |
| 122 | 117 | public static String httpPostRequest(String url, Map<String, Object> headers, Map<String, Object> params) |
| 123 | 118 | throws UnsupportedEncodingException { |
| 124 | 119 | HttpPost httpPost = new HttpPost(url); | ... | ... |
src/main/resources/a_little_config.txt
| ... | ... | @@ -47,8 +47,8 @@ zf.druid.testOnReturn=false |
| 47 | 47 | zf.druid.testOnWhileIdle=true |
| 48 | 48 | |
| 49 | 49 | #Redis config |
| 50 | -redis.host=127.0.0.1 | |
| 51 | -redis.port=6379 | |
| 50 | +redis.host=10.117.61.52 | |
| 51 | +redis.port=7001 | |
| 52 | 52 | redis.password=myredis |
| 53 | 53 | |
| 54 | 54 | |
| ... | ... | @@ -91,6 +91,8 @@ irain.park_code=734861a1e8656ffa51bdd90829941ca9 |
| 91 | 91 | #青岛路侧费用查询url |
| 92 | 92 | qindao.url=http://zteits.gnway.cc:8088/RNT-ATMS-ADAPTER/pay/doPayAdvice |
| 93 | 93 | |
| 94 | +#青岛路侧数据 | |
| 95 | +qd.retrun_fee_url=http://zteits.gnway.cc:8088/RNT-ATMS-ADAPTER/pay/doPayAdvice | |
| 94 | 96 | |
| 95 | 97 | #dubbo |
| 96 | 98 | dubbo.application.name=rnt-wx | ... | ... |
src/main/webapp/WEB-INF/pages/pay.html
| 1 | 1 | <!DOCTYPE html> |
| 2 | 2 | <html lang="en"> |
| 3 | 3 | <head> |
| 4 | - <meta charset="UTF-8"> | |
| 5 | - <title>支付</title> | |
| 6 | - <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | |
| 7 | - <meta name="format-detection" content="telephone=no"/> | |
| 8 | - <meta name="format-detection" content="email=no"/> | |
| 9 | - <meta name="apple-mobile-web-app-status-bar-style" content="black"/> | |
| 10 | - <meta name="apple-mobile-web-app-capable" content="yes"/> | |
| 11 | - <meta name="apple-mobile-web-app-title" content=""> | |
| 12 | - <meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 --> | |
| 13 | - <link rel="apple-touch-icon-precomposed" href="favicon.ico"> | |
| 14 | - <link rel="shortcut icon" href="favicon.ico"> | |
| 15 | - <link rel="Bookmark" href="favicon.ico"> | |
| 16 | - | |
| 17 | - <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css"> | |
| 18 | - <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css"> | |
| 19 | - <link rel="stylesheet" href="${staticHost}/css/reset.css"> | |
| 20 | - <link rel="stylesheet" href="${staticHost}/css/card.css?v=1.0"> | |
| 21 | - <style> | |
| 22 | - .checked_icon { | |
| 23 | - width: 20px; | |
| 24 | - height: 20px; | |
| 25 | - background: url("${staticHost}/img/checked_icon.png"); | |
| 26 | - background-size: 100% 100%; | |
| 27 | - } | |
| 4 | + <meta charset="UTF-8"> | |
| 5 | + <title>支付</title> | |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | |
| 7 | + <meta name="format-detection" content="telephone=no"/> | |
| 8 | + <meta name="format-detection" content="email=no"/> | |
| 9 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"/> | |
| 10 | + <meta name="apple-mobile-web-app-capable" content="yes"/> | |
| 11 | + <meta name="apple-mobile-web-app-title" content=""> | |
| 12 | + <meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 --> | |
| 13 | + <link rel="apple-touch-icon-precomposed" href="favicon.ico"> | |
| 14 | + <link rel="shortcut icon" href="favicon.ico"> | |
| 15 | + <link rel="Bookmark" href="favicon.ico"> | |
| 16 | + | |
| 17 | + <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css"> | |
| 18 | + <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css"> | |
| 19 | + <link rel="stylesheet" href="${staticHost}/css/reset.css"> | |
| 20 | + <link rel="stylesheet" href="${staticHost}/css/card.css?v=1.0"> | |
| 21 | + <style> | |
| 22 | + .checked_icon { | |
| 23 | + width: 20px; | |
| 24 | + height: 20px; | |
| 25 | + background: url("${staticHost}/img/checked_icon.png"); | |
| 26 | + background-size: 100% 100%; | |
| 27 | + } | |
| 28 | 28 | |
| 29 | - .weixin_icon { | |
| 30 | - margin-right: 10px; | |
| 31 | - width: 20px; | |
| 32 | - height: 20px; | |
| 33 | - background: url("${staticHost}/img/weixin_pay.png"); | |
| 34 | - background-size: 100% 100%; | |
| 35 | - } | |
| 29 | + .weixin_icon { | |
| 30 | + margin-right: 10px; | |
| 31 | + width: 20px; | |
| 32 | + height: 20px; | |
| 33 | + background: url("${staticHost}/img/weixin_pay.png"); | |
| 34 | + background-size: 100% 100%; | |
| 35 | + } | |
| 36 | 36 | |
| 37 | - .all_told, .platen_number { | |
| 38 | - text-align: center; | |
| 39 | - } | |
| 37 | + .all_told, .platen_number { | |
| 38 | + text-align: center; | |
| 39 | + } | |
| 40 | 40 | |
| 41 | - .all_told { | |
| 42 | - padding: 30px 0 10px 0; | |
| 43 | - } | |
| 41 | + .all_told { | |
| 42 | + padding: 30px 0 10px 0; | |
| 43 | + } | |
| 44 | 44 | |
| 45 | - .all_told span { | |
| 46 | - margin-right: 5px; | |
| 47 | - font-size: 22px; | |
| 48 | - } | |
| 49 | - </style> | |
| 45 | + .all_told span { | |
| 46 | + margin-right: 5px; | |
| 47 | + font-size: 22px; | |
| 48 | + } | |
| 49 | + </style> | |
| 50 | 50 | </head> |
| 51 | 51 | |
| 52 | 52 | <body ontouchstart> |
| 53 | 53 | <input type="hidden" id="parkOrderId" value="${parkOrderId!''}"/> |
| 54 | 54 | <div class="weui-panel__bd card-top"> |
| 55 | - <input type="hidden" id="orderId" value=""/> | |
| 56 | - <div class="weui-media-box weui-media-box_text weui-media-box-border card-park"> | |
| 57 | - <h4 class="weui-media-box__title park-tit" id="parkLotName"></h4> | |
| 58 | - <p class="weui-media-box__desc park-desc" id="parkLotAddress"></p> | |
| 59 | - </div> | |
| 60 | - <div class="park-bg"></div> | |
| 55 | + <input type="hidden" id="orderId" value=""/> | |
| 56 | + <div class="weui-media-box weui-media-box_text weui-media-box-border card-park"> | |
| 57 | + <h4 class="weui-media-box__title park-tit" id="parkLotName"></h4> | |
| 58 | + <p class="weui-media-box__desc park-desc" id="parkLotAddress"></p> | |
| 59 | + </div> | |
| 60 | + <div class="park-bg"></div> | |
| 61 | 61 | </div> |
| 62 | 62 | <div class="weui-cells weui-cells_form" style="margin-top: 0em;"> |
| 63 | - <div class="weui-cell"> | |
| 64 | - <div class="weui-cell__hd"><label for="" class="weui-label">车 牌 号</label></div> | |
| 65 | - <div class="weui-cell__bd" id="carNum"> | |
| 63 | + <div class="weui-cell"> | |
| 64 | + <div class="weui-cell__hd"><label for="" class="weui-label">车 牌 号</label></div> | |
| 65 | + <div class="weui-cell__bd" id="carNum"> | |
| 66 | 66 | |
| 67 | + </div> | |
| 67 | 68 | </div> |
| 68 | - </div> | |
| 69 | - <div class="weui-cell"> | |
| 70 | - <div class="weui-cell__hd"><label for="" class="weui-label">卡 类 型</label></div> | |
| 71 | - <div class="weui-cell__bd" id="carTypeRemark"> | |
| 69 | + <div class="weui-cell"> | |
| 70 | + <div class="weui-cell__hd"><label for="" class="weui-label">卡 类 型</label></div> | |
| 71 | + <div class="weui-cell__bd" id="carTypeRemark"> | |
| 72 | 72 | |
| 73 | + </div> | |
| 73 | 74 | </div> |
| 74 | - </div> | |
| 75 | - <div class="weui-cell"> | |
| 76 | - <div class="weui-cell__hd"><label for="" class="weui-label">订购数量</label></div> | |
| 77 | - <div class="weui-cell__bd" id="buyNum"> | |
| 75 | + <div class="weui-cell"> | |
| 76 | + <div class="weui-cell__hd"><label for="" class="weui-label">订购数量</label></div> | |
| 77 | + <div class="weui-cell__bd" id="buyNum"> | |
| 78 | 78 | |
| 79 | + </div> | |
| 79 | 80 | </div> |
| 80 | - </div> | |
| 81 | - <div class="weui-cell"> | |
| 82 | - <div class="weui-cell__hd"><label for="" class="weui-label">开始时间</label></div> | |
| 83 | - <div class="weui-cell__bd" id="startDate"> | |
| 81 | + <div class="weui-cell"> | |
| 82 | + <div class="weui-cell__hd"><label for="" class="weui-label">开始时间</label></div> | |
| 83 | + <div class="weui-cell__bd" id="startDate"> | |
| 84 | 84 | |
| 85 | + </div> | |
| 85 | 86 | </div> |
| 86 | - </div> | |
| 87 | 87 | |
| 88 | - <div class="weui-cell"> | |
| 89 | - <div class="weui-cell__hd"><label for="" class="weui-label">有效期至</label></div> | |
| 90 | - <div class="weui-cell__bd" id="endDate"> | |
| 88 | + <div class="weui-cell"> | |
| 89 | + <div class="weui-cell__hd"><label for="" class="weui-label">有效期至</label></div> | |
| 90 | + <div class="weui-cell__bd" id="endDate"> | |
| 91 | 91 | |
| 92 | + </div> | |
| 92 | 93 | </div> |
| 93 | - </div> | |
| 94 | - <div class="weui-cell"> | |
| 95 | - <div class="weui-cell__hd"><label for="" class="weui-label">支付金额</label></div> | |
| 96 | - <div class="weui-cell__bd" id="totalAmount"> | |
| 94 | + <div class="weui-cell"> | |
| 95 | + <div class="weui-cell__hd"><label for="" class="weui-label">支付金额</label></div> | |
| 96 | + <div class="weui-cell__bd" id="totalAmount"> | |
| 97 | 97 | |
| 98 | + </div> | |
| 98 | 99 | </div> |
| 99 | - </div> | |
| 100 | 100 | |
| 101 | 101 | </div> |
| 102 | 102 | |
| 103 | 103 | <div class="weui-cells"> |
| 104 | - <label class="weui-cell"> | |
| 105 | - <div class="weui-cell__hd weixin_icon"> | |
| 106 | - </div> | |
| 107 | - <div class="weui-cell__bd"> | |
| 108 | - <p>微信支付</p> | |
| 109 | - </div> | |
| 110 | - <div class="weui-cell__hd checked_icon"> | |
| 104 | + <label class="weui-cell"> | |
| 105 | + <div class="weui-cell__hd weixin_icon"> | |
| 106 | + </div> | |
| 107 | + <div class="weui-cell__bd"> | |
| 108 | + <p>微信支付</p> | |
| 109 | + </div> | |
| 110 | + <div class="weui-cell__hd checked_icon"> | |
| 111 | 111 | |
| 112 | - </div> | |
| 113 | - </label> | |
| 112 | + </div> | |
| 113 | + </label> | |
| 114 | 114 | |
| 115 | 115 | </div> |
| 116 | 116 | |
| 117 | 117 | <div class="pay-content-padded"> |
| 118 | - <a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">确定支付</a> | |
| 118 | + <a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">确定支付</a> | |
| 119 | 119 | </div> |
| 120 | 120 | |
| 121 | 121 | |
| ... | ... | @@ -124,134 +124,156 @@ |
| 124 | 124 | <script src="${staticHost}/js/jsutil.js"></script> |
| 125 | 125 | <script src="${staticHost}/js/url.js"></script> |
| 126 | 126 | <script type="text/javascript"> |
| 127 | - var totleMoney; | |
| 128 | - var func = { | |
| 129 | - //1.获取订单信息 | |
| 130 | - initOrderInfo: function () { | |
| 131 | - $('#orderId').val(); | |
| 132 | - $('#parkLotName').empty(); | |
| 133 | - $('#parkLotAddress').empty(); | |
| 134 | - $('#carNum').empty(); | |
| 135 | - $('#buyNum').empty(); | |
| 136 | - $('#startDate').empty(); | |
| 137 | - $('#endDate').empty(); | |
| 138 | - $('#totalAmount').empty(); | |
| 139 | - $('#carTypeRemark').empty(); | |
| 140 | - | |
| 141 | - var parkOrderId = $('#parkOrderId').val(); | |
| 142 | - var jsonInfo = {}; | |
| 143 | - jsonInfo.parkOrderId = parkOrderId; | |
| 144 | - if (parkOrderId != null && parkOrderId != '') { | |
| 145 | - jsutil.defaultReq( | |
| 146 | - mUrl.queryOrderForNotPay, | |
| 147 | - jsonInfo, | |
| 148 | - function (data) { | |
| 149 | - if ("8888" != data.code) { | |
| 150 | - windown.location.href = mUrl.errorView; | |
| 127 | + var totleMoney; | |
| 128 | + var func = { | |
| 129 | + //1.获取订单信息 | |
| 130 | + initOrderInfo: function () { | |
| 131 | + $('#orderId').val(); | |
| 132 | + $('#parkLotName').empty(); | |
| 133 | + $('#parkLotAddress').empty(); | |
| 134 | + $('#carNum').empty(); | |
| 135 | + $('#buyNum').empty(); | |
| 136 | + $('#startDate').empty(); | |
| 137 | + $('#endDate').empty(); | |
| 138 | + $('#totalAmount').empty(); | |
| 139 | + $('#carTypeRemark').empty(); | |
| 140 | + | |
| 141 | + var parkOrderId = $('#parkOrderId').val(); | |
| 142 | + var jsonInfo = {}; | |
| 143 | + jsonInfo.parkOrderId = parkOrderId; | |
| 144 | + if (parkOrderId != null && parkOrderId != '') { | |
| 145 | + jsutil.defaultReq( | |
| 146 | + mUrl.queryOrderForNotPay, | |
| 147 | + jsonInfo, | |
| 148 | + function (data) { | |
| 149 | + if ("8888" != data.code) { | |
| 150 | + windown.location.href = mUrl.errorView; | |
| 151 | + } else { | |
| 152 | + var order = data.data; | |
| 153 | + | |
| 154 | + $('#orderId').val(order.orderId); | |
| 155 | + $('#parkLotName').text(order.parkName); | |
| 156 | + $('#parkLotAddress').text(order.parkaddress); | |
| 157 | + $('#carNum').text(order.carNum); | |
| 158 | + $('#buyNum').text(order.buyNum); | |
| 159 | + $('#startDate').text(order.startDate); | |
| 160 | + $('#endDate').text(order.endDate); | |
| 161 | + totleMoney = order.totleMoney / 100; | |
| 162 | + $('#totalAmount').text('¥' + totleMoney); | |
| 163 | + | |
| 164 | + $('#carTypeRemark').text(order.orderTypeRemark); | |
| 165 | + } | |
| 166 | + }); | |
| 151 | 167 | } else { |
| 152 | - var order = data.data; | |
| 153 | - | |
| 154 | - $('#orderId').val(order.orderId); | |
| 155 | - $('#parkLotName').text(order.parkName); | |
| 156 | - $('#parkLotAddress').text(order.parkaddress); | |
| 157 | - $('#carNum').text(order.carNum); | |
| 158 | - $('#buyNum').text(order.buyNum); | |
| 159 | - $('#startDate').text(order.startDate); | |
| 160 | - $('#endDate').text(order.endDate); | |
| 161 | - totleMoney = order.totleMoney/100; | |
| 162 | - $('#totalAmount').text('¥'+totleMoney); | |
| 163 | - | |
| 164 | - $('#carTypeRemark').text(order.orderTypeRemark); | |
| 168 | + windown.location.href = mUrl.errorView; | |
| 165 | 169 | } |
| 166 | - }); | |
| 167 | - } else { | |
| 168 | - windown.location.href = mUrl.errorView; | |
| 169 | - } | |
| 170 | 170 | |
| 171 | - } | |
| 172 | - }; | |
| 173 | - | |
| 174 | - $(function () { | |
| 175 | - func.initOrderInfo(); | |
| 176 | - }); | |
| 177 | - | |
| 178 | - var flg = true; | |
| 179 | - $("#showTooltips").click(function () { | |
| 180 | - if (flg) { | |
| 181 | - flg = false; | |
| 182 | - $('#showTooltips').attr('class', 'weui-btn weui-btn_primary weui-btn_disabled'); | |
| 183 | - var parkOrderId = $('#parkOrderId').val(); | |
| 184 | - if (parkOrderId.length < 1) { | |
| 185 | - $.toptip("亲!订单Id为空", 2000, "error"); | |
| 186 | - $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 187 | - flg = true; | |
| 188 | - return false; | |
| 189 | - } | |
| 190 | - var req = { | |
| 191 | - orderId: parkOrderId | |
| 192 | - } | |
| 193 | - | |
| 194 | - $.ajax({ | |
| 195 | - url: mUrl.getJSPayParam, | |
| 196 | - type: 'post', | |
| 197 | - dataType: 'json', | |
| 198 | - data: req, | |
| 199 | - success: function (res) { | |
| 200 | - if (res.code == '8888') { | |
| 201 | - var payParam = res.data; | |
| 202 | - console.log(payParam); | |
| 203 | - //调用微信支付 | |
| 204 | - callpay(payParam); | |
| 205 | - } else { | |
| 206 | - $.toptip(res.msg, 2000, "error"); | |
| 207 | - $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 208 | - flg = true; | |
| 209 | - console.log('详细错误信息为:' + res.data); | |
| 210 | - } | |
| 211 | 171 | } |
| 212 | - }); | |
| 213 | - }//IF | |
| 214 | - }); | |
| 215 | - | |
| 216 | - //调用微信JS api 支付 | |
| 217 | - function jsApiCall(payParam) { | |
| 218 | - WeixinJSBridge.invoke( | |
| 219 | - 'getBrandWCPayRequest', | |
| 220 | - JSON.parse(payParam), | |
| 221 | - function (res) { | |
| 222 | - | |
| 223 | - if (res.err_msg == "get_brand_wcpay_request:ok") { | |
| 224 | - //$.alert("亲!支付成功!"); | |
| 225 | - //支付成功 | |
| 226 | - window.location.href = mUrl.paySuccessView + '&payMoney=' + totleMoney; | |
| 172 | + }; | |
| 173 | + | |
| 174 | + $(function () { | |
| 175 | + func.initOrderInfo(); | |
| 176 | + }); | |
| 177 | + | |
| 178 | + var flg = true; | |
| 179 | + $("#showTooltips").click(function () { | |
| 180 | + if (flg) { | |
| 181 | + flg = false; | |
| 182 | + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary weui-btn_disabled'); | |
| 183 | + var parkOrderId = $('#parkOrderId').val(); | |
| 184 | + if (parkOrderId.length < 1) { | |
| 185 | + $.toptip("亲!订单Id为空", 2000, "error"); | |
| 186 | + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 187 | + flg = true; | |
| 188 | + return false; | |
| 189 | + } | |
| 190 | + var req = { | |
| 191 | + orderId: parkOrderId | |
| 192 | + } | |
| 227 | 193 | |
| 228 | - } else { | |
| 229 | - $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 230 | - flg = true; | |
| 231 | - //支付失败 | |
| 232 | - $.alert('亲!支付失败了!'); | |
| 233 | - //$.alert('亲!支付失败了 '+JSON.stringify(res)); | |
| 234 | - //windows.location.href='${host}/pay/payFail'; | |
| 194 | + $.ajax({ | |
| 195 | + url: mUrl.getJSPayParam, | |
| 196 | + type: 'post', | |
| 197 | + dataType: 'json', | |
| 198 | + data: req, | |
| 199 | + success: function (res) { | |
| 200 | + if (res.code == '8888') { | |
| 201 | + var payParam = res.data; | |
| 202 | + console.log(payParam); | |
| 203 | + //调用微信支付 | |
| 204 | + callpay(payParam); | |
| 205 | + } else { | |
| 206 | + $.toptip(res.msg, 2000, "error"); | |
| 207 | + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 208 | + flg = true; | |
| 209 | + console.log('详细错误信息为:' + res.data); | |
| 210 | + } | |
| 211 | + } | |
| 212 | + }); | |
| 213 | + }//IF | |
| 214 | + }); | |
| 215 | + | |
| 216 | + //调用微信JS api 支付 | |
| 217 | + function jsApiCall(payParam) { | |
| 218 | + WeixinJSBridge.invoke( | |
| 219 | + 'getBrandWCPayRequest', | |
| 220 | + JSON.parse(payParam), | |
| 221 | + function (res) { | |
| 222 | + | |
| 223 | + if (res.err_msg == "get_brand_wcpay_request:ok") { | |
| 224 | + //$.alert("亲!支付成功!"); | |
| 225 | + //支付成功 | |
| 226 | + //调用后台,通知抬杆放行 | |
| 227 | + passHandrail(); | |
| 228 | + window.location.href = mUrl.paySuccessView + '&payMoney=' + totleMoney; | |
| 229 | + | |
| 230 | + } else { | |
| 231 | + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary'); | |
| 232 | + flg = true; | |
| 233 | + //支付失败 | |
| 234 | + $.alert('亲!支付失败了!'); | |
| 235 | + //$.alert('亲!支付失败了 '+JSON.stringify(res)); | |
| 236 | + //windows.location.href='${host}/pay/payFail'; | |
| 237 | + | |
| 238 | + } | |
| 239 | + | |
| 240 | + | |
| 241 | + } | |
| 242 | + ); | |
| 243 | + } | |
| 235 | 244 | |
| 245 | + //支付成功后,调用此函数通知抬杆 | |
| 246 | + function passHandrail() { | |
| 247 | + var orderId = $('#parkOrderId').val(); | |
| 248 | + var req = { | |
| 249 | + orderId: orderId | |
| 236 | 250 | } |
| 237 | 251 | |
| 252 | + $.ajax({ | |
| 253 | + url: mUrl.passHandrail, | |
| 254 | + type: 'post', | |
| 255 | + dataType: 'json', | |
| 256 | + data: req, | |
| 257 | + success: function (res) { | |
| 258 | + console.log(res); | |
| 259 | + } | |
| 260 | + }) | |
| 261 | + | |
| 262 | + } | |
| 263 | + | |
| 238 | 264 | |
| 239 | - } | |
| 240 | - ); | |
| 241 | - } | |
| 242 | - | |
| 243 | - function callpay(payParam) { | |
| 244 | - if (typeof WeixinJSBridge == "undefined") { | |
| 245 | - if (document.addEventListener) { | |
| 246 | - document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | |
| 247 | - } else if (document.attachEvent) { | |
| 248 | - document.attachEvent('WeixinJSBridgeReady', jsApiCall); | |
| 249 | - document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | |
| 250 | - } | |
| 251 | - } else { | |
| 252 | - jsApiCall(payParam); | |
| 265 | + function callpay(payParam) { | |
| 266 | + if (typeof WeixinJSBridge == "undefined") { | |
| 267 | + if (document.addEventListener) { | |
| 268 | + document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | |
| 269 | + } else if (document.attachEvent) { | |
| 270 | + document.attachEvent('WeixinJSBridgeReady', jsApiCall); | |
| 271 | + document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | |
| 272 | + } | |
| 273 | + } else { | |
| 274 | + jsApiCall(payParam); | |
| 275 | + } | |
| 253 | 276 | } |
| 254 | - } | |
| 255 | 277 | |
| 256 | 278 | </script> |
| 257 | 279 | </body> | ... | ... |
src/main/webapp/static/js/url.js
| 1 | 1 | var mUrl = mUrl || {}; |
| 2 | 2 | //var webPath = 'http://p6esgw.natappfree.cc'; |
| 3 | -var webPath = 'localhost:8080'; | |
| 4 | -//var webPath = 'http://wxgzh.rnting.com/rnt-wx'; | |
| 3 | +//var webPath = 'http://atao.s1.natapp.cc'; | |
| 4 | +var webPath = 'http://localhost:8080'; | |
| 5 | 5 | mUrl.getCommonParam = function () { |
| 6 | 6 | //获取公共参数 |
| 7 | 7 | var openId = mUrl.getOpenId(); |
| ... | ... | @@ -114,5 +114,8 @@ mUrl.paySuccessView = webPath + '/pay/paySuccessView'+mUrl.getCommonParam(); |
| 114 | 114 | //检查输入的车牌号是否存在待核算的订单 |
| 115 | 115 | mUrl.parkOrderForNotPayExist = webPath + '/pay/parkOrderForNotPayExist'+mUrl.getCommonParam(); |
| 116 | 116 | |
| 117 | +//支付成功后,抬杆通知 | |
| 118 | +mUrl.passHandrail= webPath+'/park/passHandrail'+mUrl.getCommonParam(); | |
| 119 | + | |
| 117 | 120 | |
| 118 | 121 | ... | ... |