Commit 6fc5291da18b686f5381d5abec3ffa156fa29b5f

Authored by atao
1 parent a7d9b350

提交代码

LICENSE deleted
1   -Apache License
2   -Version 2.0, January 2004
3   -http://www.apache.org/licenses/
4   -
5   -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6   -
7   -1. Definitions.
8   -
9   -"License" shall mean the terms and conditions for use, reproduction, and
10   -distribution as defined by Sections 1 through 9 of this document.
11   -
12   -"Licensor" shall mean the copyright owner or entity authorized by the copyright
13   -owner that is granting the License.
14   -
15   -"Legal Entity" shall mean the union of the acting entity and all other entities
16   -that control, are controlled by, or are under common control with that entity.
17   -For the purposes of this definition, "control" means (i) the power, direct or
18   -indirect, to cause the direction or management of such entity, whether by
19   -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20   -outstanding shares, or (iii) beneficial ownership of such entity.
21   -
22   -"You" (or "Your") shall mean an individual or Legal Entity exercising
23   -permissions granted by this License.
24   -
25   -"Source" form shall mean the preferred form for making modifications, including
26   -but not limited to software source code, documentation source, and configuration
27   -files.
28   -
29   -"Object" form shall mean any form resulting from mechanical transformation or
30   -translation of a Source form, including but not limited to compiled object code,
31   -generated documentation, and conversions to other media types.
32   -
33   -"Work" shall mean the work of authorship, whether in Source or Object form, made
34   -available under the License, as indicated by a copyright notice that is included
35   -in or attached to the work (an example is provided in the Appendix below).
36   -
37   -"Derivative Works" shall mean any work, whether in Source or Object form, that
38   -is based on (or derived from) the Work and for which the editorial revisions,
39   -annotations, elaborations, or other modifications represent, as a whole, an
40   -original work of authorship. For the purposes of this License, Derivative Works
41   -shall not include works that remain separable from, or merely link (or bind by
42   -name) to the interfaces of, the Work and Derivative Works thereof.
43   -
44   -"Contribution" shall mean any work of authorship, including the original version
45   -of the Work and any modifications or additions to that Work or Derivative Works
46   -thereof, that is intentionally submitted to Licensor for inclusion in the Work
47   -by the copyright owner or by an individual or Legal Entity authorized to submit
48   -on behalf of the copyright owner. For the purposes of this definition,
49   -"submitted" means any form of electronic, verbal, or written communication sent
50   -to the Licensor or its representatives, including but not limited to
51   -communication on electronic mailing lists, source code control systems, and
52   -issue tracking systems that are managed by, or on behalf of, the Licensor for
53   -the purpose of discussing and improving the Work, but excluding communication
54   -that is conspicuously marked or otherwise designated in writing by the copyright
55   -owner as "Not a Contribution."
56   -
57   -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58   -of whom a Contribution has been received by Licensor and subsequently
59   -incorporated within the Work.
60   -
61   -2. Grant of Copyright License.
62   -
63   -Subject to the terms and conditions of this License, each Contributor hereby
64   -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65   -irrevocable copyright license to reproduce, prepare Derivative Works of,
66   -publicly display, publicly perform, sublicense, and distribute the Work and such
67   -Derivative Works in Source or Object form.
68   -
69   -3. Grant of Patent License.
70   -
71   -Subject to the terms and conditions of this License, each Contributor hereby
72   -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73   -irrevocable (except as stated in this section) patent license to make, have
74   -made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75   -such license applies only to those patent claims licensable by such Contributor
76   -that are necessarily infringed by their Contribution(s) alone or by combination
77   -of their Contribution(s) with the Work to which such Contribution(s) was
78   -submitted. If You institute patent litigation against any entity (including a
79   -cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80   -Contribution incorporated within the Work constitutes direct or contributory
81   -patent infringement, then any patent licenses granted to You under this License
82   -for that Work shall terminate as of the date such litigation is filed.
83   -
84   -4. Redistribution.
85   -
86   -You may reproduce and distribute copies of the Work or Derivative Works thereof
87   -in any medium, with or without modifications, and in Source or Object form,
88   -provided that You meet the following conditions:
89   -
90   -You must give any other recipients of the Work or Derivative Works a copy of
91   -this License; and
92   -You must cause any modified files to carry prominent notices stating that You
93   -changed the files; and
94   -You must retain, in the Source form of any Derivative Works that You distribute,
95   -all copyright, patent, trademark, and attribution notices from the Source form
96   -of the Work, excluding those notices that do not pertain to any part of the
97   -Derivative Works; and
98   -If the Work includes a "NOTICE" text file as part of its distribution, then any
99   -Derivative Works that You distribute must include a readable copy of the
100   -attribution notices contained within such NOTICE file, excluding those notices
101   -that do not pertain to any part of the Derivative Works, in at least one of the
102   -following places: within a NOTICE text file distributed as part of the
103   -Derivative Works; within the Source form or documentation, if provided along
104   -with the Derivative Works; or, within a display generated by the Derivative
105   -Works, if and wherever such third-party notices normally appear. The contents of
106   -the NOTICE file are for informational purposes only and do not modify the
107   -License. You may add Your own attribution notices within Derivative Works that
108   -You distribute, alongside or as an addendum to the NOTICE text from the Work,
109   -provided that such additional attribution notices cannot be construed as
110   -modifying the License.
111   -You may add Your own copyright statement to Your modifications and may provide
112   -additional or different license terms and conditions for use, reproduction, or
113   -distribution of Your modifications, or for any such Derivative Works as a whole,
114   -provided Your use, reproduction, and distribution of the Work otherwise complies
115   -with the conditions stated in this License.
116   -
117   -5. Submission of Contributions.
118   -
119   -Unless You explicitly state otherwise, any Contribution intentionally submitted
120   -for inclusion in the Work by You to the Licensor shall be under the terms and
121   -conditions of this License, without any additional terms or conditions.
122   -Notwithstanding the above, nothing herein shall supersede or modify the terms of
123   -any separate license agreement you may have executed with Licensor regarding
124   -such Contributions.
125   -
126   -6. Trademarks.
127   -
128   -This License does not grant permission to use the trade names, trademarks,
129   -service marks, or product names of the Licensor, except as required for
130   -reasonable and customary use in describing the origin of the Work and
131   -reproducing the content of the NOTICE file.
132   -
133   -7. Disclaimer of Warranty.
134   -
135   -Unless required by applicable law or agreed to in writing, Licensor provides the
136   -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137   -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138   -including, without limitation, any warranties or conditions of TITLE,
139   -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140   -solely responsible for determining the appropriateness of using or
141   -redistributing the Work and assume any risks associated with Your exercise of
142   -permissions under this License.
143   -
144   -8. Limitation of Liability.
145   -
146   -In no event and under no legal theory, whether in tort (including negligence),
147   -contract, or otherwise, unless required by applicable law (such as deliberate
148   -and grossly negligent acts) or agreed to in writing, shall any Contributor be
149   -liable to You for damages, including any direct, indirect, special, incidental,
150   -or consequential damages of any character arising as a result of this License or
151   -out of the use or inability to use the Work (including but not limited to
152   -damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153   -any and all other commercial damages or losses), even if such Contributor has
154   -been advised of the possibility of such damages.
155   -
156   -9. Accepting Warranty or Additional Liability.
157   -
158   -While redistributing the Work or Derivative Works thereof, You may choose to
159   -offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160   -other liability obligations and/or rights consistent with this License. However,
161   -in accepting such obligations, You may act only on Your own behalf and on Your
162   -sole responsibility, not on behalf of any other Contributor, and only if You
163   -agree to indemnify, defend, and hold each Contributor harmless for any liability
164   -incurred by, or claims asserted against, such Contributor by reason of your
165   -accepting any such warranty or additional liability.
166   -
167   -END OF TERMS AND CONDITIONS
168   -
169   -APPENDIX: How to apply the Apache License to your work
170   -
171   -To apply the Apache License to your work, attach the following boilerplate
172   -notice, with the fields enclosed by brackets "{}" replaced with your own
173   -identifying information. (Don't include the brackets!) The text should be
174   -enclosed in the appropriate comment syntax for the file format. We also
175   -recommend that a file or class name and description of purpose be included on
176   -the same "printed page" as the copyright notice for easier identification within
177   -third-party archives.
178   -
179   - Copyright 2014 JFinal
180   -
181   - Licensed under the Apache License, Version 2.0 (the "License");
182   - you may not use this file except in compliance with the License.
183   - You may obtain a copy of the License at
184   -
185   - http://www.apache.org/licenses/LICENSE-2.0
186   -
187   - Unless required by applicable law or agreed to in writing, software
188   - distributed under the License is distributed on an "AS IS" BASIS,
189   - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190   - See the License for the specific language governing permissions and
191   - limitations under the License.
192 0 \ No newline at end of file
jfinal-weixin.iml deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3   - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
4   - <output url="file://$MODULE_DIR$/target/classes" />
5   - <output-test url="file://$MODULE_DIR$/target/test-classes" />
6   - <content url="file://$MODULE_DIR$">
7   - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8   - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9   - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10   - <excludeFolder url="file://$MODULE_DIR$/target" />
11   - </content>
12   - <orderEntry type="inheritedJdk" />
13   - <orderEntry type="sourceFolder" forTests="false" />
14   - <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.8.2" level="project" />
15   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.jfinal:jetty-server:8.1.8" level="project" />
16   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-xml:8.1.8.v20121106" level="project" />
17   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-util:8.1.8.v20121106" level="project" />
18   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-servlet:8.1.8.v20121106" level="project" />
19   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-security:8.1.8.v20121106" level="project" />
20   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-server:8.1.8.v20121106" level="project" />
21   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016" level="project" />
22   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-continuation:8.1.8.v20121106" level="project" />
23   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-http:8.1.8.v20121106" level="project" />
24   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.eclipse.jetty:jetty-io:8.1.8.v20121106" level="project" />
25   - <orderEntry type="library" name="Maven: com.jfinal:jfinal:3.1" level="project" />
26   - <orderEntry type="library" name="Maven: cglib:cglib-nodep:3.1" level="project" />
27   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.3" level="project" />
28   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
29   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.4.3" level="project" />
30   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.alibaba:fastjson:1.2.31" level="project" />
31   - <orderEntry type="library" scope="PROVIDED" name="Maven: redis.clients:jedis:2.7.2" level="project" />
32   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-pool2:2.3" level="project" />
33   - <orderEntry type="library" scope="PROVIDED" name="Maven: de.ruedigermoeller:fst:2.29" level="project" />
34   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.javassist:javassist:3.19.0-GA" level="project" />
35   - <orderEntry type="library" scope="PROVIDED" name="Maven: org.objenesis:objenesis:2.1" level="project" />
36   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp:okhttp:2.7.5" level="project" />
37   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.6.0" level="project" />
38   - <orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.11.0" level="project" />
39   - </component>
40   -</module>
41 0 \ No newline at end of file
src/main/java/com/rnt/controller/WeixinPayController.java
... ... @@ -138,7 +138,7 @@ public class WeixinPayController extends Controller {
138 138  
139 139 CardBuyVO vo = new CardBuyVO();
140 140 /** 停车场卡券id. */
141   - vo.setPersonCardId(cardCouponsId+"");
  141 + vo.setPersonCardId(cardCouponsId + "");
142 142 //购买数量
143 143 vo.setBuyNum(num + "");
144 144 //车牌号.
... ... @@ -392,13 +392,13 @@ public class WeixinPayController extends Controller {
392 392 logger.info("--计算结束时间=" + cardBuyVO.getEndDate());
393 393 }
394 394 /**创建个人卡信息.*/
395   - String personCardId = personCardCouponsService.savePersonCard(cardBuyVO, parkCardCoupons);
396   - cardBuyVO.setPersonCardId(personCardId);
  395 + String personCardId = personCardCouponsService.savePersonCard(cardBuyVO, parkCardCoupons);
  396 + cardBuyVO.setPersonCardId(personCardId);
397 397 //2.创建订单
398 398 /**插入停车订单.*/
399 399 String orderId = cardOrderService.saveOrder(cardBuyVO, parkCardCoupons);
400 400 if (StringKit.isNotBlank(orderId)) {
401   - result.setData(orderId);
  401 + result.setData(orderId);
402 402 } else {
403 403 result.setErrorMessage(ErrorType.SYSTEM_ERROR, "业务错误");
404 404 }
... ... @@ -468,7 +468,7 @@ public class WeixinPayController extends Controller {
468 468 String orderId = getPara("orderId");
469 469 String openId = getPara("openId");
470 470 String payOrderId = getPara("payOrderId");
471   - logger.info("开始获取公众号支付JS支付参数: orderId=" + orderId + "; openId=" + openId+"; payOrderId="+payOrderId);
  471 + logger.info("开始获取公众号支付JS支付参数: orderId=" + orderId + "; openId=" + openId + "; payOrderId=" + payOrderId);
472 472 //订单ID
473 473 if (StringKit.isEmpty(orderId)) {
474 474 bizResult.setCode(ErrorType.PARAMM_NULL.getCode());
... ... @@ -477,23 +477,23 @@ public class WeixinPayController extends Controller {
477 477 return;
478 478 }
479 479  
480   - if(StringKit.isEmpty(payOrderId)){
  480 + if (StringKit.isEmpty(payOrderId)) {
481 481 bizResult.setCode(ErrorType.PARAMM_NULL.getCode());
482 482 bizResult.setMsg("支付单ID不能为空");
483 483 renderJson(bizResult);
484 484 return;
485 485 }
486 486  
487   - PayOrder payOrder = PayOrder.dao.findFirst("select * from td_b_pay_order t where t.pay_order_id = ?",payOrderId);
  487 + PayOrder payOrder = PayOrder.dao.findFirst("select * from td_b_pay_order t where t.pay_order_id = ?",
  488 + payOrderId);
488 489  
489   - if(null == payOrder){
  490 + if (null == payOrder) {
490 491 bizResult.setCode(ErrorType.PARAMM_NULL.getCode());
491 492 bizResult.setMsg("支付单不存在");
492 493 renderJson(bizResult);
493 494 return;
494 495 }
495 496  
496   -
497 497 // 判断支付单状态 支付单状态:0-待支付 1-成功 2-失败(作废)
498 498 if (null == payOrder.getPayOrderState() || 0 != payOrder.getPayOrderState()) {
499 499 logger.info("支付单状态不正确,支付单状态为: orderState=" + payOrder.getPayOrderState());
... ... @@ -503,7 +503,6 @@ public class WeixinPayController extends Controller {
503 503 return;
504 504 }
505 505  
506   -
507 506 Order order = Order.dao.findFirst("select * from td_b_order t where t.order_id = ?", orderId);
508 507 if (null == order) {
509 508 bizResult.setCode(ErrorType.PARAMM_NULL.getCode());
... ... @@ -528,7 +527,7 @@ public class WeixinPayController extends Controller {
528 527 params.put("body", "任你停公众号订单支付");
529 528 params.put("out_trade_no", payOrderId);
530 529 //支付金额
531   - params.put("total_fee", payFee.longValue()+"");
  530 + params.put("total_fee", payFee.longValue() + "");
532 531  
533 532 String ip = IpKit.getRealIp(getRequest());
534 533 if (StrKit.isBlank(ip)) {
... ... @@ -577,9 +576,9 @@ public class WeixinPayController extends Controller {
577 576 packageParams.put("nonceStr", System.currentTimeMillis() + "");
578 577 packageParams.put("package", "prepay_id=" + prepay_id);
579 578 packageParams.put("signType", "MD5");
580   - logger.info("生成签名钱的字符串为: params="+packageParams.toString());
  579 + logger.info("生成签名钱的字符串为: params=" + packageParams.toString());
581 580 String packageSign = PaymentKit.createSign(packageParams, paternerKey);
582   - logger.info("获取到的密钥为: paternerKey="+paternerKey);
  581 + logger.info("获取到的密钥为: paternerKey=" + paternerKey);
583 582 packageParams.put("paySign", packageSign);
584 583 //生成js 支付调用串
585 584 String paySign = JsonUtils.toJson(packageParams);
... ... @@ -589,7 +588,6 @@ public class WeixinPayController extends Controller {
589 588 renderJson(bizResult);
590 589 }
591 590  
592   -
593 591 /**
594 592 * 公众号支付js-sdk
595 593 */
... ... @@ -1077,99 +1075,100 @@ public class WeixinPayController extends Controller {
1077 1075 /**
1078 1076 * 支付页面-入口.<br/>
1079 1077 */
1080   - public void selectCarView(){
1081   - setAttr("openId",TLWXUser.getOpenId());
1082   - setAttr("custId",TLWXUser.getCustId());
1083   - this.render("select.html");
  1078 + public void selectCarView() {
  1079 + setAttr("openId", TLWXUser.getOpenId());
  1080 + setAttr("custId", TLWXUser.getCustId());
  1081 + this.render("select.html");
1084 1082 }
1085 1083  
1086 1084 /**
1087 1085 * 查看支付单错误.<br/>
1088 1086 */
1089 1087 @Clear(BindInterceptor.class)
1090   - public void queryOrderCheckErrorView(){
1091   - String carNum = this.getPara("carNum");
1092   - this.setAttr("carNum", carNum);
1093   - this.render("checkerror.html");
  1088 + public void queryOrderCheckErrorView() {
  1089 + String carNum = this.getPara("carNum");
  1090 + this.setAttr("carNum", carNum);
  1091 + this.render("checkerror.html");
1094 1092 }
1095 1093  
1096 1094 /**
1097 1095 * 查询历史支付车牌号.<br/>
1098 1096 * 步骤:根据个人cust_id 查询历史订单中最近的3个车牌号.<br/>
1099 1097 */
1100   - public void queryHistoryCarNum(){
  1098 + public void queryHistoryCarNum() {
1101 1099 BizResult<List<String>> result = new BizResult<List<String>>();
1102 1100 OrderService orderService = Duang.duang(OrderService.class);
1103   - List<String> list = new ArrayList<String>();
  1101 + List<String> list = new ArrayList<String>();
1104 1102 String custId = this.getPara("personCustId");
1105   - try{
1106   - if(StringKit.isNotBlank(custId)){
  1103 + try {
  1104 + if (StringKit.isNotBlank(custId)) {
1107 1105 list = orderService.queryHistoryCarNum(custId);
1108   - }else{
  1106 + } else {
1109 1107 result.setErrorMessage(ErrorType.SYSTEM_ERROR, "业务错误");
1110 1108 }
1111   - }catch (Exception e) {
  1109 + } catch (Exception e) {
1112 1110 e.printStackTrace();
1113 1111 }
1114 1112  
1115 1113 result.setData(list);
1116 1114  
1117   -
1118 1115 this.renderJson(result);
1119 1116 }
1120 1117  
1121 1118 /**
1122 1119 * 根据车牌号查询待支付的停车订单.<br/>
1123 1120 */
1124   - public void queryOrderInfoView(){
  1121 + public void queryOrderInfoView() {
1125 1122 String carNum = this.getPara("carNum");
1126 1123 this.getRequest().setAttribute("carNum", carNum);
1127 1124 this.render("check.html");
1128 1125 }
  1126 +
1129 1127 /**
1130 1128 * 检查输入的车牌号是否存订单(带核算/待支付/已完成).<br/>
1131 1129 */
1132   - public void parkOrderForNotPayExist(){
  1130 + public void parkOrderForNotPayExist() {
1133 1131 BizResult<Order> result = new BizResult<>();
1134 1132 String carNum = this.getPara("carNum");
1135   - logger.info("开始校验输入车牌是否存在待核算订单..入参="+carNum);
1136   - String rs ="";
  1133 + logger.info("开始校验输入车牌是否存在待核算订单..入参=" + carNum);
  1134 + String rs = "";
1137 1135 OrderVO OrderVO = new OrderVO();
1138   - try{
1139   - if(StringKit.isNotBlank(carNum)){
  1136 + try {
  1137 + if (StringKit.isNotBlank(carNum)) {
1140 1138 OrderService orderService = Duang.duang(OrderService.class);
1141 1139 IRainQueryService iRainQueryService = Duang.duang(IRainQueryService.class);
1142 1140 /**查询待核算支付单信息.*/
1143 1141 Order order = orderService.findOrderByCarNum(carNum);
1144   - if(order != null && StringKit.isNotBlank(order.getOrderId())){
  1142 + if (order != null && StringKit.isNotBlank(order.getOrderId())) {
1145 1143 result.setData(order);
1146 1144 /**调用艾润查询费用接口.*/
1147 1145 rs = iRainQueryService.billQuery(carNum, order.getParkId());
1148   - }else{
  1146 + } else {
1149 1147 result.setErrorMessage(ErrorType.NO_PARKING_MSG, "无停车记录");
1150 1148 }
1151   - }else{
  1149 + } else {
1152 1150 logger.info("入参为空!");
1153 1151 result.setErrorMessage(ErrorType.SYSTEM_ERROR, "业务错误");
1154 1152 }
1155   - if(StringKit.isNotBlank(rs)){
1156   - if("NO_PARK_RECORD".equals(JSONObject.parseObject(rs).get("code"))){
  1153 + if (StringKit.isNotBlank(rs)) {
  1154 + if ("NO_PARK_RECORD".equals(JSONObject.parseObject(rs).get("code"))) {
1157 1155 result.setErrorMessage(ErrorType.NO_PARKING_MSG, "无停车记录");
1158 1156 this.renderJson(result);
1159   - return ;
  1157 + return;
1160 1158 }
1161   - }else{
  1159 + } else {
1162 1160 result.setErrorMessage(ErrorType.NO_PARKING_MSG, "无停车记录");
1163 1161 this.renderJson(result);
1164   - return ;
  1162 + return;
1165 1163 }
1166   - }catch(Exception e){
  1164 + } catch (Exception e) {
1167 1165 e.printStackTrace();
1168 1166 }
1169   - logger.info("结束校验输入车牌是否存在待核算订单..响应="+JSONObject.toJSONString(result));
  1167 + logger.info("结束校验输入车牌是否存在待核算订单..响应=" + JSONObject.toJSONString(result));
1170 1168 this.renderJson(result);
1171 1169  
1172 1170 }
  1171 +
1173 1172 /**
1174 1173 * 查询待支付的停车订单.<br/>
1175 1174 * 步骤二:
... ... @@ -1179,30 +1178,52 @@ public class WeixinPayController extends Controller {
1179 1178 * 4.更新订单明细费用.<br/>
1180 1179 * 5.插入订单流水表.
1181 1180 */
1182   - public void queryParkOrderForNotPay(){
  1181 + public void queryParkOrderForNotPay() {
1183 1182 logger.info("开始查询待支付的停车订单WeixinPayController.queryParkOrderForNotPay()方法.");
1184 1183 BizResult<OrderVO> result = new BizResult<OrderVO>();
1185 1184 String carNum = this.getPara("carNum");
1186 1185 OrderService orderService = Duang.duang(OrderService.class);
1187 1186 OrderVO orderVO = new OrderVO();
1188   - try{
  1187 + try {
1189 1188 orderVO = orderService.queryParkOrderForNotPay(carNum);
1190   - if(orderVO != null && StringKit.isNotBlank(orderVO.getOrderId())){
  1189 + if (orderVO != null && StringKit.isNotBlank(orderVO.getOrderId())) {
  1190 + //创建支付单
  1191 + PayOrder payOrder = new PayOrder();
  1192 + String payOrderId = SequenceUtil.getNextOrderId(SequenceTypeEnum.ORDER_PAY_WXGZH.value());
  1193 + payOrder.setPayOrderId(payOrderId);
  1194 + payOrder.setPaySrcType(Integer.valueOf(PayOrderEnum.PAY_RESOURCE_TYPE_PARK.getValue()));
  1195 + payOrder.setRltOrderId(orderVO.getOrderId());
  1196 + payOrder.setPayOrderTitle(PayOrderEnum.PAY_ORDER_TYPE_PAY.getValue());
  1197 + payOrder.setPayType(Integer.valueOf(PayOrderEnum.PAY_TYPE_WXGZH.getValue()));
  1198 + payOrder.setPayOrderState(Integer.valueOf(PayOrderEnum.PAY_ORDER_STATE_WAIT_PAY.getValue()));
  1199 + payOrder.setPayorderStateTime(new Date());
  1200 + payOrder.setDataState(DataStatusEnum.DATA_STATUS_VALID.value());
  1201 + payOrder.setCreateDate(new Date());
  1202 + payOrder.setModfiyDate(new Date());
  1203 + logger.info("支付单save请求数据为: payOrder=" + JSONObject.toJSONString(payOrder));
  1204 + Boolean flag = payOrder.save();
  1205 + logger.info("支付单save 响应为:flag=" + flag);
  1206 + orderVO.setPayOrderId(payOrderId);
  1207 + if (!flag) {
  1208 + result.setCode(ErrorType.BIZ_ERROR.getCode());
  1209 + result.setMsg("支付单保存失败!");
  1210 + renderJson(result);
  1211 + return;
  1212 + }
1191 1213 /**根据停车场编码查询通知艾润停车场编码.*/
1192 1214 result.setData(orderVO);
1193   - }else{
  1215 + } else {
1194 1216 result.setErrorMessage(ErrorType.SYSTEM_ERROR, "业务错误");
1195 1217 }
1196   - }catch (Exception e) {
  1218 + } catch (Exception e) {
1197 1219 e.printStackTrace();
1198 1220 }
1199 1221 this.renderJson(result);
1200 1222 }
1201 1223  
1202   -
1203   - public void paySuccessView(){
  1224 + public void paySuccessView() {
1204 1225 String money = getPara("payMoney");
1205   - setAttr("payMoney",money);
  1226 + setAttr("payMoney", money);
1206 1227 render("paysuccess.html");
1207 1228 }
1208 1229  
... ... @@ -1215,7 +1236,4 @@ public class WeixinPayController extends Controller {
1215 1236 System.out.println("offset month date :" + DateUtil.format(newDate, "yyyy-MM-dd"));
1216 1237 }
1217 1238  
1218   -
1219   -
1220   -
1221 1239 }
... ...
src/main/java/com/rnt/vo/OrderVO.java
... ... @@ -40,8 +40,17 @@ public class OrderVO {
40 40  
41 41 /** 停车时长 单位:小时格式:02小时52分. */
42 42 private String parkingDuration;
43   -
44   -
  43 +
  44 + /** 支付单ID 临时变量*/
  45 + private String payOrderId;
  46 +
  47 + public String getPayOrderId() {
  48 + return payOrderId;
  49 + }
  50 +
  51 + public void setPayOrderId(String payOrderId) {
  52 + this.payOrderId = payOrderId;
  53 + }
45 54  
46 55 public String getParkAddress() {
47 56 return parkAddress;
... ...
src/main/webapp/WEB-INF/pages/check.html
... ... @@ -3,11 +3,11 @@
3 3 <head>
4 4 <meta charset="UTF-8">
5 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" />
  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 11 <meta name="apple-mobile-web-app-title" content="">
12 12 <meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 -->
13 13 <link rel="apple-touch-icon-precomposed" href="favicon.ico">
... ... @@ -18,29 +18,33 @@
18 18 <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
19 19 <link rel="stylesheet" href="${staticHost}/css/reset.css">
20 20 <style>
21   - .all_told,.platen_number{
  21 + .all_told, .platen_number {
22 22 text-align: center;
23 23 }
24   - .all_told{
  24 +
  25 + .all_told {
25 26 padding: 30px 0 10px 0;
26 27 }
27   - .all_told span{
  28 +
  29 + .all_told span {
28 30 margin-right: 5px;
29 31 font-size: 22px;
30 32 }
31   - .discount_money{
32   - color:#fc3817;
  33 +
  34 + .discount_money {
  35 + color: #fc3817;
33 36 }
34   - .discount{
35   - padding: 4px 7px ;
  37 +
  38 + .discount {
  39 + padding: 4px 7px;
36 40 background: #fc3817;
37 41 border-radius: 2px;
38 42 position: relative;
39 43 margin-left: 10px;
40   - color:#fff;
  44 + color: #fff;
41 45 }
42 46  
43   - .discount:before{
  47 + .discount:before {
44 48 position: absolute;
45 49 content: '';
46 50 width: 0;
... ... @@ -59,13 +63,14 @@
59 63  
60 64  
61 65 <header class="demos-header">
62   - <p class="all_told discount_money" ><span id="orderNotPayFee">90.00</span>元</p>
  66 + <p class="all_told discount_money"><span id="orderNotPayFee">90.00</span>元</p>
63 67 <p class="platen_number discount_money" style="font-weight:bold;" id="orderTitle">待付费用</p>
64 68 </header>
65 69  
66 70 <div class="weui-cells weui-cells_form">
67 71 <input type="hidden" id="carNumPre" value="${carNum!''}"/>
68   - <input type="hidden" id="parkOrderId" />
  72 + <input type="hidden" id="parkOrderId"/>
  73 + <input type="hidden" id="payOrderId">
69 74 <div class="weui-cell">
70 75 <div class="weui-cell__hd"><label for="" class="weui-label">当前车牌</label></div>
71 76 <div class="weui-cell__bd" id="carNumber">
... ... @@ -114,9 +119,8 @@
114 119 </div>
115 120  
116 121  
117   -
118 122 <div class="pay-content-padded">
119   - <a class="weui-btn weui-btn_primary " href="javascript:" id="showTooltips" >确定支付</a>
  123 + <a class="weui-btn weui-btn_primary " href="javascript:" id="showTooltips">确定支付</a>
120 124 </div>
121 125  
122 126  
... ... @@ -125,118 +129,120 @@
125 129 <script src="${staticHost}/js/jsutil.js"></script>
126 130 <script src="${staticHost}/js/url.js"></script>
127 131 <script type="text/javascript">
128   - var func = {
129   - /**查询待支付订单*/
130   - initData:function(){
131   - $('#orderNotPayFee').empty();
132   - $('#orderTitle').empty();
133   - $('#carNumber').empty();
134   - $('#parkName').empty();
135   - $('#parkInTime').empty();
136   - $('#parkingDuration').empty();
137   - $('#orderTotalFee').empty();
138   - $('#orderPayedFee').empty();
139   - var carNumPre =$('#carNumPre').val();
140   - jsutil.defaultReq(
141   - mUrl.queryParkOrderForNotPay ,
142   - {"carNum":carNumPre},
143   - function(data){
144   - if(data != null && "1005" == data.code){
145   - window.location.href= mUrl.queryOrderCheckErrorView+"&carNum="+carNumPre;
146   - }else if(data != null && "8888" !=data.code){
147   - $.alert("查询待支付订单失败,请重试!");
148   - }else{
149   - var orderVO = data.data;
150   - $('#parkOrderId').val(orderVO.orderId);
151   - $('#orderNotPayFee').text(orderVO.orderNotPayFee);
152   - $('#orderTitle').text(orderVO.orderTitle);
153   - $('#carNumber').text(orderVO.carNumber);
154   - $('#parkName').text(orderVO.parkName);
155   - $('#parkInTime').text(orderVO.parkInTime);
156   - $('#parkingDuration').text(orderVO.parkingDuration);
157   - $('#orderTotalFee').text(orderVO.orderTotalFee);
158   - $('#orderPayedFee').text(orderVO.orderPayedFee);
159   -
160   - }
161   -
162   -
163   -
164   - });
165   - },
166   - };
167   - $(function(){
168   - func.initData();
169   - });
170   - var flg =true;
171   - $("#showTooltips").click(function () {
172   - if(flg){
173   - flg =false;
174   - $('#showTooltips').attr('class','weui-btn weui-btn_primary weui-btn_disabled');
175   - var parkOrderId = $('#parkOrderId').val();
176   - if (parkOrderId.length < 1) {
177   - $.toptip("订单Id为空", 2000, "error");
178   - $('#showTooltips').attr('class','weui-btn weui-btn_primary');
179   - flg=true;
180   - return false;
181   - }
182   - var req = {
183   - orderId: parkOrderId
184   - }
185   -
186   - $.ajax({
187   - url: mUrl.getJSPayParam,
188   - type: 'post',
189   - dataType: 'json',
190   - data: req,
191   - success: function (res) {
192   - if (res.code == '8888') {
193   - var payParam = res.data;
194   - //调用微信支付
195   - callpay(payParam);
196   - }else{
197   - $.toptip(res.msg,2000,"error");
198   - console.log('详细错误信息为:'+res.data);
199   - }
200   - }
201   - });
202   - }//if
203   - });
204   -
205   - //调用微信JS api 支付
206   - function jsApiCall(payParam) {
207   - WeixinJSBridge.invoke(
208   - 'getBrandWCPayRequest',
209   - payParam,
210   - function (res) {
211   - if(res.err_msg == "get_brand_wcpay_request:ok" ) {
212   - $.alert("亲!支付成功!");
213   - //支付成功
214   - windows.location.href=mUrl.paySuccessView+'&payMoney='+totleMoney;
215   -
216   - }else{
217   - //支付失败
218   - $.alert("亲!支付失败!err_msg="+res.err_msg);
219   - //windows.location.href='${host}/pay/payFail';
220   -
221   - }
222   -
223   -
224   - }
225   - );
226   - }
227   -
228   - function callpay(payParam) {
229   - if (typeof WeixinJSBridge == "undefined") {
230   - if (document.addEventListener) {
231   - document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
232   - } else if (document.attachEvent) {
233   - document.attachEvent('WeixinJSBridgeReady', jsApiCall);
234   - document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
235   - }
236   - } else {
237   - jsApiCall(payParam);
238   - }
239   - }
  132 + var func = {
  133 + /**查询待支付订单*/
  134 + initData: function () {
  135 + $('#orderNotPayFee').empty();
  136 + $('#orderTitle').empty();
  137 + $('#carNumber').empty();
  138 + $('#parkName').empty();
  139 + $('#parkInTime').empty();
  140 + $('#parkingDuration').empty();
  141 + $('#orderTotalFee').empty();
  142 + $('#orderPayedFee').empty();
  143 + var carNumPre = $('#carNumPre').val();
  144 + jsutil.defaultReq(
  145 + mUrl.queryParkOrderForNotPay,
  146 + {"carNum": carNumPre},
  147 + function (data) {
  148 + if (data != null && "1005" == data.code) {
  149 + window.location.href = mUrl.queryOrderCheckErrorView + "&carNum=" + carNumPre;
  150 + } else if (data != null && "8888" != data.code) {
  151 + $.alert("查询待支付订单失败,请重试!");
  152 + } else {
  153 + var orderVO = data.data;
  154 + $('#parkOrderId').val(orderVO.orderId);
  155 + $('#payOrderId').val(orderVO.payOrderId)
  156 + $('#orderNotPayFee').text(orderVO.orderNotPayFee);
  157 + $('#orderTitle').text(orderVO.orderTitle);
  158 + $('#carNumber').text(orderVO.carNumber);
  159 + $('#parkName').text(orderVO.parkName);
  160 + $('#parkInTime').text(orderVO.parkInTime);
  161 + $('#parkingDuration').text(orderVO.parkingDuration);
  162 + $('#orderTotalFee').text(orderVO.orderTotalFee);
  163 + $('#orderPayedFee').text(orderVO.orderPayedFee);
  164 +
  165 + }
  166 +
  167 +
  168 + });
  169 + },
  170 + };
  171 + $(function () {
  172 + func.initData();
  173 + });
  174 + var flg = true;
  175 + $("#showTooltips").click(function () {
  176 + if (flg) {
  177 + flg = false;
  178 + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary weui-btn_disabled');
  179 + var parkOrderId = $('#parkOrderId').val();
  180 + var payOrderId = $('#payOrderId').val();
  181 + if (parkOrderId.length < 1) {
  182 + $.toptip("订单Id为空", 2000, "error");
  183 + $('#showTooltips').attr('class', 'weui-btn weui-btn_primary');
  184 + flg = true;
  185 + return false;
  186 + }
  187 + var req = {
  188 + orderId: parkOrderId,
  189 + payOrderId:payOrderId
  190 + }
  191 +
  192 + $.ajax({
  193 + url: mUrl.getJSPayParam,
  194 + type: 'post',
  195 + dataType: 'json',
  196 + data: req,
  197 + success: function (res) {
  198 + if (res.code == '8888') {
  199 + var payParam = res.data;
  200 + //调用微信支付
  201 + callpay(payParam);
  202 + } else {
  203 + $.toptip(res.msg, 2000, "error");
  204 + console.log('详细错误信息为:' + res.data);
  205 + }
  206 + }
  207 + });
  208 + }//if
  209 + });
  210 +
  211 + //调用微信JS api 支付
  212 + function jsApiCall(payParam) {
  213 + WeixinJSBridge.invoke(
  214 + 'getBrandWCPayRequest',
  215 + payParam,
  216 + function (res) {
  217 + if (res.err_msg == "get_brand_wcpay_request:ok") {
  218 + $.alert("亲!支付成功!");
  219 + //支付成功
  220 + windows.location.href = mUrl.paySuccessView + '&payMoney=' + totleMoney;
  221 +
  222 + } else {
  223 + //支付失败
  224 + $.alert("亲!支付失败!err_msg=" + res.err_msg);
  225 + //windows.location.href='${host}/pay/payFail';
  226 +
  227 + }
  228 +
  229 +
  230 + }
  231 + );
  232 + }
  233 +
  234 + function callpay(payParam) {
  235 + if (typeof WeixinJSBridge == "undefined") {
  236 + if (document.addEventListener) {
  237 + document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
  238 + } else if (document.attachEvent) {
  239 + document.attachEvent('WeixinJSBridgeReady', jsApiCall);
  240 + document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
  241 + }
  242 + } else {
  243 + jsApiCall(payParam);
  244 + }
  245 + }
240 246 </script>
241 247 </body>
242 248 </html>
... ...