├── .classpath ├── .gitignore ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── LICENSE ├── README.md ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── WEB-INF │ ├── config │ │ └── QQWry.Dat │ ├── locale │ │ ├── common │ │ │ ├── message.properties │ │ │ ├── message_en_US.properties │ │ │ └── message_zh_CN.properties │ │ ├── console │ │ │ ├── message.properties │ │ │ ├── message_en_US.properties │ │ │ └── message_zh_CN.properties │ │ └── website │ │ │ ├── message.properties │ │ │ ├── message_en_US.properties │ │ │ └── message_zh_CN.properties │ ├── views │ │ └── common │ │ │ ├── error.html │ │ │ └── ftl │ │ │ ├── spring.ftl │ │ │ └── web.ftl │ └── web.xml ├── index.html └── themes │ ├── black │ └── css │ │ └── webfinal.css │ ├── blue │ └── css │ │ └── webfinal.css │ ├── default │ └── css │ │ └── webfinal.css │ ├── green │ └── css │ │ └── webfinal.css │ └── red │ └── css │ └── webfinal.css ├── books ├── api │ └── api_kuaidi100快递公司代码.doc ├── mybatis-3.3.0.pdf ├── spring-4.2.0.pdf └── web │ ├── Tomcat性能优化.txt │ ├── ehcache.xml │ ├── nginx.conf │ └── server.xml ├── build └── classes │ ├── .gitignore │ ├── app.properties │ ├── cache │ ├── ehcache.xml │ └── ehcache.xsd │ ├── jdbc.properties │ ├── log4j.properties │ ├── mybatis │ └── config.xml │ └── theme │ ├── black.properties │ ├── blue.properties │ ├── default.properties │ ├── green.properties │ ├── orange.properties │ └── red.properties ├── resource ├── cache │ ├── ehcache.xml │ └── ehcache.xsd ├── config │ ├── express.properties │ └── freemarker.properties ├── mybatis │ └── config.xml ├── spring │ ├── applicationContext-mail.xml │ ├── applicationContext-mvc.xml │ ├── applicationContext-shiro.xml │ └── applicationContext.xml └── theme │ ├── black.properties │ ├── blue.properties │ ├── default.properties │ ├── green.properties │ ├── orange.properties │ └── red.properties └── src ├── app.properties ├── com └── binrui │ └── shop │ ├── express │ ├── action │ │ └── ExpressController.java │ └── service │ │ └── ExpressService.java │ ├── home │ └── action │ │ └── HomeController.java │ ├── order │ └── action │ │ └── OrderController.java │ ├── pay │ └── alipay │ │ ├── action │ │ ├── AlipayController.java │ │ └── AlipayReportController.java │ │ ├── config │ │ └── AlipayConfig.java │ │ ├── dao │ │ └── AlipayDao.java │ │ ├── service │ │ ├── AlipayReportService.java │ │ └── AlipayService.java │ │ ├── sign │ │ ├── Base64.java │ │ ├── MD5.java │ │ └── RSA.java │ │ └── util │ │ ├── AlipayCore.java │ │ ├── AlipayNotify.java │ │ ├── AlipaySubmit.java │ │ ├── UtilDate.java │ │ └── http │ │ ├── HttpProtocolHandler.java │ │ ├── HttpRequest.java │ │ ├── HttpResponse.java │ │ └── HttpResultType.java │ ├── utils │ ├── ApiUtils.java │ └── MD5Util.java │ └── web │ └── BinRuiExceptionResolver.java ├── jdbc.properties └── log4j.properties /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | shopping 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//resource/cache/ehcache.xml=UTF-8 3 | encoding//resource/config/express.properties=UTF-8 4 | encoding//src/app.properties=UTF-8 5 | encoding//src/com/binrui/shop/pay/alipay/action/AlipayController.java=UTF-8 6 | encoding//src/com/binrui/shop/pay/alipay/action/AlipayReportController.java=UTF-8 7 | encoding//src/com/binrui/shop/pay/alipay/config/AlipayConfig.java=UTF-8 8 | encoding//src/com/binrui/shop/pay/alipay/service/AlipayReportService.java=UTF-8 9 | encoding//src/com/binrui/shop/pay/alipay/service/AlipayService.java=UTF-8 10 | encoding//src/com/binrui/shop/pay/alipay/sign/MD5.java=UTF-8 11 | encoding//src/com/binrui/shop/pay/alipay/sign/RSA.java=UTF-8 12 | encoding//src/com/binrui/shop/pay/alipay/util/AlipayCore.java=UTF-8 13 | encoding//src/com/binrui/shop/pay/alipay/util/AlipayNotify.java=UTF-8 14 | encoding//src/com/binrui/shop/pay/alipay/util/AlipaySubmit.java=UTF-8 15 | encoding//src/com/binrui/shop/pay/alipay/util/UtilDate.java=UTF-8 16 | encoding//src/com/binrui/shop/pay/alipay/util/http/HttpProtocolHandler.java=UTF-8 17 | encoding//src/com/binrui/shop/pay/alipay/util/http/HttpRequest.java=UTF-8 18 | encoding//src/com/binrui/shop/pay/alipay/util/http/HttpResponse.java=UTF-8 19 | encoding//src/com/binrui/shop/pay/alipay/util/http/HttpResultType.java=UTF-8 20 | encoding//src/log4j.properties=UTF-8 21 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 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, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015 BinRui Technology Co.,Ltd 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # shopping 2 | shopping mall for company or farmers. 3 | -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/config/QQWry.Dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/WebRoot/WEB-INF/config/QQWry.Dat -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/common/message.properties: -------------------------------------------------------------------------------- 1 | project.item.name=Jamesli 2 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/common/message_en_US.properties: -------------------------------------------------------------------------------- 1 | common.app.name=Inspur Egoverment Data Monitoring System 2 | common.app.version=v2.0 3 | common.app.shortname=Framework 4 | common.app.login=Sign In 5 | common.app.userlogin=Sign In 6 | common.app.calogin=CA Sign In 7 | common.app.register=Create account now? 8 | common.app.forget=Forgot password? 9 | common.app.introduce=Home 10 | common.app.help=Help 11 | common.app.helpcenter=Help 12 | common.app.client=Download 13 | common.app.language=Language 14 | common.app.theme=Theme 15 | common.app.exit=Logout 16 | common.app.operation=Operation 17 | common.app.warning=Warning 18 | common.app.successTip=Congratulations\uff0coperation successful\! 19 | common.app.failTip=Sorry\uff0coperation failed\! 20 | common.app.location=location 21 | common.login.account=Account 22 | common.login.password=Password 23 | common.login.remeber=remeber me 24 | common.footer.organizer=Organizer 25 | common.footer.organizer.name=Inspur Software Com.Tld 26 | common.footer.undertake=Undertaker 27 | common.footer.undertake.name=Inspur Software Egoverment Departement 28 | common.footer.support=Support 29 | common.footer.email=egov@inspur.com 30 | common.footer.phone=0531-12345678 31 | common.footer.record=No. 123456789E-ICP 32 | common.footer.copyright=Copyright 33 | common.language.zh=Simple Chinese 34 | common.language.en=English 35 | common.theme.default=default 36 | common.theme.black=black 37 | common.theme.blue=blue 38 | common.theme.green=green 39 | common.theme.orange=orange 40 | common.theme.red=red 41 | common.button.edit=Edit 42 | common.button.search=Search 43 | common.button.reset=Reset 44 | common.button.delete=Delete 45 | common.button.add=Add 46 | common.button.look=Look 47 | common.button.archive=Archive 48 | common.button.deploy=Deploy 49 | common.button.select=Choose 50 | common.button.config=Config 51 | common.button.register=register 52 | common.button.sign=sign 53 | common.button.release=release 54 | common.button.done=done 55 | common.grid.submitTime=Submit Time 56 | common.grid.createTime=Create Time 57 | common.grid.handleTime=Handle Time 58 | common.grid.pageNum=Number 59 | common.grid.pageLabelFunction=showing {0} pages\uff0c  {1} records 60 | common.grid.pageNumber=showing page {0} 61 | common.grid.pageTotal=total {0} records 62 | common.grid.pageFirst=First 63 | common.grid.pagePrev=Previous 64 | common.grid.pageNext=Next 65 | common.grid.pageLast=Last 66 | common.month.one=Jan 67 | common.month.two=Feb 68 | common.month.three=Mar 69 | common.month.four=Apr 70 | common.month.five=May 71 | common.month.six=Jun 72 | common.month.seven=Jul 73 | common.month.eight=Aug 74 | common.month.nine=Sep 75 | common.month.ten=Oct 76 | common.month.eleven=Nov 77 | common.month.twelve=Dec 78 | common.action.submit=Submit 79 | common.action.save=Save 80 | common.action.back=Back 81 | common.action.prompt=The system prompt 82 | common.action.successDel=Delete the success 83 | common.action.failedDel=Delete failed 84 | common.action.revoke=Revoke 85 | common.action.hangup=Hangup 86 | common.action.ok=OK 87 | common.action.cancel=Cancel 88 | common.action.close=Close 89 | common.file.upload=Upload 90 | common.file.download=Download 91 | common.file.preview=Preview 92 | common.confirm.yes=Yes 93 | common.confirm.no=No -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/common/message_zh_CN.properties: -------------------------------------------------------------------------------- 1 | common.app.name=\u5f6c\u777f\u519c\u5546\u5e73\u53f0 2 | common.app.version=v2.0 3 | common.app.shortname=\u57fa\u7840\u6846\u67b6 4 | common.app.login=\u767b \u5f55 5 | common.app.userlogin=\u7528\u6237\u767b\u5f55 6 | common.app.register=\u73b0\u5728\u5c31\u53bb\u6ce8\u518c\u65b0\u8d26\u6237? 7 | common.app.forget=\u5fd8\u8bb0\u5bc6\u7801\uff1f 8 | common.app.calogin=CA\u8bc1\u4e66\u767b\u5f55 9 | common.app.introduce=\u7cfb\u7edf\u7b80\u4ecb 10 | common.app.help=\u5e2e\u52a9 11 | common.app.helpcenter=\u5e2e\u52a9\u4e2d\u5fc3 12 | common.app.client=\u5ba2\u6237\u7aef 13 | common.app.language=\u9009\u62e9\u8bed\u8a00 14 | common.app.theme=\u9009\u62e9\u4e3b\u9898 15 | common.app.exit=\u9000\u51fa 16 | common.app.operation=\u64cd\u4f5c 17 | common.app.warning=\u7cfb\u7edf\u63d0\u793a 18 | common.app.successTip=\u606d\u559c\u60a8\uff0c\u64cd\u4f5c\u6210\u529f\uff01 19 | common.app.failTip=\u5bf9\u4e0d\u8d77\uff0c\u64cd\u4f5c\u5931\u8d25\u4e86\! 20 | common.app.location=\u5f53\u524d\u4f4d\u7f6e 21 | common.login.account=\u767b\u5f55\u8d26\u53f7 22 | common.login.password=\u767b\u5f55\u5bc6\u7801 23 | common.login.remeber=\u8bb0\u4f4f\u5bc6\u7801 24 | common.footer.organizer=\u4e3b\u529e\u5355\u4f4d 25 | common.footer.organizer.name=\u6d6a\u6f6e\u8f6f\u4ef6\u80a1\u4efd\u6709\u9650\u516c\u53f8 26 | common.footer.undertake=\u627f\u529e\u5355\u4f4d 27 | common.footer.undertake.name=\u6d6a\u6f6e\u8f6f\u4ef6\u7535\u5b50\u653f\u52a1\u4e8b\u4e1a\u90e8 28 | common.footer.support=\u6280\u672f\u652f\u6301 29 | common.footer.email=egov@inspur.com 30 | common.footer.phone=0531-12345678 31 | common.footer.record=\u9c81No. 123456789E-ICP 32 | common.footer.copyright=\u7248\u6743\u6240\u6709 33 | common.language.zh=\u7b80\u4f53\u4e2d\u6587 34 | common.language.en=English 35 | common.theme.default=\u9ed8\u8ba4 36 | common.theme.black=\u9ed1\u8272 37 | common.theme.blue=\u84dd\u8272 38 | common.theme.green=\u7eff\u8272 39 | common.theme.orange=\u6a59\u8272 40 | common.theme.red=\u7ea2\u8272 41 | common.button.edit=\u7f16\u8f91 42 | common.button.search=\u67e5\u8be2 43 | common.button.reset=\u91cd\u7f6e 44 | common.button.delete=\u5220\u9664 45 | common.button.add=\u589e\u52a0 46 | common.button.look=\u67e5\u770b 47 | common.button.archive=\u5f52\u6863 48 | common.button.deploy=\u90e8\u7f72 49 | common.button.select=\u9009\u62e9 50 | common.button.config=\u914d\u7f6e 51 | common.button.register=\u7533\u8bf7\u767b\u8bb0 52 | common.button.sign=\u7b7e\u6536 53 | common.button.release=\u91ca\u653e 54 | common.button.done=\u5904\u7406 55 | common.grid.submitTime=\u63d0\u4ea4\u65f6\u95f4 56 | common.grid.createTime=\u521b\u5efa\u65f6\u95f4 57 | common.grid.handleTime=\u5904\u7406\u65f6\u95f4 58 | common.grid.pageNum=\u5e8f\u53f7 59 | common.grid.pageLabelFunction=\u5171{0} \u9875\uff0c  {1} \u6761\u8bb0\u5f55 60 | common.grid.pageNumber=\u5171 {0} \u9875 61 | common.grid.pageTotal={0} \u6761\u8bb0\u5f55 62 | common.grid.pageFirst=\u9996\u9875 63 | common.grid.pagePrev=\u4e0a\u4e00\u9875 64 | common.grid.pageNext=\u4e0b\u4e00\u9875 65 | common.grid.pageLast=\u672b\u9875 66 | common.month.one=1\u6708\u4efd 67 | common.month.two=2\u6708\u4efd 68 | common.month.three=3\u6708\u4efd 69 | common.month.four=4\u6708\u4efd 70 | common.month.five=5\u6708\u4efd 71 | common.month.six=6\u6708\u4efd 72 | common.month.seven=7\u6708\u4efd 73 | common.month.eight=8\u6708\u4efd 74 | common.month.nine=9\u6708\u4efd 75 | common.month.ten=10\u6708\u4efd 76 | common.month.eleven=11\u6708\u4efd 77 | common.month.twelve=12\u6708\u4efd 78 | common.action.submit=\u63d0\u4ea4 79 | common.action.save=\u4fdd\u5b58 80 | common.action.back=\u56de\u9000 81 | common.action.revoke=\u64a4\u9500 82 | common.action.hangup=\u6302\u8d77 83 | common.action.ok=\u786e\u5b9a 84 | common.action.cancel=\u53d6\u6d88 85 | common.action.close=\u5173\u95ed 86 | common.action.prompt=\u7cfb\u7edf\u63d0\u793a 87 | common.action.successDel=\u5220\u9664\u6210\u529f 88 | common.action.failedDel=\u5220\u9664\u5931\u8d25 89 | common.file.upload=\u4e0a\u4f20 90 | common.file.download=\u4e0b\u8f7d 91 | common.file.preview=\u9884\u89c8 92 | common.confirm.yes=\u662f 93 | common.confirm.no=\u5426 -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/console/message.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/WebRoot/WEB-INF/locale/console/message.properties -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/console/message_en_US.properties: -------------------------------------------------------------------------------- 1 | console.server.database=DataBase 2 | console.server.databaseNo=Number 3 | console.server.databaseName=\u6570\u636e\u5e93\u540d\u79f0 4 | console.server.databaseIp=\u670d\u52a1\u5668IP\u5730\u5740 5 | console.server.databasePort=Port 6 | console.server.databaseType=\u6570\u636e\u5e93\u7c7b\u578b 7 | console.server.databaseDriver=JDBC \u9a71\u52a8 8 | console.server.databaseUrl=JDBC \u8fde\u63a5 9 | console.server.databaseUname=\u767b\u5f55\u7528\u6237\u540d 10 | console.server.databasePwd=\u767b \u5f55 \u5bc6 \u7801 11 | console.server.databaseRepwd=Repeat Password 12 | console.server.databaseHasSlave=\u662f\u5426\u6709\u4ece\u5e93 13 | console.server.databaseRemark=\u6570\u636e\u5e93\u63cf\u8ff0 14 | console.server.databaseTags=\u6570\u636e\u5e93\u6807\u7b7e 15 | console.server.databaseTagsTip=Please input database server function tags 16 | console.server.databaseOrder=\u6570\u636e\u5e93\u6392\u5e8f 17 | console.server.user=User 18 | console.server.noQueryData=No query to the relevant data 19 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/console/message_zh_CN.properties: -------------------------------------------------------------------------------- 1 | console.server.database=\u6570\u636e\u5e93 2 | console.server.databaseNo=\u6570\u636e\u5e93\u7f16\u53f7 3 | console.server.databaseName=\u6570\u636e\u5e93\u540d\u79f0 4 | console.server.databaseIp=\u670d\u52a1\u5668\u5730\u5740 5 | console.server.databasePort=\u670d\u52a1\u5668\u7aef\u53e3 6 | console.server.databaseType=\u6570\u636e\u5e93\u7c7b\u578b 7 | console.server.databaseDriver=JDBC \u9a71\u52a8 8 | console.server.databaseUrl=JDBC \u8fde\u63a5 9 | console.server.databaseUname=\u767b\u5f55\u7528\u6237\u540d 10 | console.server.databasePwd=\u767b \u5f55 \u5bc6 \u7801 11 | console.server.databaseRepwd=\u91cd \u590d \u5bc6 \u7801 12 | console.server.databaseHasSlave=\u662f\u5426\u6709\u4ece\u5e93 13 | console.server.databaseRemark=\u6570\u636e\u5e93\u63cf\u8ff0 14 | console.server.databaseTags=\u6570\u636e\u5e93\u6807\u7b7e 15 | console.server.databaseTagsTip=\u8bf7\u8f93\u5165\u670d\u52a1\u529f\u80fd\u6807\u7b7e... 16 | console.server.databaseOrder=\u6570\u636e\u5e93\u6392\u5e8f 17 | console.server.user=\u7528\u6237 18 | console.server.noQueryData=\u6ca1\u6709\u67e5\u8be2\u5230\u76f8\u5173\u6570\u636e 19 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/website/message.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/WebRoot/WEB-INF/locale/website/message.properties -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/website/message_en_US.properties: -------------------------------------------------------------------------------- 1 | website.host.withoutHostBusiness=Delegated host 2 | website.host.configurationHost=The server configuration 3 | website.host.add=add 4 | website.host.hostIP=Server IP 5 | website.host.hostTags=Server type 6 | website.host.All=all 7 | website.host.serverCloud=Cloud Server 8 | website.host.serverVirtual=Virtual Server 9 | website.host.serverPhysics=Physical Server 10 | website.host.applicationServer=The application server 11 | website.host.proxyServer=The proxy server 12 | website.host.componentServer=Component server 13 | website.host.databaseServer=The database server 14 | website.host.mailServer=Mail Server 15 | website.host.msgServer=Message Server 16 | website.host.fileServer=File Server 17 | website.host.computServer=Computer Server 18 | website.host.storeServer=Store Server 19 | website.host.serverNetwork=Server network 20 | website.host.networkPersonal=VPN 21 | website.host.networkInternet=Internet 22 | website.host.networkGoverment=Public Net 23 | website.host.networPrivate=Private Net 24 | website.host.serverLocation=Server location 25 | website.host.serverOrder=Server order 26 | website.host.serverProvider=Server Provider 27 | website.host.serverRemark=Server description 28 | website.host.serverType=Server Type 29 | website.host.serverName=Server Name 30 | website.host.serverCpu=CPU Kernel 31 | website.host.serverCpuUnit=Kenel 32 | website.host.serverMem=Memery Size 33 | website.host.serverNetgap=Net BandWidth 34 | website.host.serverOs=Server OS 35 | website.host.serverAdd=Server Add 36 | website.host.serverEdit=Server Edit 37 | website.host.serverConfirmDel=Are you sure you want to delete the server 38 | website.bsnum.withoutHostBusiness=can't find database servers 39 | website.node.serverType=The database type 40 | website.node.serverPort=Port 41 | website.node.serverTags=Tags 42 | website.node.serverOrder=Order 43 | website.node.serverUserName=User name 44 | website.node.serverPassword=Password 45 | website.node.serverPassword2=Repeat the password 46 | website.node.serverAdd=Add database 47 | website.node.serverTest=Test 48 | website.node.serverConfirmDel=Are you sure you want to delete the database 49 | website.node.serverTestSuccess=Connect the test successfully 50 | website.node.master=Master 51 | website.node.connect=Connect 52 | website.node.role=Role 53 | website.node.runTime=Run Time 54 | website.node.version=Version 55 | website.node.threadRunning=ThreadRunning 56 | website.node.threadConnected=ThreadConnected 57 | website.node.threadWaits=ThreadWaiting 58 | website.node.receivedPersond=ReceivedPersond 59 | website.node.sentPersond=SentPersond 60 | website.node.queryPersond=QueryPersond 61 | website.node.transactionPersond=Transaction 62 | website.node.checkReport=Check Report 63 | website.node.nodeInitialize=Database initialization 64 | website.node.hostInitialize=Server initialization 65 | website.node.maxConnect=Max Connected 66 | website.node.maxConnectError=Max Connected Error 67 | website.node.openFilesLimit=Open Files Limit 68 | website.node.openFiles=Open Files 69 | website.node.tableOpenCache=Table Open Cache 70 | website.node.openTables=Open Tables 71 | website.node.host=Host 72 | website.node.basicInformation=Basic Info 73 | website.node.thread=Thread 74 | website.node.network=Net Work 75 | website.node.healthInformation=No Information For Health Check. 76 | website.node.connectResource=Connect Resource 77 | website.node.fileResource=Files Resource 78 | website.node.tableResource=Tables Resource 79 | website.node.propertyInformation=No Information For Property. 80 | website.node.Monitoring=Monitoring 81 | website.node.SendEmail=Send Email 82 | website.node.SendMessage=Send Message 83 | website.node.SlowQuery=The slow query 84 | website.node.threadConnect=Connection thread 85 | website.node.threadRun=Active threads 86 | website.node.threadWait=Waiting for the thread 87 | website.node.MonitoringFrequency=Monitoring frequency 88 | website.node.Seconds=seconds 89 | website.node.Minutes=Minutes 90 | website.node.opened=open 91 | website.node.closed=close 92 | website.node.switch=Supervisory switch 93 | website.node.alarmProject=The alarm project 94 | website.warning.slowQueryAnalysis=Slow Query Analysis 95 | website.warning.SQL=SQL 96 | website.warning.queryTime=QueryTime 97 | website.warning.lockTime=LockTime 98 | website.warning.checksum=CheckSum 99 | website.warning.fingerprint=FingerPrint 100 | website.warning.lastseen=Last Seen 101 | website.warning.tscnt=Number Of Times 102 | website.warning.sum=SUM 103 | website.warning.min=MIN 104 | website.warning.max=MAX 105 | website.node.fresh=Fresh 106 | website.node.success=Success 107 | website.node.failed=Failed 108 | website.node.hours=hours 109 | website.node.time=time 110 | website.node.maxAlarmTimes=Send the alarm mail maximum times 111 | website.node.SleepTime=Send the alarm mail sleep time 112 | website.node.AlarmRecipient=The alarm mail recipients 113 | website.node.maxAlarmMessage=Maximum number of send alarm messages 114 | website.node.SleepTimeMessage=Send the alarm message sleep time 115 | website.node.AlarmRecipientMessage=The alarm message recipients 116 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/locale/website/message_zh_CN.properties: -------------------------------------------------------------------------------- 1 | website.host.withoutHostBusiness=\u6682\u65e0\u670d\u52a1\u5668 2 | website.host.configurationHost=\u670d\u52a1\u5668\u914d\u7f6e 3 | website.host.add=\u6dfb\u52a0 4 | website.host.hostIP=\u670d\u52a1\u5668IP 5 | website.host.hostTags=\u670d\u52a1\u5668\u6807\u7b7e 6 | website.host.All=\u5168\u90e8 7 | website.host.serverCloud=\u4e91\u4e3b\u673a 8 | website.host.serverVirtual=\u865a\u62df\u673a 9 | website.host.serverPhysics=\u7269\u7406\u673a 10 | website.host.applicationServer=\u5e94\u7528\u670d\u52a1\u5668 11 | website.host.proxyServer=\u4ee3\u7406\u670d\u52a1\u5668 12 | website.host.componentServer=\u7ec4\u4ef6\u670d\u52a1\u5668 13 | website.host.databaseServer=\u6570\u636e\u5e93\u670d\u52a1\u5668 14 | website.host.mailServer=\u90ae\u4ef6\u670d\u52a1\u5668 15 | website.host.msgServer=\u6d88\u606f\u670d\u52a1\u5668 16 | website.host.fileServer=\u6587\u4ef6\u670d\u52a1\u5668 17 | website.host.computServer=\u8ba1\u7b97\u8282\u70b9 18 | website.host.storeServer=\u5b58\u50a8\u8282\u70b9 19 | website.host.serverNetwork=\u670d\u52a1\u5668\u7f51\u7edc 20 | website.host.networkPersonal=\u865a\u62df\u4e13\u7f51(VPN) 21 | website.host.networkInternet=\u4e92\u8054\u7f51 22 | website.host.networkGoverment=\u653f\u52a1\u975e\u6d89\u5bc6\u7f51(\u5916\u7f51) 23 | website.host.networPrivate=\u653f\u52a1\u6d89\u5bc6\u7f51(\u5185\u7f51) 24 | website.host.serverLocation=\u670d\u52a1\u5668\u4f4d\u7f6e 25 | website.host.serverOrder=\u670d\u52a1\u5668\u5e8f\u53f7 26 | website.host.serverProvider=\u670d\u52a1\u5668\u5382\u5546 27 | website.host.serverRemark=\u670d\u52a1\u5668\u63cf\u8ff0 28 | website.host.serverType=\u670d\u52a1\u5668\u7c7b\u578b 29 | website.host.serverName=\u670d\u52a1\u5668\u540d\u79f0 30 | website.host.serverCpu=CPU\u5185\u6838\u6570 31 | website.host.serverCpuUnit=\u6838 32 | website.host.serverMem=\u670d\u52a1\u5668\u5185\u5b58 33 | website.host.serverNetgap=\u670d\u52a1\u5668\u5e26\u5bbd 34 | website.host.serverOs=\u670d\u52a1\u5668\u7cfb\u7edf 35 | website.host.serverAdd=\u65b0\u589e\u670d\u52a1\u5668 36 | website.host.serverEdit=\u7f16\u8f91\u670d\u52a1\u5668 37 | website.host.serverConfirmDel=\u60a8\u786e\u5b9a\u8981\u5220\u9664\u670d\u52a1\u5668 38 | website.bsnum.withoutHostBusiness=\u6ca1\u6709\u67e5\u8be2\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668 39 | website.node.serverType=\u6570\u636e\u5e93\u7c7b\u578b 40 | website.node.serverPort=\u7aef\u53e3\u53f7 41 | website.node.serverTags=\u6807\u7b7e 42 | website.node.serverOrder=\u6392\u5e8f 43 | website.node.serverUserName=\u7528\u6237\u540d 44 | website.node.serverPassword=\u5bc6\u7801 45 | website.node.serverPassword2=\u91cd\u590d\u5bc6\u7801 46 | website.node.serverAdd=\u6dfb\u52a0\u6570\u636e\u5e93 47 | website.node.serverTest=\u6d4b\u8bd5 48 | website.node.serverConfirmDel=\u60a8\u786e\u5b9a\u8981\u5220\u9664\u6570\u636e\u5e93 49 | website.node.serverTestSuccess=\u8fde\u63a5\u6d4b\u8bd5\u6210\u529f 50 | website.node.master=\u4e3b\u673a 51 | website.node.connect=\u8fde\u63a5 52 | website.node.role=\u89d2\u8272 53 | website.node.runTime=\u8fd0\u884c\u65f6\u95f4 54 | website.node.version=\u7248\u672c 55 | website.node.threadRunning=\u6d3b\u52a8\u7ebf\u7a0b\u6570 56 | website.node.threadConnected=\u8fde\u63a5\u7ebf\u7a0b\u6570 57 | website.node.threadWaits=\u7b49\u5f85\u7ebf\u7a0b\u6570 58 | website.node.receivedPersond=\u63a5\u6536 59 | website.node.sentPersond=\u53d1\u9001 60 | website.node.queryPersond=\u6bcf\u79d2\u67e5\u8be2 61 | website.node.transactionPersond=\u6bcf\u79d2\u4e8b\u52a1 62 | website.node.checkReport=\u68c0\u67e5\u62a5\u544a 63 | website.node.nodeInitialize=\u6570\u636e\u5e93\u521d\u59cb\u5316 64 | website.node.hostInitialize=\u670d\u52a1\u5668\u521d\u59cb\u5316 65 | website.node.maxConnect=\u6700\u5927\u8fde\u63a5\u6570 66 | website.node.maxConnectError=\u6700\u5927\u8fde\u63a5\u9519\u8bef\u6570 67 | website.node.openFilesLimit=\u6700\u5927\u6253\u5f00\u6587\u4ef6\u6570 68 | website.node.openFiles=\u5df2\u6253\u5f00\u6587\u4ef6\u6570 69 | website.node.tableOpenCache=\u8868\u7f13\u5b58\u6570 70 | website.node.openTables=\u5df2\u6253\u5f00\u8868 71 | website.node.host=\u670d\u52a1\u5668 72 | website.node.basicInformation=\u57fa\u672c\u4fe1\u606f 73 | website.node.thread=\u7ebf\u7a0b 74 | website.node.network=\u7f51\u7edc 75 | website.node.healthInformation=\u6682\u65f6\u6ca1\u6709\u5065\u5eb7\u68c0\u67e5\u4fe1\u606f\u3002 76 | website.node.connectResource=\u8fde\u63a5\u6c60\u8d44\u6e90 77 | website.node.fileResource=\u6587\u4ef6\u8d44\u6e90 78 | website.node.tableResource=\u8868\u8d44\u6e90 79 | website.node.propertyInformation=\u6682\u65e0\u6027\u80fd\u76d1\u63a7\u4fe1\u606f\u3002 80 | website.node.Monitoring=\u76d1\u63a7 81 | website.node.SendEmail=\u53d1\u9001\u90ae\u4ef6 82 | website.node.SendMessage=\u53d1\u9001\u77ed\u4fe1 83 | website.node.SlowQuery=\u6162\u67e5\u8be2 84 | website.node.threadConnect=\u8fde\u63a5\u7ebf\u7a0b 85 | website.node.threadRun=\u6d3b\u52a8\u7ebf\u7a0b 86 | website.node.threadWait=\u7b49\u5f85\u7ebf\u7a0b 87 | website.node.MonitoringFrequency=\u76d1\u63a7\u9891\u7387 88 | website.node.Minutes=\u5206\u949f 89 | website.node.Seconds=\u79d2 90 | website.node.opened=\u5f00 91 | website.node.closed=\u5173 92 | website.node.switch=\u76d1\u63a7\u5f00\u5173 93 | website.node.alarmProject=\u544a\u8b66\u9879\u76ee 94 | website.warning.slowQueryAnalysis=\u6162\u67e5\u8be2\u5206\u6790 95 | website.warning.SQL=SQL 96 | website.warning.queryTime=\u67e5\u8be2\u65f6\u95f4 97 | website.warning.lockTime=\u9501\u7b49\u5f85\u65f6\u95f4 98 | website.warning.checksum=\u6821\u9a8c\u503c 99 | website.warning.fingerprint=\u62bd\u8c61\u8bed\u53e5 100 | website.warning.lastseen=\u6700\u8fd1\u65f6\u95f4 101 | website.warning.tscnt=\u6b21\u6570 102 | website.warning.sum=\u603b\u8ba1 103 | website.warning.min=\u6700\u5c0f 104 | website.warning.max=\u6700\u5927 105 | website.node.fresh=\u5237\u65b0 106 | website.node.success=\u6210\u529f 107 | website.node.failed=\u5931\u8d25 108 | website.node.hours=\u5c0f\u65f6 109 | website.node.time=\u6b21 110 | website.node.maxAlarmTimes=\u53d1\u9001\u544a\u8b66\u90ae\u4ef6\u6700\u5927\u6b21\u6570 111 | website.node.SleepTime=\u53d1\u9001\u544a\u8b66\u90ae\u4ef6\u4f11\u7720\u65f6\u95f4 112 | website.node.AlarmRecipient=\u544a\u8b66\u90ae\u4ef6\u6536\u4ef6\u4eba 113 | website.node.maxAlarmMessage=\u53d1\u9001\u544a\u8b66\u77ed\u4fe1\u6700\u5927\u6b21\u6570 114 | website.node.SleepTimeMessage=\u53d1\u9001\u544a\u8b66\u77ed\u4fe1\u4f11\u7720\u65f6\u95f4 115 | website.node.AlarmRecipientMessage=\u544a\u8b66\u77ed\u4fe1\u6536\u4ef6\u4eba 116 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/views/common/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |
9 |
10 | 13 | 14 |
15 | 16 |
17 | 33 | 34 |
35 |
36 | 37 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/views/common/ftl/spring.ftl: -------------------------------------------------------------------------------- 1 | <#ftl strip_whitespace=true> 2 | 3 | <#-- 4 | * message as m 5 | * 6 | * Macro to translate a message code into a message. 7 | --> 8 | <#macro m code>${springMacroRequestContext.getMessage(code)} 9 | 10 | <#-- 11 | * messageText as mt 12 | * 13 | * Macro to translate a message code into a message, 14 | * using the given default text if no message found. 15 | --> 16 | <#macro mt code, text>${springMacroRequestContext.getMessage(code, text)} 17 | 18 | <#-- 19 | * messageArgs as ma 20 | * 21 | * Macro to translate a message code with arguments into a message. 22 | --> 23 | <#macro ma code, args>${springMacroRequestContext.getMessage(code, args)} 24 | 25 | <#-- 26 | * messageArgsText as mat 27 | * 28 | * Macro to translate a message code with arguments into a message, 29 | * using the given default text if no message found. 30 | --> 31 | <#macro mat code, args, text>${springMacroRequestContext.getMessage(code, args, text)} 32 | 33 | <#-- 34 | * theme 35 | * 36 | * Macro to translate a theme message code into a message. 37 | --> 38 | <#macro theme code>${springMacroRequestContext.getThemeMessage(code)} 39 | 40 | <#-- 41 | * themeText 42 | * 43 | * Macro to translate a theme message code into a message, 44 | * using the given default text if no message found. 45 | --> 46 | <#macro themeText code, text>${springMacroRequestContext.getThemeMessage(code, text)} 47 | 48 | <#-- 49 | * themeArgs 50 | * 51 | * Macro to translate a theme message code with arguments into a message. 52 | --> 53 | <#macro themeArgs code, args>${springMacroRequestContext.getThemeMessage(code, args)} 54 | 55 | <#-- 56 | * themeArgsText 57 | * 58 | * Macro to translate a theme message code with arguments into a message, 59 | * using the given default text if no message found. 60 | --> 61 | <#macro themeArgsText code, args, text>${springMacroRequestContext.getThemeMessage(code, args, text)} 62 | 63 | <#-- 64 | * url 65 | * 66 | * Takes a relative URL and makes it absolute from the server root by 67 | * adding the context root for the web application. 68 | --> 69 | <#macro url relativeUrl>${springMacroRequestContext.getContextPath()}${relativeUrl} 70 | 71 | <#-- 72 | * bind 73 | * 74 | * Exposes a BindStatus object for the given bind path, which can be 75 | * a bean (e.g. "person") to get global errors, or a bean property 76 | * (e.g. "person.name") to get field errors. Can be called multiple times 77 | * within a form to bind to multiple command objects and/or field names. 78 | * 79 | * This macro will participate in the default HTML escape setting for the given 80 | * RequestContext. This can be customized by calling "setDefaultHtmlEscape" 81 | * on the "springMacroRequestContext" context variable, or via the 82 | * "defaultHtmlEscape" context-param in web.xml (same as for the JSP bind tag). 83 | * Also regards a "htmlEscape" variable in the namespace of this library. 84 | * 85 | * Producing no output, the following context variable will be available 86 | * each time this macro is referenced (assuming you import this library in 87 | * your templates with the namespace 'spring'): 88 | * 89 | * spring.status : a BindStatus instance holding the command object name, 90 | * expression, value, and error messages and codes for the path supplied 91 | * 92 | * @param path : the path (string value) of the value required to bind to. 93 | * Spring defaults to a command name of "command" but this can be overridden 94 | * by user config. 95 | --> 96 | <#macro bind path> 97 | <#if htmlEscape?exists> 98 | <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> 99 | <#else> 100 | <#assign status = springMacroRequestContext.getBindStatus(path)> 101 | 102 | <#-- assign a temporary value, forcing a string representation for any 103 | kind of variable. This temp value is only used in this macro lib --> 104 | <#if status.value?exists && status.value?is_boolean> 105 | <#assign stringStatusValue=status.value?string> 106 | <#else> 107 | <#assign stringStatusValue=status.value?default("")> 108 | 109 | 110 | 111 | <#-- 112 | * bindEscaped 113 | * 114 | * Similar to spring:bind, but takes an explicit HTML escape flag rather 115 | * than relying on the default HTML escape setting. 116 | --> 117 | <#macro bindEscaped path, htmlEscape> 118 | <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)> 119 | <#-- assign a temporary value, forcing a string representation for any 120 | kind of variable. This temp value is only used in this macro lib --> 121 | <#if status.value?exists && status.value?is_boolean> 122 | <#assign stringStatusValue=status.value?string> 123 | <#else> 124 | <#assign stringStatusValue=status.value?default("")> 125 | 126 | 127 | 128 | <#-- 129 | * formInput 130 | * 131 | * Display a form input field of type 'text' and bind it to an attribute 132 | * of a command or bean. 133 | * 134 | * @param path the name of the field to bind to 135 | * @param attributes any additional attributes for the element (such as class 136 | * or CSS styles or size 137 | --> 138 | <#macro formInput path attributes="" fieldType="text"> 139 | <@bind path/> 140 | ${stringStatusValue}" ${attributes}<@closeTag/> 141 | 142 | 143 | <#-- 144 | * formPasswordInput 145 | * 146 | * Display a form input field of type 'password' and bind it to an attribute 147 | * of a command or bean. No value will ever be displayed. This functionality 148 | * can also be obtained by calling the formInput macro with a 'type' parameter 149 | * of 'password'. 150 | * 151 | * @param path the name of the field to bind to 152 | * @param attributes any additional attributes for the element (such as class 153 | * or CSS styles or size 154 | --> 155 | <#macro formPasswordInput path attributes=""> 156 | <@formInput path, attributes, "password"/> 157 | 158 | 159 | <#-- 160 | * formHiddenInput 161 | * 162 | * Generate a form input field of type 'hidden' and bind it to an attribute 163 | * of a command or bean. This functionality can also be obtained by calling 164 | * the formInput macro with a 'type' parameter of 'hidden'. 165 | * 166 | * @param path the name of the field to bind to 167 | * @param attributes any additional attributes for the element (such as class 168 | * or CSS styles or size 169 | --> 170 | <#macro formHiddenInput path attributes=""> 171 | <@formInput path, attributes, "hidden"/> 172 | 173 | 174 | <#-- 175 | * formTextarea 176 | * 177 | * Display a text area and bind it to an attribute of a command or bean. 178 | * 179 | * @param path the name of the field to bind to 180 | * @param attributes any additional attributes for the element (such as class 181 | * or CSS styles or size 182 | --> 183 | <#macro formTextarea path attributes=""> 184 | <@bind path/> 185 | 186 | 187 | 188 | <#-- 189 | * formSingleSelect 190 | * 191 | * Show a selectbox (dropdown) input element allowing a single value to be chosen 192 | * from a list of options. 193 | * 194 | * @param path the name of the field to bind to 195 | * @param options a map (value=label) of all the available options 196 | * @param attributes any additional attributes for the element (such as class 197 | * or CSS styles or size 198 | --> 199 | <#macro formSingleSelect path options attributes=""> 200 | <@bind path/> 201 | 212 | 213 | 214 | <#-- 215 | * formMultiSelect 216 | * 217 | * Show a listbox of options allowing the user to make 0 or more choices from 218 | * the list of options. 219 | * 220 | * @param path the name of the field to bind to 221 | * @param options a map (value=label) of all the available options 222 | * @param attributes any additional attributes for the element (such as class 223 | * or CSS styles or size 224 | --> 225 | <#macro formMultiSelect path options attributes=""> 226 | <@bind path/> 227 | 233 | 234 | 235 | <#-- 236 | * formRadioButtons 237 | * 238 | * Show radio buttons. 239 | * 240 | * @param path the name of the field to bind to 241 | * @param options a map (value=label) of all the available options 242 | * @param separator the html tag or other character list that should be used to 243 | * separate each option. Typically ' ' or '
' 244 | * @param attributes any additional attributes for the element (such as class 245 | * or CSS styles or size 246 | --> 247 | <#macro formRadioButtons path options separator attributes=""> 248 | <@bind path/> 249 | <#list options?keys as value> 250 | <#assign id="${status.expression}${value_index}"> 251 | checked="checked" ${attributes}<@closeTag/> 252 | ${separator} 253 | 254 | 255 | 256 | <#-- 257 | * formCheckboxes 258 | * 259 | * Show checkboxes. 260 | * 261 | * @param path the name of the field to bind to 262 | * @param options a map (value=label) of all the available options 263 | * @param separator the html tag or other character list that should be used to 264 | * separate each option. Typically ' ' or '
' 265 | * @param attributes any additional attributes for the element (such as class 266 | * or CSS styles or size 267 | --> 268 | <#macro formCheckboxes path options separator attributes=""> 269 | <@bind path/> 270 | <#list options?keys as value> 271 | <#assign id="${status.expression}${value_index}"> 272 | <#assign isSelected = contains(status.value?default([""]), value)> 273 | checked="checked" ${attributes}<@closeTag/> 274 | ${separator} 275 | 276 | 277 | 278 | 279 | <#-- 280 | * showErrors 281 | * 282 | * Show validation errors for the currently bound field, with 283 | * optional style attributes. 284 | * 285 | * @param separator the html tag or other character list that should be used to 286 | * separate each option. Typically '
'. 287 | * @param classOrStyle either the name of a CSS class element (which is defined in 288 | * the template or an external CSS file) or an inline style. If the value passed in here 289 | * contains a colon (:) then a 'style=' attribute will be used, else a 'class=' attribute 290 | * will be used. 291 | --> 292 | <#macro showErrors separator classOrStyle=""> 293 | <#list status.errorMessages as error> 294 | <#if classOrStyle == ""> 295 | ${error} 296 | <#else> 297 | <#if classOrStyle?index_of(":") == -1><#assign attr="class"><#else><#assign attr="style"> 298 | ${error} 299 | 300 | <#if error_has_next>${separator} 301 | 302 | 303 | 304 | <#-- 305 | * checkSelected 306 | * 307 | * Check a value in a list to see if it is the currently selected value. 308 | * If so, add the 'selected="selected"' text to the output. 309 | * Handles values of numeric and string types. 310 | * This function is used internally but can be accessed by user code if required. 311 | * 312 | * @param value the current value in a list iteration 313 | --> 314 | <#macro checkSelected value> 315 | <#if stringStatusValue?is_number && stringStatusValue == value?number>selected="selected" 316 | <#if stringStatusValue?is_string && stringStatusValue == value>selected="selected" 317 | 318 | 319 | <#-- 320 | * contains 321 | * 322 | * Macro to return true if the list contains the scalar, false if not. 323 | * Surprisingly not a FreeMarker builtin. 324 | * This function is used internally but can be accessed by user code if required. 325 | * 326 | * @param list the list to search for the item 327 | * @param item the item to search for in the list 328 | * @return true if item is found in the list, false otherwise 329 | --> 330 | <#function contains list item> 331 | <#list list as nextInList> 332 | <#if nextInList == item><#return true> 333 | 334 | <#return false> 335 | 336 | 337 | <#-- 338 | * closeTag 339 | * 340 | * Simple macro to close an HTML tag that has no body with '>' or '/>', 341 | * depending on the value of a 'xhtmlCompliant' variable in the namespace 342 | * of this library. 343 | --> 344 | <#macro closeTag> 345 | <#if xhtmlCompliant?exists && xhtmlCompliant>/><#else>> 346 | 347 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/views/common/ftl/web.ftl: -------------------------------------------------------------------------------- 1 | <#ftl strip_whitespace=true> 2 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Binrui.Shopping 4 | 5 | 6 | webAppRootKey 7 | shopping.root 8 | 9 | 10 | 11 | contextConfigLocation 12 | classpath:application-context.xml,classpath*:spring/*Context.xml 13 | 14 | 15 | 16 | log4jConfigLocation 17 | classpath:log4j.properties 18 | 19 | 20 | 21 | log4jRefreshInterval 22 | 6000 23 | 24 | 25 | 26 | org.springframework.web.util.Log4jConfigListener 27 | 28 | 29 | 30 | org.springframework.web.util.IntrospectorCleanupListener 31 | 32 | 33 | 34 | org.springframework.web.context.ContextLoaderListener 35 | 36 | 37 | 38 | org.springframework.web.context.request.RequestContextListener 39 | 40 | 41 | 42 | 120 43 | 44 | 45 | 46 | index.html 47 | index.htm 48 | index.jsp 49 | default.html 50 | default.htm 51 | default.jsp 52 | 53 | -------------------------------------------------------------------------------- /WebRoot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Welcome to Binrui Shopping!

9 | 10 | -------------------------------------------------------------------------------- /WebRoot/themes/black/css/webfinal.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | body { 3 | background-color: #888; 4 | color: white; 5 | } -------------------------------------------------------------------------------- /WebRoot/themes/blue/css/webfinal.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | body { 3 | background-color: #DBF5FF; 4 | color: #007AAB; 5 | } -------------------------------------------------------------------------------- /WebRoot/themes/default/css/webfinal.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | body { 3 | background-color: white; 4 | color: black; 5 | } -------------------------------------------------------------------------------- /WebRoot/themes/green/css/webfinal.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; -------------------------------------------------------------------------------- /WebRoot/themes/red/css/webfinal.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; -------------------------------------------------------------------------------- /books/api/api_kuaidi100快递公司代码.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/books/api/api_kuaidi100快递公司代码.doc -------------------------------------------------------------------------------- /books/mybatis-3.3.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/books/mybatis-3.3.0.pdf -------------------------------------------------------------------------------- /books/spring-4.2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/books/spring-4.2.0.pdf -------------------------------------------------------------------------------- /books/web/Tomcat性能优化.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/books/web/Tomcat性能优化.txt -------------------------------------------------------------------------------- /books/web/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | #user nobody; 3 | worker_processes auto; 4 | 5 | error_log /home/wwwlogs/nginx_error.log crit; 6 | 7 | pid /usr/local/nginx/logs/nginx.pid; 8 | 9 | #error_log logs/error.log; 10 | #error_log logs/error.log notice; 11 | #error_log logs/error.log info; 12 | 13 | #pid logs/nginx.pid; 14 | 15 | 16 | events { 17 | use epoll; 18 | worker_connections 51200; 19 | multi_accept on; 20 | } 21 | 22 | 23 | http { 24 | include mime.types; 25 | default_type application/octet-stream; 26 | 27 | #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 28 | # '$status $body_bytes_sent "$http_referer" ' 29 | # '"$http_user_agent" "$http_x_forwarded_for"'; 30 | client_header_buffer_size 32k; 31 | large_client_header_buffers 4 32k; 32 | #access_log logs/access.log main; 33 | 34 | sendfile on; 35 | #tcp_nopush on; 36 | 37 | #keepalive_timeout 0; 38 | keepalive_timeout 65; 39 | 40 | #gzip on; 41 | #portal component 42 | upstream portal.dzzw.com{ 43 | server 10.110.1.113:9999; 44 | } 45 | 46 | 47 | #bsp component 48 | upstream bsp.dzzw.com{ 49 | server 10.110.1.113:8080; 50 | } 51 | 52 | #weibo component 53 | upstream weibo.dzzw.com{ 54 | server 10.110.1.113:9091; 55 | } 56 | #solr component 57 | upstream solr.dzzw.com{ 58 | server 10.110.1.113:9092; 59 | } 60 | 61 | #bpm component 62 | upstream bpm.dzzw.com{ 63 | server 10.110.1.112:8000; 64 | } 65 | #service component 66 | upstream service.dzzw.com{ 67 | server 10.110.1.112:8081; 68 | } 69 | #code component 70 | upstream code.dzzw.com{ 71 | server 10.110.1.112:8082; 72 | } 73 | #data component 74 | upstream data.dzzw.com{ 75 | server 10.110.1.112:8083; 76 | } 77 | #disk component 78 | upstream disk.dzzw.com{ 79 | server 10.110.1.112:8080; 80 | } 81 | 82 | #apps component 83 | upstream apps.dzzw.com{ 84 | server 10.110.1.115:8087; 85 | } 86 | #dubbo component 87 | upstream dubbo.dzzw.com{ 88 | server 10.110.1.115:8088; 89 | } 90 | #dbase component 91 | upstream dbase.dzzw.com{ 92 | server 10.110.1.115:8089; 93 | } 94 | #report component 95 | upstream report.dzzw.com{ 96 | server 10.110.1.115:80; 97 | } 98 | #timer component 99 | upstream timer.dzzw.com{ 100 | server 10.110.1.115:8090; 101 | } 102 | #message component 103 | upstream message.dzzw.com{ 104 | server 10.110.1.115:9090; 105 | } 106 | 107 | #form component 108 | upstream form.dzzw.com{ 109 | server 10.110.1.115:8080; 110 | } 111 | 112 | server { 113 | listen 80; 114 | server_name localhost; 115 | 116 | #charset koi8-r; 117 | 118 | #access_log logs/host.access.log main; 119 | 120 | location / { 121 | proxy_pass http://portal.dzzw.com/; 122 | proxy_set_header Host $host; 123 | proxy_set_header X-Real-IP $remote_addr; 124 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 125 | proxy_buffering off; 126 | client_max_body_size 100m; 127 | } 128 | 129 | #10.110.1.112 130 | location /bpm{ 131 | proxy_pass http://bpm.dzzw.com/bpm; 132 | proxy_redirect off; 133 | proxy_set_header Host $host; 134 | proxy_set_header X-Real-IP $remote_addr; 135 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 136 | proxy_buffering off; 137 | client_max_body_size 100m; 138 | #index index.html index.htm index.do; 139 | } 140 | 141 | location /service{ 142 | proxy_pass http://service.dzzw.com/service; 143 | proxy_redirect off; 144 | proxy_set_header Host $host; 145 | proxy_set_header X-Real-IP $remote_addr; 146 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 147 | proxy_buffering off; 148 | client_max_body_size 100m; 149 | #index index.html index.htm index.do; 150 | } 151 | 152 | location /code{ 153 | proxy_pass http://code.dzzw.com/code; 154 | proxy_redirect off; 155 | proxy_set_header Host $host; 156 | proxy_set_header X-Real-IP $remote_addr; 157 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 158 | proxy_buffering off; 159 | client_max_body_size 100m; 160 | #index index.html index.htm index.do; 161 | } 162 | 163 | location /data{ 164 | proxy_pass http://data.dzzw.com/data; 165 | proxy_redirect off; 166 | proxy_set_header Host $host; 167 | proxy_set_header X-Real-IP $remote_addr; 168 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 169 | proxy_buffering off; 170 | client_max_body_size 100m; 171 | #index index.html index.htm index.do; 172 | } 173 | 174 | location /WebDiskDemo{ 175 | proxy_pass http://disk.dzzw.com/WebDiskDemo; 176 | proxy_redirect off; 177 | proxy_set_header Host $host; 178 | proxy_set_header X-Real-IP $remote_addr; 179 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 180 | proxy_buffering off; 181 | client_max_body_size 100m; 182 | #index index.html index.htm index.do; 183 | } 184 | 185 | #10.110.1.113 186 | location /bsp{ 187 | proxy_pass http://bsp.dzzw.com/bsp; 188 | proxy_redirect off; 189 | proxy_set_header Host $host; 190 | proxy_set_header X-Real-IP $remote_addr; 191 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 192 | proxy_buffering off; 193 | client_max_body_size 100m; 194 | #index index.html index.htm index.do; 195 | } 196 | 197 | location /form{ 198 | proxy_pass http://form.dzzw.com/form; 199 | proxy_redirect off; 200 | proxy_set_header Host $host; 201 | proxy_set_header X-Real-IP $remote_addr; 202 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 203 | proxy_buffering off; 204 | client_max_body_size 100m; 205 | #index index.html index.htm index.do; 206 | } 207 | 208 | location /infoflow{ 209 | proxy_pass http://weibo.dzzw.com/infoflow; 210 | proxy_redirect off; 211 | proxy_set_header Host $host; 212 | proxy_set_header X-Real-IP $remote_addr; 213 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 214 | proxy_buffering off; 215 | client_max_body_size 100m; 216 | #index index.html index.htm index.do; 217 | } 218 | 219 | location /solr{ 220 | proxy_pass http://solr.dzzw.com/solr; 221 | proxy_redirect off; 222 | proxy_set_header Host $host; 223 | proxy_set_header X-Real-IP $remote_addr; 224 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 225 | proxy_buffering off; 226 | client_max_body_size 100m; 227 | #index index.html index.htm index.do; 228 | } 229 | 230 | #10.110.1.115 231 | location /apps{ 232 | proxy_pass http://apps.dzzw.com/apps; 233 | proxy_redirect off; 234 | proxy_set_header Host $host; 235 | proxy_set_header X-Real-IP $remote_addr; 236 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 237 | proxy_buffering off; 238 | client_max_body_size 100m; 239 | #index index.html index.htm index.do; 240 | } 241 | 242 | location /dubbo{ 243 | proxy_pass http://dubbo.dzzw.com/dubbo; 244 | proxy_redirect off; 245 | proxy_set_header Host $host; 246 | proxy_set_header X-Real-IP $remote_addr; 247 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 248 | proxy_buffering off; 249 | client_max_body_size 100m; 250 | #index index.html index.htm index.do; 251 | } 252 | 253 | location /dbase{ 254 | proxy_pass http://dbase.dzzw.com/dbase; 255 | proxy_redirect off; 256 | proxy_set_header Host $host; 257 | proxy_set_header X-Real-IP $remote_addr; 258 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 259 | proxy_buffering off; 260 | client_max_body_size 100m; 261 | #index index.html index.htm index.do; 262 | } 263 | 264 | location /report{ 265 | proxy_pass http://report.dzzw.com/report; 266 | proxy_redirect off; 267 | proxy_set_header Host $host; 268 | proxy_set_header X-Real-IP $remote_addr; 269 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 270 | proxy_buffering off; 271 | client_max_body_size 100m; 272 | #index index.html index.htm index.do; 273 | } 274 | 275 | location /timer{ 276 | proxy_pass http://timer.dzzw.com/timer; 277 | proxy_redirect off; 278 | proxy_set_header Host $host; 279 | proxy_set_header X-Real-IP $remote_addr; 280 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 281 | proxy_buffering off; 282 | client_max_body_size 100m; 283 | #index index.html index.htm index.do; 284 | } 285 | 286 | location /message{ 287 | proxy_pass http://message.dzzw.com/message; 288 | proxy_redirect off; 289 | proxy_set_header Host $host; 290 | proxy_set_header X-Real-IP $remote_addr; 291 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 292 | proxy_buffering off; 293 | client_max_body_size 100m; 294 | #index index.html index.htm index.do; 295 | } 296 | 297 | 298 | #error_page 404 /404.html; 299 | 300 | # redirect server error pages to the static page /50x.html 301 | # 302 | error_page 500 502 503 504 /50x.html; 303 | location = /50x.html { 304 | root html; 305 | } 306 | 307 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80 308 | # 309 | #location ~ \.php$ { 310 | # proxy_pass http://127.0.0.1; 311 | #} 312 | 313 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 314 | # 315 | #location ~ \.php$ { 316 | # root html; 317 | # fastcgi_pass 127.0.0.1:9000; 318 | # fastcgi_index index.php; 319 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 320 | # include fastcgi_params; 321 | #} 322 | 323 | # deny access to .htaccess files, if Apache's document root 324 | # concurs with nginx's one 325 | # 326 | #location ~ /\.ht { 327 | # deny all; 328 | #} 329 | } 330 | 331 | 332 | # another virtual host using mix of IP-, name-, and port-based configuration 333 | # 334 | #server { 335 | # listen 8000; 336 | # listen somename:8080; 337 | # server_name somename alias another.alias; 338 | 339 | # location / { 340 | # root html; 341 | # index index.html index.htm; 342 | # } 343 | #} 344 | 345 | 346 | # HTTPS server 347 | # 348 | #server { 349 | # listen 443 ssl; 350 | # server_name localhost; 351 | 352 | # ssl_certificate cert.pem; 353 | # ssl_certificate_key cert.key; 354 | 355 | # ssl_session_cache shared:SSL:1m; 356 | # ssl_session_timeout 5m; 357 | 358 | # ssl_ciphers HIGH:!aNULL:!MD5; 359 | # ssl_prefer_server_ciphers on; 360 | 361 | # location / { 362 | # root html; 363 | # index index.html index.htm; 364 | # } 365 | #} 366 | include vhost/*.conf; 367 | } 368 | -------------------------------------------------------------------------------- /books/web/server.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 41 | 46 | 47 | 48 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 69 | 70 | 84 | 85 | 86 | 92 | 97 | 102 | 103 | 104 | 105 | 106 | 107 | 112 | 113 | 116 | 117 | 118 | 121 | 124 | 125 | 127 | 128 | 132 | 134 | 135 | 136 | 138 | 139 | 141 | 144 | 145 | 148 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /build/classes/.gitignore: -------------------------------------------------------------------------------- 1 | /com/ 2 | /spring/ 3 | /config/ 4 | -------------------------------------------------------------------------------- /build/classes/app.properties: -------------------------------------------------------------------------------- 1 | app.name=\u5F6C\u777F\u519C\u5546\u5E73\u53F0 -------------------------------------------------------------------------------- /build/classes/cache/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /build/classes/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://127.0.0.1:3306/brshop?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true 3 | jdbc.username=root 4 | jdbc.password=root 5 | #connection pool settings 6 | # maxIdle\u662f\u6700\u5927\u7684\u7a7a\u95f2\u8fde\u63a5\u6570\uff0c\u8fd9\u91cc\u53d6\u503c\u4e3a20\uff0c\u8868\u793a\u5373\u4f7f\u6ca1\u6709\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u4f9d\u7136\u53ef\u4ee5\u4fdd\u630120\u4e2a\u7a7a\u95f2\u7684\u8fde\u63a5\uff0c\u5b83\u4eec\u4e0d\u4f1a\u88ab\u6e05\u9664\uff0c\u968f\u65f6\u5904\u4e8e\u5f85\u547d\u72b6\u6001 7 | jdbc.pool.maxIdle=20 8 | # maxActive\u662f\u6700\u5927\u6fc0\u6d3b\u8fde\u63a5\u6570\uff0c\u8fd9\u91cc\u53d6\u503c\u4e3a200\uff0c\u8868\u793a\u540c\u65f6\u6700\u591a\u6709200\u4e2a\u6570\u636e\u5e93\u8fde\u63a5 9 | jdbc.pool.maxActive=200 10 | # jdbc \u68c0\u9a8c\u7684SQL 11 | jdbc.ValidationQuery=select 1 12 | # \u8fc7\u6ee4\u5668\u8bbe\u7f6e 13 | jdbc.filters=stat 14 | jdbc.maxActive=20 15 | jdbc.initialSize=2 16 | jdbc.maxWait=60000 17 | jdbc.minIdle=5 18 | #maxIdle=15 19 | jdbc.timeBetweenEvictionRunsMillis=60000 20 | jdbc.minEvictableIdleTimeMillis=300000 21 | jdbc.validationQuery=SELECT 'x' from dual 22 | jdbc.testWhileIdle=true 23 | jdbc.testOnBorrow=false 24 | jdbc.testOnReturn=false 25 | #poolPreparedStatements=true 26 | jdbc.maxOpenPreparedStatements=20 27 | #\u5bf9\u4e8e\u957f\u65f6\u95f4\u4e0d\u4f7f\u7528\u7684\u8fde\u63a5\u5f3a\u5236\u5173\u95ed 28 | jdbc.removeAbandoned=true 29 | #\u8d85\u8fc730\u5206\u949f\u5f00\u59cb\u5173\u95ed\u7a7a\u95f2\u8fde\u63a5 30 | jdbc.removeAbandonedTimeout=1800 31 | #\u5c06\u5f53\u524d\u5173\u95ed\u52a8\u4f5c\u8bb0\u5f55\u5230\u65e5\u5fd7 32 | jdbc.logAbandoned=true -------------------------------------------------------------------------------- /build/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | #\u5b9a\u4e49\u6839\u65e5\u5fd7\u7ea7\u522b\u548c\u8f93\u51fa\u7aef(\u5b9a\u4e49\u4e86\u4e24\u4e2a\u8f93\u51fa\u7aef) 2 | log4j.rootLogger=ERROR,CONSOLE,BINRUI 3 | 4 | #\u5b9a\u4e49\u7b2c\u4e00\u4e2a\u8f93\u51fa\u7aef\uff0c\u8f93\u51fa\u5230\u63a7\u5236\u53f0 5 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 6 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.CONSOLE.layout.ConversionPattern=[BinRui] %d [%t] %-5p %c(%L) - %m%n 8 | 9 | #\u5b9a\u65f6\u7b2c\u4e8c\u4e2a\u8f93\u51fa\u7aef\uff0c\u8f93\u51fa\u5230\u6587\u4ef6,\u8be5\u6587\u4ef6\u6700\u5927\u7a7a\u95f4\u4e3a1000KB\uff0c\u8d85\u8fc71000KB\u540e\u81ea\u52a8\u5907\u4efd\uff0c\u751f\u6210\u65b0\u6587\u4ef6 10 | log4j.appender.BINRUI=org.apache.log4j.RollingFileAppender 11 | log4j.appender.BINRUI.file=orclight.log 12 | log4j.appender.BINRUI.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.BINRUI.layout.conversionPattern=%d [%t] %-5p %c(%L) - %m%n 14 | log4j.appender.BINRUI.MaxFileSize=5120KB 15 | log4j.appender.BINRUI.MaxBackupIndex=10 16 | 17 | #\u5b9a\u4e49\u5177\u4f53\u67d0\u4e2a\u5305\u4e0b\u7684\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b 18 | log4j.logger.com.binrui.shop=WARN 19 | log4j.logger.com.binrui.shop.home=INFO 20 | log4j.logger.org.springframework=ERROR,BINRUI 21 | log4j.logger.org.mybatis=ERROR,BINRUI 22 | log4j.logger.org.springframework.jdbc.support=INFO 23 | log4j.logger.org.springframework.scheduling=INFO 24 | #\u5b9a\u4e49sql\u8bed\u53e5\u7684\u8f93\u51fa\u7ea7\u522b 25 | log4j.logger.java.sql.Connection=DEBUG 26 | 27 | 28 | #log4j.appender.file=org.apache.log4j.DailyRollingFileAppender 29 | #log4j.appender.file.File=logs/shopxx.log 30 | #log4j.appender.file.File.DatePattern=.yyyy-MM-dd 31 | #log4j.appender.file.layout=org.apache.log4j.PatternLayout 32 | #log4j.appender.file.layout.ConversionPattern=[BinRUI++] %p [%t] %C.%M(%L) | %m%n 33 | -------------------------------------------------------------------------------- /build/classes/mybatis/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /build/classes/theme/black.properties: -------------------------------------------------------------------------------- 1 | theme=theme/black/css/webfinal.css -------------------------------------------------------------------------------- /build/classes/theme/blue.properties: -------------------------------------------------------------------------------- 1 | theme=theme/blue/css/webfinal.css -------------------------------------------------------------------------------- /build/classes/theme/default.properties: -------------------------------------------------------------------------------- 1 | theme=theme/default/css/webfinal.css -------------------------------------------------------------------------------- /build/classes/theme/green.properties: -------------------------------------------------------------------------------- 1 | theme=theme/green/css/webfinal.css -------------------------------------------------------------------------------- /build/classes/theme/orange.properties: -------------------------------------------------------------------------------- 1 | theme=theme/orange/css/webfinal.css -------------------------------------------------------------------------------- /build/classes/theme/red.properties: -------------------------------------------------------------------------------- 1 | theme=theme/red/css/webfinal.css -------------------------------------------------------------------------------- /resource/cache/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /resource/cache/ehcache.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | -------------------------------------------------------------------------------- /resource/config/express.properties: -------------------------------------------------------------------------------- 1 | #\u5feb\u9012100\u67e5\u8be2\u63a5\u53e3 2 | -------------------------------------------------------------------------------- /resource/config/freemarker.properties: -------------------------------------------------------------------------------- 1 | tag_syntax=auto_detect 2 | template_update_delay=2 3 | default_encoding=UTF-8 4 | output_encoding=UTF-8 5 | locale=zh_CN 6 | number_format=0.## 7 | date_format=yyyy-MM-dd 8 | time_format=HH\:mm\:ss 9 | datetime_format=yyyy-MM-dd HH\:mm\:ss 10 | classic_compatible=true 11 | #ignore,debug,html_debug,rethrow 12 | template_exception_handler=com.inspur.mng.core.error.FreemarkerException -------------------------------------------------------------------------------- /resource/mybatis/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resource/spring/applicationContext-mail.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | -------------------------------------------------------------------------------- /resource/spring/applicationContext-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | auto_detect 79 | 2 80 | UTF-8 81 | UTF-8 82 | zh_CN 83 | 0.## 84 | yyyy-MM-dd 85 | HH:mm:ss 86 | yyyy-MM-dd HH:mm:ss 87 | true 88 | 89 | /common/ftl/spring.ftl as webfinal,/common/ftl/web.ftl as website 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 109 | 110 | 111 | /WEB-INF/locale/common/message 112 | /WEB-INF/locale/console/message 113 | /WEB-INF/locale/website/message 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | common/error 158 | common/error 159 | 160 | 161 | 162 | 163 | 500 164 | 404 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /resource/spring/applicationContext-shiro.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | /admin/logout.jsp = logout 19 | /admin/common/captcha.jhtml = anon 20 | 21 | /admin/product/** = perms["admin:product"] 22 | /admin/product_category/** = perms["admin:productCategory"] 23 | /admin/parameter_group/** = perms["admin:parameterGroup"] 24 | /admin/attribute/** = perms["admin:attribute"] 25 | /admin/specification/** = perms["admin:specification"] 26 | /admin/brand/** = perms["admin:brand"] 27 | /admin/product_notify/** = perms["admin:productNotify"] 28 | 29 | /admin/order/** = perms["admin:order"] 30 | /admin/print/** = perms["admin:print"] 31 | /admin/payment/** = perms["admin:payment"] 32 | /admin/refunds/** = perms["admin:refunds"] 33 | /admin/shipping/** = perms["admin:shipping"] 34 | /admin/returns/** = perms["admin:returns"] 35 | /admin/delivery_center/** = perms["admin:deliveryCenter"] 36 | /admin/delivery_template/** = perms["admin:deliveryTemplate"] 37 | 38 | /admin/member/** = perms["admin:member"] 39 | /admin/member_rank/** = perms["admin:memberRank"] 40 | /admin/member_attribute/** = perms["admin:memberAttribute"] 41 | /admin/review/** = perms["admin:review"] 42 | /admin/consultation/** = perms["admin:consultation"] 43 | 44 | /admin/navigation/** = perms["admin:navigation"] 45 | /admin/article/** = perms["admin:article"] 46 | /admin/article_category/** = perms["admin:articleCategory"] 47 | /admin/tag/** = perms["admin:tag"] 48 | /admin/friend_link/** = perms["admin:friendLink"] 49 | /admin/ad_position/** = perms["admin:adPosition"] 50 | /admin/ad/** = perms["admin:ad"] 51 | /admin/template/** = perms["admin:template"] 52 | /admin/cache/** = perms["admin:cache"] 53 | /admin/static/** = perms["admin:static"] 54 | /admin/index/** = perms["admin:index"] 55 | 56 | /admin/promotion/** = perms["admin:promotion"] 57 | /admin/coupon/** = perms["admin:coupon"] 58 | /admin/seo/** = perms["admin:seo"] 59 | /admin/sitemap/** = perms["admin:sitemap"] 60 | 61 | /admin/statistics/** = perms["admin:statistics"] 62 | /admin/sales/** = perms["admin:sales"] 63 | /admin/sales_ranking/** = perms["admin:salesRanking"] 64 | /admin/purchase_ranking/** = perms["admin:purchaseRanking"] 65 | /admin/deposit/** = perms["admin:deposit"] 66 | 67 | /admin/setting/** = perms["admin:setting"] 68 | /admin/area/** = perms["admin:area"] 69 | /admin/payment_method/** = perms["admin:paymentMethod"] 70 | /admin/shipping_method/** = perms["admin:shippingMethod"] 71 | /admin/delivery_corp/** = perms["admin:deliveryCorp"] 72 | /admin/payment_plugin/** = perms["admin:paymentPlugin"] 73 | /admin/storage_plugin/** = perms["admin:storagePlugin"] 74 | /admin/admin/** = perms["admin:admin"] 75 | /admin/role/** = perms["admin:role"] 76 | /admin/message/** = perms["admin:message"] 77 | /admin/log/** = perms["admin:log"] 78 | 79 | /admin/** = authc 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /resource/spring/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | Spring公共配置 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 110 | -------------------------------------------------------------------------------- /resource/theme/black.properties: -------------------------------------------------------------------------------- 1 | theme=theme/black/css/webfinal.css -------------------------------------------------------------------------------- /resource/theme/blue.properties: -------------------------------------------------------------------------------- 1 | theme=theme/blue/css/webfinal.css -------------------------------------------------------------------------------- /resource/theme/default.properties: -------------------------------------------------------------------------------- 1 | theme=theme/default/css/webfinal.css -------------------------------------------------------------------------------- /resource/theme/green.properties: -------------------------------------------------------------------------------- 1 | theme=theme/green/css/webfinal.css -------------------------------------------------------------------------------- /resource/theme/orange.properties: -------------------------------------------------------------------------------- 1 | theme=theme/orange/css/webfinal.css -------------------------------------------------------------------------------- /resource/theme/red.properties: -------------------------------------------------------------------------------- 1 | theme=theme/red/css/webfinal.css -------------------------------------------------------------------------------- /src/app.properties: -------------------------------------------------------------------------------- 1 | app.name=\u5F6C\u777F\u519C\u5546\u5E73\u53F0 -------------------------------------------------------------------------------- /src/com/binrui/shop/express/action/ExpressController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/express/action/ExpressController.java -------------------------------------------------------------------------------- /src/com/binrui/shop/express/service/ExpressService.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/express/service/ExpressService.java -------------------------------------------------------------------------------- /src/com/binrui/shop/home/action/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.home.action; 2 | 3 | import org.apache.log4j.Logger; 4 | import org.springframework.mobile.device.site.SitePreference; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | /** 9 | * Home Page 10 | * @author lijinfeng 11 | * @version 1.0 12 | * @date 2015-08-02 16:22 13 | * @title This is home page 14 | */ 15 | @Controller 16 | public class HomeController { 17 | /** 18 | * log4j 19 | */ 20 | private static final Logger logger = Logger.getLogger(HomeController.class); 21 | 22 | @RequestMapping("/") 23 | public String home(SitePreference sitePreference, Model model) { 24 | if (sitePreference == SitePreference.NORMAL) { 25 | logger.info("Site preference is normal"); 26 | return "home"; 27 | } else if (sitePreference == SitePreference.MOBILE) { 28 | logger.info("Site preference is mobile"); 29 | return "home-mobile"; 30 | } else if (sitePreference == SitePreference.TABLET) { 31 | logger.info("Site preference is tablet"); 32 | return "home-tablet"; 33 | } else { 34 | logger.info("no site preference"); 35 | return "home"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/binrui/shop/order/action/OrderController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/order/action/OrderController.java -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/action/AlipayController.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.action; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.sql.SQLException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.ArrayList; 8 | import java.util.Date; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.context.annotation.PropertySource; 18 | import org.springframework.core.env.Environment; 19 | import org.springframework.mobile.device.Device; 20 | import org.springframework.stereotype.Controller; 21 | import org.springframework.ui.Model; 22 | import org.springframework.util.StringUtils; 23 | import org.springframework.validation.BindingResult; 24 | import org.springframework.web.bind.annotation.ModelAttribute; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RequestMethod; 27 | 28 | import com.binrui.shop.pay.alipay.config.AlipayConfig; 29 | import com.binrui.shop.pay.alipay.util.AlipayNotify; 30 | import com.binrui.shop.pay.alipay.util.AlipaySubmit; 31 | /** 32 | @Controller("AlipayController") 33 | @RequestMapping("/") 34 | @PropertySource("classpath:system.properties") 35 | public class AlipayController { 36 | 37 | @Autowired 38 | CartService cartService; 39 | 40 | @Autowired 41 | AlipayService alipayService; 42 | 43 | @Autowired 44 | private Environment env; 45 | 46 | @RequestMapping(value = "alipaySubmit", method = RequestMethod.POST) 47 | public String executeAlipaySubmit(Model model, HttpSession session, @Valid @ModelAttribute("alipayForm") AlipayForm alipayForm, BindingResult results, Device device) throws SQLException { 48 | GoodsForm goodsForm=new GoodsForm(); 49 | goodsForm.setType("粮食"); 50 | model.addAttribute("goodsForm", goodsForm); 51 | log.info("修改购物车信息为已付款"); 52 | UVO uvo = (UVO)session.getAttribute("UVO"); 53 | if (uvo == null || StringUtils.isEmpty(uvo.getGuestId())) { 54 | return "redirect:/initGuestLogin"; 55 | } 56 | alipayForm.setUpdateUser(uvo.getGuestName()); 57 | Date date = new Date(); 58 | SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 59 | alipayForm.setUpdateTime(dateformat.format(date)); 60 | alipayForm.setGuestId(uvo.getGuestId()); 61 | boolean hisResult = cartService.addAlipayHistory(alipayForm); 62 | if(!hisResult) { 63 | throw new SQLException("添加支付宝账单失败!"); 64 | } 65 | CartForm cartForm = new CartForm(); 66 | cartForm.setUpdateUser(uvo.getGuestName()); 67 | cartForm.setUpdateTime(dateformat.format(date)); 68 | cartForm.setGuestId(uvo.getGuestId()); 69 | boolean result = cartService.editCartStatus(cartForm); 70 | if(!result) { 71 | throw new SQLException("修改购物车信息失败!"); 72 | } 73 | if(device.isNormal()) { 74 | model.addAttribute("sHtmlText", alipayRequestWeb(alipayForm)); 75 | } else { 76 | model.addAttribute("sHtmlText", alipayRequestMobile(alipayForm)); 77 | } 78 | return "manager/charge/alipay"; 79 | } 80 | 81 | @RequestMapping(value = "replayAlipaySubmit", method = RequestMethod.POST) 82 | public String executeReplayAlipaySubmit(Model model, HttpSession session, @Valid @ModelAttribute("alipayForm") AlipayForm alipayForm, BindingResult results, Device device) throws SQLException { 83 | GoodsForm goodsForm = new GoodsForm(); 84 | goodsForm.setType("粮食"); 85 | model.addAttribute("goodsForm", goodsForm); 86 | log.info("重新向支付宝发起支付请求。"); 87 | if (device.isNormal()) { 88 | model.addAttribute("sHtmlText", alipayRequestWeb(alipayForm)); 89 | } else { 90 | model.addAttribute("sHtmlText", alipayRequestMobile(alipayForm)); 91 | } 92 | return "manager/charge/alipay"; 93 | } 94 | 95 | @RequestMapping(value = "initDistributorAlipayComfirm", method = RequestMethod.GET) 96 | public String initDistributorAlipayComfirm(Model model,HttpSession session, AlipayForm alipayForm) { 97 | log.info("由分销商直接推荐的商品销售页面初始化。"); 98 | List cartList = new ArrayList<>(); 99 | model.addAttribute("cartList", cartList); 100 | GoodsForm goodsForm = new GoodsForm(); 101 | goodsForm.setType("粮食"); 102 | model.addAttribute("goodsForm", goodsForm); 103 | UVO uvo = new UVO(); 104 | session.setAttribute("UVO", uvo); 105 | model.addAttribute("alipayForm", alipayService.searchAlipay(alipayForm)); 106 | return "mobile/alipay/distributorAlipayConfirm"; 107 | } 108 | 109 | @RequestMapping(value = "distributorAlipaySubmit", method = RequestMethod.POST) 110 | public String executeDistributorAlipaySubmit(Model model,@Valid @ModelAttribute("alipayForm") AlipayForm alipayForm, BindingResult results) throws SQLException { 111 | log.info("由分销商直接推荐的商品向支付宝发起支付请求。"); 112 | GoodsForm goodsForm = new GoodsForm(); 113 | goodsForm.setType("粮食"); 114 | model.addAttribute("goodsForm", goodsForm); 115 | if (results.hasErrors()) { 116 | log.info("内容验证出错"); 117 | model.addAttribute("message", "该画面所有项目都是必填项,请认真填写!"); 118 | model.addAttribute("alipayForm", alipayService.searchAlipay(alipayForm)); 119 | return "mobile/alipay/distributorAlipayConfirm"; 120 | } 121 | alipayForm.setUpdateUser(alipayForm.getGuestId()); 122 | Date date = new Date(); 123 | SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 124 | alipayForm.setUpdateTime(dateformat.format(date)); 125 | boolean hisResult = cartService.addAlipayHistory(alipayForm); 126 | if(!hisResult) { 127 | throw new SQLException("添加支付宝账单失败!"); 128 | } 129 | alipayForm.setCount("1"); 130 | boolean result = alipayService.editStock(alipayForm); 131 | if(!result) { 132 | model.addAttribute("message", "该商品为促销打折商品,目前已经卖完了,请关注我们下次活动,谢谢您的参与!"); 133 | model.addAttribute("alipayForm", alipayService.searchAlipay(alipayForm)); 134 | return "mobile/alipay/distributorAlipayConfirm"; 135 | } 136 | model.addAttribute("sHtmlText", alipayRequestMobile(alipayForm)); 137 | return "manager/charge/alipay"; 138 | } 139 | 140 | @RequestMapping(value = "guestAlipaySubmit", method = RequestMethod.POST) 141 | public String executeGuestAlipaySubmit(Device device, Model model, @Valid @ModelAttribute("alipayForm") AlipayForm alipayForm, BindingResult results) throws SQLException { 142 | log.info("由匿名用户购买商品向支付宝发起支付请求。"); 143 | List cartList = new ArrayList<>(); 144 | model.addAttribute("cartList", cartList); 145 | GoodsForm goodsForm = new GoodsForm(); 146 | goodsForm.setType("粮食"); 147 | model.addAttribute("goodsForm", goodsForm); 148 | if (results.hasErrors()) { 149 | log.info("内容验证出错"); 150 | model.addAttribute("message", "该画面所有项目都是必填项,请认真填写!"); 151 | CartForm cartForm = new CartForm(); 152 | cartForm.setCommodityId(alipayForm.getCommodityId()); 153 | cartForm.setGuestId(alipayForm.getGuestId()); 154 | cartForm.setCount(alipayForm.getCount()); 155 | model.addAttribute("alipayForm", cartService.searchAlipay(cartForm)); 156 | if (device.isNormal()) { 157 | 158 | return "shop/alipay/guestAlipayConfirm"; 159 | } else { 160 | return "mobile/alipay/guestAlipayConfirm"; 161 | } 162 | } 163 | 164 | alipayForm.setUpdateUser(alipayForm.getGuestId()); 165 | Date date = new Date(); 166 | SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 167 | alipayForm.setUpdateTime(dateformat.format(date)); 168 | String tempCommodityId = alipayForm.getCommodityId(); 169 | alipayForm.setCommodityId(null); 170 | boolean hisResult = cartService.addAlipayHistory(alipayForm); 171 | if(!hisResult) { 172 | throw new SQLException("添加支付宝账单失败!"); 173 | } 174 | alipayForm.setCommodityId(tempCommodityId); 175 | boolean result = alipayService.editStock(alipayForm); 176 | if(!result) { 177 | model.addAttribute("message", "该商品刚刚被卖完了!"); 178 | model.addAttribute("alipayForm", alipayService.searchAlipay(alipayForm)); 179 | if (device.isNormal()) { 180 | return "shop/alipay/guestAlipayConfirm"; 181 | } else { 182 | return "mobile/alipay/guestAlipayConfirm"; 183 | } 184 | } 185 | if (device.isNormal()) { 186 | model.addAttribute("sHtmlText", alipayRequestWeb(alipayForm)); 187 | } else { 188 | model.addAttribute("sHtmlText", alipayRequestMobile(alipayForm)); 189 | } 190 | return "manager/charge/alipay"; 191 | } 192 | 193 | private String alipayRequestWeb(AlipayForm alipayForm) { 194 | // 支付类型 195 | String payment_type = "1"; 196 | // 必填,不能修改 197 | // 服务器异步通知页面路径 198 | String host = env.getProperty("host.web"); 199 | String notify_url = host + "/initReturn"; 200 | // 需http://格式的完整路径,不能加?id=123这类自定义参数 201 | 202 | // 页面跳转同步通知页面路径 203 | String return_url = host + "/initPayResult"; 204 | 205 | // 需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/ 206 | 207 | // 商户订单号 208 | String out_trade_no = alipayForm.getOutTradeNo(); 209 | // 订单名称 210 | String subject = alipayForm.getSubject(); 211 | // 付款金额 212 | String total_fee = alipayForm.getPrice(); 213 | 214 | // 订单描述 215 | String body = alipayForm.getBody(); 216 | 217 | // 商品展示地址 218 | String show_url = alipayForm.getShowUrl(); 219 | // 需以http://开头的完整路径,如:http://www.商户网站.com/myorder.html 220 | 221 | //防钓鱼时间戳 222 | String anti_phishing_key = ""; 223 | //若要使用请调用类文件submit中的query_timestamp函数 224 | 225 | //客户端的IP地址 226 | String exter_invoke_ip = ""; 227 | //非局域网的外网IP地址,如:221.0.0.1 228 | 229 | // 收货人姓名 230 | String receive_name = alipayForm.getReceiveName(); 231 | // 收货人地址 232 | String receive_address = alipayForm.getReceiveAddress(); 233 | // 收货人邮编 234 | String receive_zip = alipayForm.getReceiveZip(); 235 | // 收货人电话号码 236 | String receive_phone = alipayForm.getReceivePhone(); 237 | // 收货人手机号码 238 | String receive_mobile = alipayForm.getReceiveMobile(); 239 | 240 | body = body + ";" + receive_name + ";" + receive_address + ";" + receive_zip + ";" + receive_phone + ";" + receive_mobile; 241 | 242 | Map sParaTemp = new HashMap(); 243 | sParaTemp.put("service", "create_direct_pay_by_user"); 244 | sParaTemp.put("partner", AlipayConfig.partner); 245 | sParaTemp.put("seller_email", AlipayConfig.seller_email); 246 | sParaTemp.put("_input_charset", AlipayConfig.input_charset); 247 | sParaTemp.put("payment_type", payment_type); 248 | sParaTemp.put("notify_url", notify_url); 249 | sParaTemp.put("return_url", return_url); 250 | sParaTemp.put("out_trade_no", out_trade_no); 251 | sParaTemp.put("subject", subject); 252 | sParaTemp.put("total_fee", total_fee); 253 | sParaTemp.put("body", body); 254 | sParaTemp.put("show_url", show_url); 255 | sParaTemp.put("anti_phishing_key", anti_phishing_key); 256 | sParaTemp.put("exter_invoke_ip", exter_invoke_ip); 257 | 258 | String sHtmlText = AlipaySubmit.buildRequest(sParaTemp, "get", "确认"); 259 | return sHtmlText; 260 | } 261 | 262 | private String alipayRequestMobile(AlipayForm alipayForm) { 263 | // 支付类型 264 | String payment_type = "1"; 265 | // 必填,不能修改 266 | // 服务器异步通知页面路径 267 | String host = env.getProperty("host.mobile"); 268 | String notify_url = host + "/initReturn"; 269 | // 需http://格式的完整路径,不能加?id=123这类自定义参数 270 | 271 | // 页面跳转同步通知页面路径 272 | String return_url = host + "/initPayResult"; 273 | 274 | // 需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/ 275 | 276 | // 商户订单号 277 | String out_trade_no = alipayForm.getOutTradeNo(); 278 | // 订单名称 279 | String subject = alipayForm.getSubject(); 280 | // 付款金额 281 | String total_fee = alipayForm.getPrice(); 282 | 283 | // 订单描述 284 | String body = alipayForm.getBody(); 285 | 286 | // 商品展示地址 287 | String show_url = alipayForm.getShowUrl(); 288 | // 需以http://开头的完整路径,如:http://www.商户网站.com/myorder.html 289 | 290 | //超时时间 291 | String it_b_pay = ""; 292 | //选填 293 | 294 | //钱包token 295 | String extern_token = ""; 296 | //选填 297 | 298 | // 收货人姓名 299 | String receive_name = alipayForm.getReceiveName(); 300 | // 收货人地址 301 | String receive_address = alipayForm.getReceiveAddress(); 302 | // 收货人邮编 303 | String receive_zip = alipayForm.getReceiveZip(); 304 | // 收货人电话号码 305 | String receive_phone = alipayForm.getReceivePhone(); 306 | // 收货人手机号码 307 | String receive_mobile = alipayForm.getReceiveMobile(); 308 | 309 | body = body + ";" + receive_name + ";" + receive_address + ";" + receive_zip + ";" + receive_phone + ";" + receive_mobile; 310 | 311 | Map sParaTemp = new HashMap(); 312 | sParaTemp.put("service", "alipay.wap.create.direct.pay.by.user"); 313 | sParaTemp.put("partner", AlipayConfig.partner); 314 | sParaTemp.put("seller_id", AlipayConfig.seller_id); 315 | sParaTemp.put("_input_charset", AlipayConfig.input_charset); 316 | sParaTemp.put("payment_type", payment_type); 317 | sParaTemp.put("notify_url", notify_url); 318 | sParaTemp.put("return_url", return_url); 319 | sParaTemp.put("out_trade_no", out_trade_no); 320 | sParaTemp.put("subject", subject); 321 | sParaTemp.put("total_fee", total_fee); 322 | sParaTemp.put("show_url", show_url); 323 | sParaTemp.put("body", body); 324 | sParaTemp.put("it_b_pay", it_b_pay); 325 | sParaTemp.put("extern_token", extern_token); 326 | 327 | String sHtmlText = AlipaySubmit.buildRequest(sParaTemp, "get", "确认"); 328 | return sHtmlText; 329 | } 330 | 331 | @RequestMapping(value = "initReturn", method = RequestMethod.POST) 332 | public void executeInitReturn(Model model, ReturnForm returnForm, HttpServletResponse response) throws SQLException, IOException { 333 | log.info("这是一个支付宝主动调用商家网站信息的日志"); 334 | log.info(returnForm.getOut_trade_no()); 335 | log.info(returnForm.getTrade_no()); 336 | log.info(returnForm.getTrade_status()); 337 | log.info(returnForm.getOut_trade_no()); 338 | log.info(returnForm.getTrade_no()); 339 | log.info(returnForm.getTrade_status()); 340 | log.info(returnForm.getNotify_id()); 341 | log.info(returnForm.getSign()); 342 | log.info("sign_type:" + returnForm.getSign_type()); 343 | Map params = new HashMap(); 344 | params.put("out_trade_no", returnForm.getOut_trade_no()); 345 | params.put("trade_no", returnForm.getTrade_no()); 346 | params.put("trade_status", returnForm.getTrade_status()); 347 | params.put("notify_id", returnForm.getNotify_id()); 348 | params.put("sign", returnForm.getSign()); 349 | params.put("sign_type", returnForm.getSign_type()); 350 | params.put("discount", returnForm.getDiscount()); 351 | params.put("payment_type", returnForm.getPayment_type()); 352 | params.put("subject", returnForm.getSubject()); 353 | params.put("buyer_email", returnForm.getBuyer_email()); 354 | params.put("gmt_create", returnForm.getGmt_create()); 355 | params.put("notify_type", returnForm.getNotify_type()); 356 | params.put("quantity", returnForm.getQuantity()); 357 | params.put("seller_id", returnForm.getSeller_id()); 358 | params.put("notify_time", returnForm.getNotify_time()); 359 | params.put("body", returnForm.getBody()); 360 | params.put("is_total_fee_adjust", returnForm.getIs_total_fee_adjust()); 361 | params.put("total_fee", returnForm.getTotal_fee()); 362 | params.put("gmt_payment", returnForm.getGmt_payment()); 363 | params.put("seller_email", returnForm.getSeller_email()); 364 | params.put("price", returnForm.getPrice()); 365 | params.put("buyer_id", returnForm.getBuyer_id()); 366 | params.put("use_coupon", returnForm.getUse_coupon()); 367 | PrintWriter out=response.getWriter(); 368 | if(AlipayNotify.verify(params)){ 369 | out.print("success"); 370 | log.info("success"); 371 | boolean result = alipayService.editPayment(returnForm); 372 | if (!result) { 373 | throw new SQLException("付款标记修改失败!"); 374 | } 375 | } else { 376 | out.print("fail"); 377 | log.info("fail"); 378 | } 379 | } 380 | 381 | @RequestMapping(value = "initPayResult", method = RequestMethod.GET) 382 | public String initPayResult(Model model, Device device) { 383 | log.info("支付宝处理完毕后返回商户网站"); 384 | if (device.isNormal()) { 385 | return "shop/alipay/payResult"; 386 | } else { 387 | return "mobile/alipay/payResult"; 388 | } 389 | } 390 | }**/ 391 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/action/AlipayReportController.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.action; 2 | 3 | import java.sql.SQLException; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | /** 11 | * 12 | * @author lijinfeng 13 | * 14 | */ 15 | /** 16 | @Controller("AlipayReportController") 17 | @RequestMapping("/alipay") 18 | public class AlipayReportController { 19 | 20 | @Autowired 21 | AlipayReportService alipayReportService; 22 | 23 | @RequestMapping(value = "initAlipayReport", method = RequestMethod.GET) 24 | public String initAlipayReport(Model model) { 25 | log.info("检索支付宝账单列表"); 26 | model.addAttribute("list", alipayReportService.searchAlipayReportList()); 27 | return "manager/report/alipayReportList"; 28 | } 29 | 30 | @RequestMapping(value = "delAlipayReport", method = RequestMethod.GET) 31 | public String initAlipayReport(Model model, AlipayReportForm alipayReportForm) throws SQLException { 32 | log.info("删除作废的支付宝账单"); 33 | boolean result = alipayReportService.delAlipayReport(alipayReportForm); 34 | if (!result) { 35 | throw new SQLException("删除作废的支付宝账单失败!"); 36 | } 37 | model.addAttribute("list", alipayReportService.searchAlipayReportList()); 38 | return "manager/report/alipayReportList"; 39 | } 40 | } 41 | **/ -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/config/AlipayConfig.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.config; 2 | 3 | /** 4 | *类名:AlipayConfig 5 | *功能:基础配置类 6 | *详细:设置帐户有关信息及返回路径 7 | *版本:3.3 8 | *日期:2012-08-10 9 | *说明: 10 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 11 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 12 | *提示:如何获取安全校验码和合作身份者ID 13 | *1.用您的签约支付宝账号登录支付宝网站(www.alipay.com) 14 | *2.点击“商家服务”(https://b.alipay.com/order/myOrder.htm) 15 | *3.点击“查询合作者身份(PID)”、“查询安全校验码(Key)” 16 | *安全校验码查看时,输入支付密码后,页面呈灰色的现象,怎么办? 17 | *解决方法: 18 | *1、检查浏览器配置,不让浏览器做弹框屏蔽设置 19 | *2、更换浏览器或电脑,重新登录查询。 20 | */ 21 | public class AlipayConfig { 22 | 23 | //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 24 | // 合作身份者ID,以2088开头由16位纯数字组成的字符串 25 | public static String partner = ""; 26 | 27 | public static String seller_id = partner; 28 | 29 | // 收款支付宝账号 30 | public static String seller_email = "kain80817@163.com"; 31 | // 商户的私钥 32 | public static String key = ""; 33 | 34 | // 商户的私钥RSA 35 | public static String private_key = ""; 36 | 37 | 38 | // 支付宝的公钥,无需修改该值 39 | public static String ali_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB"; 40 | 41 | 42 | //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 43 | 44 | 45 | // 调试用,创建TXT日志文件夹路径 46 | public static String log_path = "D:\\"; 47 | 48 | // 字符编码格式 目前支持 gbk 或 utf-8 49 | public static String input_charset = "utf-8"; 50 | 51 | // 签名方式 不需修改 52 | public static String sign_type = "RSA"; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/dao/AlipayDao.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.dao; 2 | 3 | public class AlipayDao { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/service/AlipayReportService.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | @Service 10 | public class AlipayReportService { 11 | 12 | @Autowired 13 | QueryDAO queryDao; 14 | 15 | @Autowired 16 | UpdateDAO updateDao; 17 | 18 | public List searchAlipayReportList() { 19 | List result = queryDao.executeForObjectList("AlipayReport.selectAlipayReportList", null); 20 | return result; 21 | } 22 | 23 | public boolean delAlipayReport(AlipayReportForm frm) { 24 | 25 | int result = updateDao.execute("AlipayReport.deleteAlipayReport", frm); 26 | if (result == 1) { 27 | return true; 28 | } 29 | return false; 30 | } 31 | } 32 | **/ 33 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/service/AlipayService.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.service; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.annotation.PropertySource; 8 | import org.springframework.core.env.Environment; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.binrui.shop.pay.alipay.dao.AlipayDao; 12 | 13 | /** 14 | @Service 15 | @PropertySource("classpath:system.properties") 16 | public class AlipayService { 17 | 18 | @Autowired 19 | AlipayDao queryDao; 20 | 21 | 22 | @Autowired 23 | private Environment env; 24 | 25 | public AlipayForm searchAlipay(AlipayForm frm) { 26 | DistributorPriceForm distributorPriceForm = queryDao.executeForObject("Alipay.selectDistributorPrice", frm, DistributorPriceForm.class); 27 | AlipayForm alipayForm = new AlipayForm(); 28 | Date date = new Date(); 29 | SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss"); 30 | 31 | alipayForm.setOutTradeNo(distributorPriceForm.getDistributorId() + dateformat.format(date)); 32 | alipayForm.setSubject(distributorPriceForm.getDistributorId() +"推荐的商品订单"); 33 | Double price = Double.valueOf(distributorPriceForm.getRetailPrice()); 34 | // 不满88元加8元邮费 35 | if (price < 88) { 36 | price = price + 8; 37 | } 38 | alipayForm.setPrice(String.valueOf(price)); 39 | alipayForm.setBody(distributorPriceForm.getCommodityName()); 40 | String host = env.getProperty("host.mobile"); 41 | alipayForm.setShowUrl(host + "/initDistributorAlipayComfirm?distributorPriceId=" + distributorPriceForm.getDistributorPriceId()); 42 | //alipayForm.setShowUrl("http://localhost:8080/agriculture-mvc/initDistributorAlipayComfirm?distributorPriceId=" + distributorPriceForm.getDistributorPriceId()); 43 | alipayForm.setGuestId(distributorPriceForm.getDistributorId()); 44 | alipayForm.setCommodityId(distributorPriceForm.getCommodityId()); 45 | alipayForm.setDistributorName(distributorPriceForm.getDistributorName()); 46 | alipayForm.setDistributorPriceId(distributorPriceForm.getDistributorPriceId()); 47 | return alipayForm; 48 | } 49 | 50 | public boolean editStock(AlipayForm frm) { 51 | Integer stock = queryDao.executeForObject("Alipay.selectStock", frm, Integer.class); 52 | if (stock < Integer.valueOf(frm.getCount())) { 53 | return false; 54 | } 55 | int result = queryDao.execute("Alipay.editStock", frm); 56 | if (result == 1) { 57 | return true; 58 | } 59 | return false; 60 | } 61 | 62 | public boolean editPayment(ReturnForm frm) { 63 | if ("TRADE_SUCCESS".equals(frm.getTrade_status())) { 64 | int result = queryDao.execute("Alipay.editPayment", frm); 65 | if (result == 1) { 66 | return true; 67 | } 68 | } 69 | return false; 70 | } 71 | } 72 | **/ -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/sign/Base64.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The MobileSecurePay Project 3 | * All right reserved. 4 | * author: shiqun.shi@alipay.com 5 | */ 6 | 7 | package com.binrui.shop.pay.alipay.sign; 8 | 9 | public final class Base64 { 10 | 11 | static private final int BASELENGTH = 128; 12 | static private final int LOOKUPLENGTH = 64; 13 | static private final int TWENTYFOURBITGROUP = 24; 14 | static private final int EIGHTBIT = 8; 15 | static private final int SIXTEENBIT = 16; 16 | static private final int FOURBYTE = 4; 17 | static private final int SIGN = -128; 18 | static private final char PAD = '='; 19 | static private final boolean fDebug = false; 20 | static final private byte[] base64Alphabet = new byte[BASELENGTH]; 21 | static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; 22 | 23 | static { 24 | for (int i = 0; i < BASELENGTH; ++i) { 25 | base64Alphabet[i] = -1; 26 | } 27 | for (int i = 'Z'; i >= 'A'; i--) { 28 | base64Alphabet[i] = (byte) (i - 'A'); 29 | } 30 | for (int i = 'z'; i >= 'a'; i--) { 31 | base64Alphabet[i] = (byte) (i - 'a' + 26); 32 | } 33 | 34 | for (int i = '9'; i >= '0'; i--) { 35 | base64Alphabet[i] = (byte) (i - '0' + 52); 36 | } 37 | 38 | base64Alphabet['+'] = 62; 39 | base64Alphabet['/'] = 63; 40 | 41 | for (int i = 0; i <= 25; i++) { 42 | lookUpBase64Alphabet[i] = (char) ('A' + i); 43 | } 44 | 45 | for (int i = 26, j = 0; i <= 51; i++, j++) { 46 | lookUpBase64Alphabet[i] = (char) ('a' + j); 47 | } 48 | 49 | for (int i = 52, j = 0; i <= 61; i++, j++) { 50 | lookUpBase64Alphabet[i] = (char) ('0' + j); 51 | } 52 | lookUpBase64Alphabet[62] = (char) '+'; 53 | lookUpBase64Alphabet[63] = (char) '/'; 54 | 55 | } 56 | 57 | private static boolean isWhiteSpace(char octect) { 58 | return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); 59 | } 60 | 61 | private static boolean isPad(char octect) { 62 | return (octect == PAD); 63 | } 64 | 65 | private static boolean isData(char octect) { 66 | return (octect < BASELENGTH && base64Alphabet[octect] != -1); 67 | } 68 | 69 | /** 70 | * Encodes hex octects into Base64 71 | * 72 | * @param binaryData Array containing binaryData 73 | * @return Encoded Base64 array 74 | */ 75 | public static String encode(byte[] binaryData) { 76 | 77 | if (binaryData == null) { 78 | return null; 79 | } 80 | 81 | int lengthDataBits = binaryData.length * EIGHTBIT; 82 | if (lengthDataBits == 0) { 83 | return ""; 84 | } 85 | 86 | int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; 87 | int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; 88 | int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; 89 | char encodedData[] = null; 90 | 91 | encodedData = new char[numberQuartet * 4]; 92 | 93 | byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; 94 | 95 | int encodedIndex = 0; 96 | int dataIndex = 0; 97 | if (fDebug) { 98 | System.out.println("number of triplets = " + numberTriplets); 99 | } 100 | 101 | for (int i = 0; i < numberTriplets; i++) { 102 | b1 = binaryData[dataIndex++]; 103 | b2 = binaryData[dataIndex++]; 104 | b3 = binaryData[dataIndex++]; 105 | 106 | if (fDebug) { 107 | System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3); 108 | } 109 | 110 | l = (byte) (b2 & 0x0f); 111 | k = (byte) (b1 & 0x03); 112 | 113 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 114 | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); 115 | byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); 116 | 117 | if (fDebug) { 118 | System.out.println("val2 = " + val2); 119 | System.out.println("k4 = " + (k << 4)); 120 | System.out.println("vak = " + (val2 | (k << 4))); 121 | } 122 | 123 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 124 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; 125 | encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; 126 | encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; 127 | } 128 | 129 | // form integral number of 6-bit groups 130 | if (fewerThan24bits == EIGHTBIT) { 131 | b1 = binaryData[dataIndex]; 132 | k = (byte) (b1 & 0x03); 133 | if (fDebug) { 134 | System.out.println("b1=" + b1); 135 | System.out.println("b1<<2 = " + (b1 >> 2)); 136 | } 137 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 138 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 139 | encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; 140 | encodedData[encodedIndex++] = PAD; 141 | encodedData[encodedIndex++] = PAD; 142 | } else if (fewerThan24bits == SIXTEENBIT) { 143 | b1 = binaryData[dataIndex]; 144 | b2 = binaryData[dataIndex + 1]; 145 | l = (byte) (b2 & 0x0f); 146 | k = (byte) (b1 & 0x03); 147 | 148 | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); 149 | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); 150 | 151 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; 152 | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; 153 | encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; 154 | encodedData[encodedIndex++] = PAD; 155 | } 156 | 157 | return new String(encodedData); 158 | } 159 | 160 | /** 161 | * Decodes Base64 data into octects 162 | * 163 | * @param encoded string containing Base64 data 164 | * @return Array containind decoded data. 165 | */ 166 | public static byte[] decode(String encoded) { 167 | 168 | if (encoded == null) { 169 | return null; 170 | } 171 | 172 | char[] base64Data = encoded.toCharArray(); 173 | // remove white spaces 174 | int len = removeWhiteSpace(base64Data); 175 | 176 | if (len % FOURBYTE != 0) { 177 | return null;//should be divisible by four 178 | } 179 | 180 | int numberQuadruple = (len / FOURBYTE); 181 | 182 | if (numberQuadruple == 0) { 183 | return new byte[0]; 184 | } 185 | 186 | byte decodedData[] = null; 187 | byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; 188 | char d1 = 0, d2 = 0, d3 = 0, d4 = 0; 189 | 190 | int i = 0; 191 | int encodedIndex = 0; 192 | int dataIndex = 0; 193 | decodedData = new byte[(numberQuadruple) * 3]; 194 | 195 | for (; i < numberQuadruple - 1; i++) { 196 | 197 | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) 198 | || !isData((d3 = base64Data[dataIndex++])) 199 | || !isData((d4 = base64Data[dataIndex++]))) { 200 | return null; 201 | }//if found "no data" just return null 202 | 203 | b1 = base64Alphabet[d1]; 204 | b2 = base64Alphabet[d2]; 205 | b3 = base64Alphabet[d3]; 206 | b4 = base64Alphabet[d4]; 207 | 208 | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 209 | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 210 | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); 211 | } 212 | 213 | if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { 214 | return null;//if found "no data" just return null 215 | } 216 | 217 | b1 = base64Alphabet[d1]; 218 | b2 = base64Alphabet[d2]; 219 | 220 | d3 = base64Data[dataIndex++]; 221 | d4 = base64Data[dataIndex++]; 222 | if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters 223 | if (isPad(d3) && isPad(d4)) { 224 | if ((b2 & 0xf) != 0)//last 4 bits should be zero 225 | { 226 | return null; 227 | } 228 | byte[] tmp = new byte[i * 3 + 1]; 229 | System.arraycopy(decodedData, 0, tmp, 0, i * 3); 230 | tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); 231 | return tmp; 232 | } else if (!isPad(d3) && isPad(d4)) { 233 | b3 = base64Alphabet[d3]; 234 | if ((b3 & 0x3) != 0)//last 2 bits should be zero 235 | { 236 | return null; 237 | } 238 | byte[] tmp = new byte[i * 3 + 2]; 239 | System.arraycopy(decodedData, 0, tmp, 0, i * 3); 240 | tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 241 | tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 242 | return tmp; 243 | } else { 244 | return null; 245 | } 246 | } else { //No PAD e.g 3cQl 247 | b3 = base64Alphabet[d3]; 248 | b4 = base64Alphabet[d4]; 249 | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); 250 | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); 251 | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); 252 | 253 | } 254 | 255 | return decodedData; 256 | } 257 | 258 | /** 259 | * remove WhiteSpace from MIME containing encoded Base64 data. 260 | * 261 | * @param data the byte array of base64 data (with WS) 262 | * @return the new length 263 | */ 264 | private static int removeWhiteSpace(char[] data) { 265 | if (data == null) { 266 | return 0; 267 | } 268 | 269 | // count characters that's not whitespace 270 | int newSize = 0; 271 | int len = data.length; 272 | for (int i = 0; i < len; i++) { 273 | if (!isWhiteSpace(data[i])) { 274 | data[newSize++] = data[i]; 275 | } 276 | } 277 | return newSize; 278 | } 279 | } 280 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/sign/MD5.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.sign; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.security.SignatureException; 5 | import org.apache.commons.codec.digest.DigestUtils; 6 | 7 | /** 8 | * 功能:支付宝MD5签名处理核心文件,不需要修改 9 | * 版本:3.3 10 | * 修改日期:2012-08-17 11 | * 说明: 12 | * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 13 | * 该代码仅供学习和研究支付宝接口使用,只是提供一个 14 | * */ 15 | public class MD5 { 16 | 17 | /** 18 | * 签名字符串 19 | * @param text 需要签名的字符串 20 | * @param key 密钥 21 | * @param input_charset 编码格式 22 | * @return 签名结果 23 | */ 24 | public static String sign(String text, String key, String input_charset) { 25 | text = text + key; 26 | return DigestUtils.md5Hex(getContentBytes(text, input_charset)); 27 | } 28 | 29 | /** 30 | * 签名字符串 31 | * @param text 需要签名的字符串 32 | * @param sign 签名结果 33 | * @param key 密钥 34 | * @param input_charset 编码格式 35 | * @return 签名结果 36 | */ 37 | public static boolean verify(String text, String sign, String key, String input_charset) { 38 | text = text + key; 39 | String mysign = DigestUtils.md5Hex(getContentBytes(text, input_charset)); 40 | if(mysign.equals(sign)) { 41 | return true; 42 | } 43 | else { 44 | return false; 45 | } 46 | } 47 | 48 | /** 49 | * @param content 50 | * @param charset 51 | * @return 52 | * @throws SignatureException 53 | * @throws UnsupportedEncodingException 54 | */ 55 | private static byte[] getContentBytes(String content, String charset) { 56 | if (charset == null || "".equals(charset)) { 57 | return content.getBytes(); 58 | } 59 | try { 60 | return content.getBytes(charset); 61 | } catch (UnsupportedEncodingException e) { 62 | throw new RuntimeException("MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset); 63 | } 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/sign/RSA.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.sign; 2 | 3 | import java.io.ByteArrayInputStream; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.InputStream; 6 | import java.security.KeyFactory; 7 | import java.security.PrivateKey; 8 | import java.security.PublicKey; 9 | import java.security.spec.PKCS8EncodedKeySpec; 10 | import java.security.spec.X509EncodedKeySpec; 11 | 12 | import javax.crypto.Cipher; 13 | 14 | public class RSA{ 15 | 16 | public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; 17 | 18 | /** 19 | * RSA签名 20 | * @param content 待签名数据 21 | * @param privateKey 商户私钥 22 | * @param input_charset 编码格式 23 | * @return 签名值 24 | */ 25 | public static String sign(String content, String privateKey, String input_charset){ 26 | try 27 | { 28 | PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode(privateKey) ); 29 | KeyFactory keyf = KeyFactory.getInstance("RSA"); 30 | PrivateKey priKey = keyf.generatePrivate(priPKCS8); 31 | 32 | java.security.Signature signature = java.security.Signature 33 | .getInstance(SIGN_ALGORITHMS); 34 | 35 | signature.initSign(priKey); 36 | signature.update( content.getBytes(input_charset) ); 37 | 38 | byte[] signed = signature.sign(); 39 | 40 | return Base64.encode(signed); 41 | } 42 | catch (Exception e) 43 | { 44 | e.printStackTrace(); 45 | } 46 | 47 | return null; 48 | } 49 | 50 | /** 51 | * RSA验签名检查 52 | * @param content 待签名数据 53 | * @param sign 签名值 54 | * @param ali_public_key 支付宝公钥 55 | * @param input_charset 编码格式 56 | * @return 布尔值 57 | */ 58 | public static boolean verify(String content, String sign, String ali_public_key, String input_charset) 59 | { 60 | try 61 | { 62 | KeyFactory keyFactory = KeyFactory.getInstance("RSA"); 63 | byte[] encodedKey = Base64.decode(ali_public_key); 64 | PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); 65 | 66 | 67 | java.security.Signature signature = java.security.Signature 68 | .getInstance(SIGN_ALGORITHMS); 69 | 70 | signature.initVerify(pubKey); 71 | signature.update( content.getBytes(input_charset) ); 72 | 73 | boolean bverify = signature.verify( Base64.decode(sign) ); 74 | return bverify; 75 | 76 | } 77 | catch (Exception e) 78 | { 79 | e.printStackTrace(); 80 | } 81 | 82 | return false; 83 | } 84 | 85 | /** 86 | * 解密 87 | * @param content 密文 88 | * @param private_key 商户私钥 89 | * @param input_charset 编码格式 90 | * @return 解密后的字符串 91 | */ 92 | public static String decrypt(String content, String private_key, String input_charset) throws Exception { 93 | PrivateKey prikey = getPrivateKey(private_key); 94 | 95 | Cipher cipher = Cipher.getInstance("RSA"); 96 | cipher.init(Cipher.DECRYPT_MODE, prikey); 97 | 98 | InputStream ins = new ByteArrayInputStream(Base64.decode(content)); 99 | ByteArrayOutputStream writer = new ByteArrayOutputStream(); 100 | //rsa解密的字节大小最多是128,将需要解密的内容,按128位拆开解密 101 | byte[] buf = new byte[128]; 102 | int bufl; 103 | 104 | while ((bufl = ins.read(buf)) != -1) { 105 | byte[] block = null; 106 | 107 | if (buf.length == bufl) { 108 | block = buf; 109 | } else { 110 | block = new byte[bufl]; 111 | for (int i = 0; i < bufl; i++) { 112 | block[i] = buf[i]; 113 | } 114 | } 115 | 116 | writer.write(cipher.doFinal(block)); 117 | } 118 | 119 | return new String(writer.toByteArray(), input_charset); 120 | } 121 | 122 | 123 | /** 124 | * 得到私钥 125 | * @param key 密钥字符串(经过base64编码) 126 | * @throws Exception 127 | */ 128 | public static PrivateKey getPrivateKey(String key) throws Exception { 129 | 130 | byte[] keyBytes; 131 | 132 | keyBytes = Base64.decode(key); 133 | 134 | PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); 135 | 136 | KeyFactory keyFactory = KeyFactory.getInstance("RSA"); 137 | 138 | PrivateKey privateKey = keyFactory.generatePrivate(keySpec); 139 | 140 | return privateKey; 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/AlipayCore.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util; 2 | 3 | import java.io.File; 4 | import java.io.FileWriter; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | import java.util.Collections; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import org.apache.commons.codec.digest.DigestUtils; 12 | import org.apache.commons.httpclient.methods.multipart.FilePartSource; 13 | import org.apache.commons.httpclient.methods.multipart.PartSource; 14 | import com.binrui.shop.pay.alipay.config.AlipayConfig; 15 | 16 | 17 | /** 18 | *类名:AlipayFunction 19 | *功能:支付宝接口公用函数类 20 | *详细:该类是请求、通知返回两个文件所调用的公用函数核心处理文件,不需要修改 21 | *版本:3.3 22 | *日期:2012-08-14 23 | *说明: 24 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 25 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 26 | */ 27 | public class AlipayCore { 28 | 29 | /** 30 | * 除去数组中的空值和签名参数 31 | * @param sArray 签名参数组 32 | * @return 去掉空值与签名参数后的新签名参数组 33 | */ 34 | public static Map paraFilter(Map sArray) { 35 | 36 | Map result = new HashMap(); 37 | 38 | if (sArray == null || sArray.size() <= 0) { 39 | return result; 40 | } 41 | 42 | for (String key : sArray.keySet()) { 43 | String value = sArray.get(key); 44 | if (value == null || value.equals("") || key.equalsIgnoreCase("sign") 45 | || key.equalsIgnoreCase("sign_type")) { 46 | continue; 47 | } 48 | result.put(key, value); 49 | } 50 | 51 | return result; 52 | } 53 | 54 | /** 55 | * 把数组所有元素排序,并按照“参数=参数值”的模式用“&”字符拼接成字符串 56 | * @param params 需要排序并参与字符拼接的参数组 57 | * @return 拼接后字符串 58 | */ 59 | public static String createLinkString(Map params) { 60 | 61 | List keys = new ArrayList(params.keySet()); 62 | Collections.sort(keys); 63 | 64 | String prestr = ""; 65 | 66 | for (int i = 0; i < keys.size(); i++) { 67 | String key = keys.get(i); 68 | String value = params.get(key); 69 | 70 | if (i == keys.size() - 1) {//拼接时,不包括最后一个&字符 71 | prestr = prestr + key + "=" + value; 72 | } else { 73 | prestr = prestr + key + "=" + value + "&"; 74 | } 75 | } 76 | 77 | return prestr; 78 | } 79 | 80 | /** 81 | * 写日志,方便测试(看网站需求,也可以改成把记录存入数据库) 82 | * @param sWord 要写入日志里的文本内容 83 | */ 84 | public static void logResult(String sWord) { 85 | FileWriter writer = null; 86 | try { 87 | writer = new FileWriter(AlipayConfig.log_path + "alipay_log_" + System.currentTimeMillis()+".txt"); 88 | writer.write(sWord); 89 | } catch (Exception e) { 90 | e.printStackTrace(); 91 | } finally { 92 | if (writer != null) { 93 | try { 94 | writer.close(); 95 | } catch (IOException e) { 96 | e.printStackTrace(); 97 | } 98 | } 99 | } 100 | } 101 | 102 | /** 103 | * 生成文件摘要 104 | * @param strFilePath 文件路径 105 | * @param file_digest_type 摘要算法 106 | * @return 文件摘要结果 107 | */ 108 | public static String getAbstract(String strFilePath, String file_digest_type) throws IOException { 109 | PartSource file = new FilePartSource(new File(strFilePath)); 110 | if(file_digest_type.equals("MD5")){ 111 | return DigestUtils.md5Hex(file.createInputStream()); 112 | } 113 | else if(file_digest_type.equals("SHA")) { 114 | return DigestUtils.sha256Hex(file.createInputStream()); 115 | } 116 | else { 117 | return ""; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/AlipayNotify.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | import java.util.Map; 8 | import org.apache.log4j.Logger; 9 | import com.binrui.shop.pay.alipay.config.AlipayConfig; 10 | import com.binrui.shop.pay.alipay.sign.MD5; 11 | import com.binrui.shop.pay.alipay.sign.RSA; 12 | 13 | /** 14 | *类名:AlipayNotify 15 | *功能:支付宝通知处理类 16 | *详细:处理支付宝各接口通知返回 17 | *版本:3.3 18 | *日期:2012-08-17 19 | *说明: 20 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 21 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考 22 | *************************注意************************* 23 | *调试通知返回时,可查看或改写log日志的写入TXT里的数据,来检查通知返回是否正常 24 | */ 25 | //@Slf4j 26 | public class AlipayNotify { 27 | 28 | /** 29 | * log4j 30 | */ 31 | private static final Logger logger = Logger.getLogger(AlipayNotify.class); 32 | 33 | /** 34 | * 支付宝消息验证地址 35 | */ 36 | private static final String HTTPS_VERIFY_URL = "https://mapi.alipay.com/gateway.do?service=notify_verify&"; 37 | 38 | /** 39 | * 验证消息是否是支付宝发出的合法消息 40 | * @param params 通知返回来的参数数组 41 | * @return 验证结果 42 | */ 43 | public static boolean verify(Map params) { 44 | 45 | //判断responsetTxt是否为true,isSign是否为true 46 | //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 47 | //isSign不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 48 | String responseTxt = "true"; 49 | if(params.get("notify_id") != null) { 50 | String notify_id = params.get("notify_id"); 51 | responseTxt = verifyResponse(notify_id); 52 | logger.info("responseTxt:" + responseTxt); 53 | } 54 | String sign = ""; 55 | if(params.get("sign") != null) {sign = params.get("sign");} 56 | boolean isSign = getSignVeryfy(params, sign); 57 | logger.info("isSign:" + isSign); 58 | //写日志记录(若要调试,请取消下面两行注释) 59 | //String sWord = "responseTxt=" + responseTxt + "\n isSign=" + isSign + "\n 返回回来的参数:" + AlipayCore.createLinkString(params); 60 | //AlipayCore.logResult(sWord); 61 | if (isSign && responseTxt.equals("true")) { 62 | return true; 63 | } else { 64 | return false; 65 | } 66 | } 67 | 68 | /** 69 | * 根据反馈回来的信息,生成签名结果 70 | * @param Params 通知返回来的参数数组 71 | * @param sign 比对的签名结果 72 | * @return 生成的签名结果 73 | */ 74 | private static boolean getSignVeryfy(Map Params, String sign) { 75 | //过滤空值、sign与sign_type参数 76 | Map sParaNew = AlipayCore.paraFilter(Params); 77 | //获取待签名字符串 78 | String preSignStr = AlipayCore.createLinkString(sParaNew); 79 | //获得签名验证结果 80 | boolean isSign = false; 81 | if(AlipayConfig.sign_type.equals("MD5") ) { 82 | isSign = MD5.verify(preSignStr, sign, AlipayConfig.key, AlipayConfig.input_charset); 83 | } 84 | if(AlipayConfig.sign_type.equals("RSA")){ 85 | isSign = RSA.verify(preSignStr, sign, AlipayConfig.ali_public_key, AlipayConfig.input_charset); 86 | } 87 | return isSign; 88 | } 89 | 90 | /** 91 | * 获取远程服务器ATN结果,验证返回URL 92 | * @param notify_id 通知校验ID 93 | * @return 服务器ATN结果 94 | * 验证结果集: 95 | * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空 96 | * true 返回正确信息 97 | * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟 98 | */ 99 | private static String verifyResponse(String notify_id) { 100 | //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求 101 | String partner = AlipayConfig.partner; 102 | String veryfy_url = HTTPS_VERIFY_URL + "partner=" + partner + "¬ify_id=" + notify_id; 103 | logger.info("veryfy_url:" + veryfy_url); 104 | return checkUrl(veryfy_url); 105 | } 106 | 107 | /** 108 | * 获取远程服务器ATN结果 109 | * @param urlvalue 指定URL路径地址 110 | * @return 服务器ATN结果 111 | * 验证结果集: 112 | * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空 113 | * true 返回正确信息 114 | * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟 115 | */ 116 | private static String checkUrl(String urlvalue) { 117 | String inputLine = ""; 118 | 119 | try { 120 | URL url = new URL(urlvalue); 121 | HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); 122 | BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection 123 | .getInputStream())); 124 | inputLine = in.readLine().toString(); 125 | } catch (Exception e) { 126 | e.printStackTrace(); 127 | inputLine = ""; 128 | } 129 | 130 | return inputLine; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/AlipaySubmit.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util; 2 | 3 | import java.io.IOException; 4 | import java.net.MalformedURLException; 5 | import java.net.URL; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Map; 9 | import org.apache.commons.httpclient.NameValuePair; 10 | import org.dom4j.Document; 11 | import org.dom4j.DocumentException; 12 | import org.dom4j.Node; 13 | import org.dom4j.io.SAXReader; 14 | import com.binrui.shop.pay.alipay.config.AlipayConfig; 15 | import com.binrui.shop.pay.alipay.sign.MD5; 16 | import com.binrui.shop.pay.alipay.sign.RSA; 17 | import com.binrui.shop.pay.alipay.util.http.HttpProtocolHandler; 18 | import com.binrui.shop.pay.alipay.util.http.HttpRequest; 19 | import com.binrui.shop.pay.alipay.util.http.HttpResponse; 20 | import com.binrui.shop.pay.alipay.util.http.HttpResultType; 21 | 22 | /** 23 | *类名:AlipaySubmit 24 | *功能:支付宝各接口请求提交类 25 | *详细:构造支付宝各接口表单HTML文本,获取远程HTTP数据 26 | *版本:3.3 27 | *日期:2012-08-13 28 | *说明: 29 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 30 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 31 | */ 32 | public class AlipaySubmit { 33 | 34 | /** 35 | * 支付宝提供给商户的服务接入网关URL(新) 36 | */ 37 | private static final String ALIPAY_GATEWAY_NEW = "https://mapi.alipay.com/gateway.do?"; 38 | 39 | /** 40 | * 生成签名结果 41 | * @param sPara 要签名的数组 42 | * @return 签名结果字符串 43 | */ 44 | public static String buildRequestMysign(Map sPara) { 45 | String prestr = AlipayCore.createLinkString(sPara); //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 46 | String mysign = ""; 47 | if(AlipayConfig.sign_type.equals("RSA") ){ 48 | mysign = RSA.sign(prestr, AlipayConfig.private_key, AlipayConfig.input_charset); 49 | } 50 | if(AlipayConfig.sign_type.equals("MD5") ) { 51 | mysign = MD5.sign(prestr, AlipayConfig.key, AlipayConfig.input_charset); 52 | } 53 | return mysign; 54 | } 55 | 56 | /** 57 | * 生成要请求给支付宝的参数数组 58 | * @param sParaTemp 请求前的参数数组 59 | * @return 要请求的参数数组 60 | */ 61 | private static Map buildRequestPara(Map sParaTemp) { 62 | //除去数组中的空值和签名参数 63 | Map sPara = AlipayCore.paraFilter(sParaTemp); 64 | //生成签名结果 65 | String mysign = buildRequestMysign(sPara); 66 | 67 | //签名结果与签名方式加入请求提交参数组中 68 | sPara.put("sign", mysign); 69 | sPara.put("sign_type", AlipayConfig.sign_type); 70 | 71 | return sPara; 72 | } 73 | 74 | /** 75 | * 建立请求,以表单HTML形式构造(默认) 76 | * @param sParaTemp 请求参数数组 77 | * @param strMethod 提交方式。两个值可选:post、get 78 | * @param strButtonName 确认按钮显示文字 79 | * @return 提交表单HTML文本 80 | */ 81 | public static String buildRequest(Map sParaTemp, String strMethod, String strButtonName) { 82 | //待请求参数数组 83 | Map sPara = buildRequestPara(sParaTemp); 84 | List keys = new ArrayList(sPara.keySet()); 85 | 86 | StringBuffer sbHtml = new StringBuffer(); 87 | 88 | sbHtml.append("
"); 91 | 92 | for (int i = 0; i < keys.size(); i++) { 93 | String name = (String) keys.get(i); 94 | String value = (String) sPara.get(name); 95 | 96 | sbHtml.append(""); 97 | } 98 | 99 | //submit按钮控件请不要含有name属性 100 | sbHtml.append("
"); 101 | sbHtml.append(""); 102 | 103 | return sbHtml.toString(); 104 | } 105 | 106 | /** 107 | * 建立请求,以表单HTML形式构造,带文件上传功能 108 | * @param sParaTemp 请求参数数组 109 | * @param strMethod 提交方式。两个值可选:post、get 110 | * @param strButtonName 确认按钮显示文字 111 | * @param strParaFileName 文件上传的参数名 112 | * @return 提交表单HTML文本 113 | */ 114 | public static String buildRequest(Map sParaTemp, String strMethod, String strButtonName, String strParaFileName) { 115 | //待请求参数数组 116 | Map sPara = buildRequestPara(sParaTemp); 117 | List keys = new ArrayList(sPara.keySet()); 118 | 119 | StringBuffer sbHtml = new StringBuffer(); 120 | 121 | sbHtml.append("
"); 124 | 125 | for (int i = 0; i < keys.size(); i++) { 126 | String name = (String) keys.get(i); 127 | String value = (String) sPara.get(name); 128 | 129 | sbHtml.append(""); 130 | } 131 | 132 | sbHtml.append(""); 133 | 134 | //submit按钮控件请不要含有name属性 135 | sbHtml.append("
"); 136 | 137 | return sbHtml.toString(); 138 | } 139 | 140 | /** 141 | * 建立请求,以模拟远程HTTP的POST请求方式构造并获取支付宝的处理结果 142 | * 如果接口中没有上传文件参数,那么strParaFileName与strFilePath设置为空值 143 | * 如:buildRequest("", "",sParaTemp) 144 | * @param strParaFileName 文件类型的参数名 145 | * @param strFilePath 文件路径 146 | * @param sParaTemp 请求参数数组 147 | * @return 支付宝处理结果 148 | * @throws Exception 149 | */ 150 | public static String buildRequest(String strParaFileName, String strFilePath,Map sParaTemp) throws Exception { 151 | //待请求参数数组 152 | Map sPara = buildRequestPara(sParaTemp); 153 | 154 | HttpProtocolHandler httpProtocolHandler = HttpProtocolHandler.getInstance(); 155 | 156 | HttpRequest request = new HttpRequest(HttpResultType.BYTES); 157 | //设置编码集 158 | request.setCharset(AlipayConfig.input_charset); 159 | 160 | request.setParameters(generatNameValuePair(sPara)); 161 | request.setUrl(ALIPAY_GATEWAY_NEW+"_input_charset="+AlipayConfig.input_charset); 162 | 163 | HttpResponse response = httpProtocolHandler.execute(request,strParaFileName,strFilePath); 164 | if (response == null) { 165 | return null; 166 | } 167 | 168 | String strResult = response.getStringResult(); 169 | 170 | return strResult; 171 | } 172 | 173 | /** 174 | * MAP类型数组转换成NameValuePair类型 175 | * @param properties MAP类型数组 176 | * @return NameValuePair类型数组 177 | */ 178 | private static NameValuePair[] generatNameValuePair(Map properties) { 179 | NameValuePair[] nameValuePair = new NameValuePair[properties.size()]; 180 | int i = 0; 181 | for (Map.Entry entry : properties.entrySet()) { 182 | nameValuePair[i++] = new NameValuePair(entry.getKey(), entry.getValue()); 183 | } 184 | 185 | return nameValuePair; 186 | } 187 | 188 | /** 189 | * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 190 | * 注意:远程解析XML出错,与服务器是否支持SSL等配置有关 191 | * @return 时间戳字符串 192 | * @throws IOException 193 | * @throws DocumentException 194 | * @throws MalformedURLException 195 | */ 196 | @SuppressWarnings("unchecked") 197 | public static String query_timestamp() throws MalformedURLException, 198 | DocumentException, IOException { 199 | //构造访问query_timestamp接口的URL串 200 | String strUrl = ALIPAY_GATEWAY_NEW + "service=query_timestamp&partner=" + AlipayConfig.partner + "&_input_charset" +AlipayConfig.input_charset; 201 | StringBuffer result = new StringBuffer(); 202 | SAXReader reader = new SAXReader(); 203 | Document doc = reader.read(new URL(strUrl).openStream()); 204 | List nodeList = doc.selectNodes("//alipay/*"); 205 | for (Node node : nodeList) { 206 | // 截取部分不需要解析的信息 207 | if (node.getName().equals("is_success") && node.getText().equals("T")) { 208 | // 判断是否有成功标示 209 | List nodeList1 = doc.selectNodes("//response/timestamp/*"); 210 | for (Node node1 : nodeList1) { 211 | result.append(node1.getText()); 212 | } 213 | } 214 | } 215 | return result.toString(); 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/UtilDate.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util; 2 | 3 | import java.util.Date; 4 | import java.util.Random; 5 | import java.text.SimpleDateFormat; 6 | import java.text.DateFormat; 7 | 8 | /** 9 | *类名:UtilDate 10 | *功能:自定义订单类 11 | *详细:工具类,可以用作获取系统日期、订单编号等 12 | *版本:3.3 13 | *日期:2012-08-17 14 | *说明: 15 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 16 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 17 | */ 18 | public class UtilDate { 19 | 20 | /** 年月日时分秒(无下划线) yyyyMMddHHmmss */ 21 | public static final String dtLong = "yyyyMMddHHmmss"; 22 | 23 | /** 完整时间 yyyy-MM-dd HH:mm:ss */ 24 | public static final String simple = "yyyy-MM-dd HH:mm:ss"; 25 | 26 | /** 年月日(无下划线) yyyyMMdd */ 27 | public static final String dtShort = "yyyyMMdd"; 28 | 29 | 30 | /** 31 | * 返回系统当前时间(精确到毫秒),作为一个唯一的订单编号 32 | * @return 33 | * 以yyyyMMddHHmmss为格式的当前系统时间 34 | */ 35 | public static String getOrderNum(){ 36 | Date date=new Date(); 37 | DateFormat df=new SimpleDateFormat(dtLong); 38 | return df.format(date); 39 | } 40 | 41 | /** 42 | * 获取系统当前日期(精确到毫秒),格式:yyyy-MM-dd HH:mm:ss 43 | * @return 44 | */ 45 | public static String getDateFormatter(){ 46 | Date date=new Date(); 47 | DateFormat df=new SimpleDateFormat(simple); 48 | return df.format(date); 49 | } 50 | 51 | /** 52 | * 获取系统当期年月日(精确到天),格式:yyyyMMdd 53 | * @return 54 | */ 55 | public static String getDate(){ 56 | Date date=new Date(); 57 | DateFormat df=new SimpleDateFormat(dtShort); 58 | return df.format(date); 59 | } 60 | 61 | /** 62 | * 产生随机的三位数 63 | * @return 64 | */ 65 | public static String getThree(){ 66 | Random rad=new Random(); 67 | return rad.nextInt(1000)+""; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/http/HttpProtocolHandler.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util.http; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.net.UnknownHostException; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.apache.commons.httpclient.HttpClient; 9 | import org.apache.commons.httpclient.HttpConnectionManager; 10 | import org.apache.commons.httpclient.HttpException; 11 | import org.apache.commons.httpclient.HttpMethod; 12 | import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; 13 | import org.apache.commons.httpclient.NameValuePair; 14 | import org.apache.commons.httpclient.methods.GetMethod; 15 | import org.apache.commons.httpclient.methods.PostMethod; 16 | import org.apache.commons.httpclient.methods.multipart.FilePart; 17 | import org.apache.commons.httpclient.methods.multipart.FilePartSource; 18 | import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; 19 | import org.apache.commons.httpclient.methods.multipart.Part; 20 | import org.apache.commons.httpclient.methods.multipart.StringPart; 21 | import org.apache.commons.httpclient.params.HttpMethodParams; 22 | import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread; 23 | 24 | /** 25 | *类名:HttpProtocolHandler 26 | *功能:HttpClient方式访问 27 | *详细:获取远程HTTP数据 28 | *版本:3.3 29 | *日期:2012-08-17 30 | *说明: 31 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 32 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 33 | */ 34 | public class HttpProtocolHandler { 35 | 36 | private static String DEFAULT_CHARSET = "GBK"; 37 | 38 | /** 连接超时时间,由bean factory设置,缺省为8秒钟 */ 39 | private int defaultConnectionTimeout = 8000; 40 | 41 | /** 回应超时时间, 由bean factory设置,缺省为30秒钟 */ 42 | private int defaultSoTimeout = 30000; 43 | 44 | /** 闲置连接超时时间, 由bean factory设置,缺省为60秒钟 */ 45 | private int defaultIdleConnTimeout = 60000; 46 | 47 | private int defaultMaxConnPerHost = 30; 48 | 49 | private int defaultMaxTotalConn = 80; 50 | 51 | /** 默认等待HttpConnectionManager返回连接超时(只有在达到最大连接数时起作用):1秒 */ 52 | private static final long defaultHttpConnectionManagerTimeout = 3 * 1000; 53 | 54 | /** 55 | * HTTP连接管理器,该连接管理器必须是线程安全的. 56 | */ 57 | private HttpConnectionManager connectionManager; 58 | 59 | private static HttpProtocolHandler httpProtocolHandler = new HttpProtocolHandler(); 60 | 61 | /** 62 | * 工厂方法 63 | * 64 | * @return 65 | */ 66 | public static HttpProtocolHandler getInstance() { 67 | return httpProtocolHandler; 68 | } 69 | 70 | /** 71 | * 私有的构造方法 72 | */ 73 | private HttpProtocolHandler() { 74 | // 创建一个线程安全的HTTP连接池 75 | connectionManager = new MultiThreadedHttpConnectionManager(); 76 | connectionManager.getParams().setDefaultMaxConnectionsPerHost( 77 | defaultMaxConnPerHost); 78 | connectionManager.getParams().setMaxTotalConnections( 79 | defaultMaxTotalConn); 80 | 81 | IdleConnectionTimeoutThread ict = new IdleConnectionTimeoutThread(); 82 | ict.addConnectionManager(connectionManager); 83 | ict.setConnectionTimeout(defaultIdleConnTimeout); 84 | 85 | ict.start(); 86 | } 87 | 88 | /** 89 | * 执行Http请求 90 | * 91 | * @param request 92 | * 请求数据 93 | * @param strParaFileName 94 | * 文件类型的参数名 95 | * @param strFilePath 96 | * 文件路径 97 | * @return 98 | * @throws HttpException 99 | * , IOException 100 | */ 101 | public HttpResponse execute(HttpRequest request, String strParaFileName, 102 | String strFilePath) throws HttpException, IOException { 103 | HttpClient httpclient = new HttpClient(connectionManager); 104 | 105 | // 设置连接超时 106 | int connectionTimeout = defaultConnectionTimeout; 107 | if (request.getConnectionTimeout() > 0) { 108 | connectionTimeout = request.getConnectionTimeout(); 109 | } 110 | httpclient.getHttpConnectionManager().getParams() 111 | .setConnectionTimeout(connectionTimeout); 112 | 113 | // 设置回应超时 114 | int soTimeout = defaultSoTimeout; 115 | if (request.getTimeout() > 0) { 116 | soTimeout = request.getTimeout(); 117 | } 118 | httpclient.getHttpConnectionManager().getParams() 119 | .setSoTimeout(soTimeout); 120 | 121 | // 设置等待ConnectionManager释放connection的时间 122 | httpclient.getParams().setConnectionManagerTimeout( 123 | defaultHttpConnectionManagerTimeout); 124 | 125 | String charset = request.getCharset(); 126 | charset = charset == null ? DEFAULT_CHARSET : charset; 127 | HttpMethod method = null; 128 | 129 | // get模式且不带上传文件 130 | if (request.getMethod().equals(HttpRequest.METHOD_GET)) { 131 | method = new GetMethod(request.getUrl()); 132 | method.getParams().setCredentialCharset(charset); 133 | 134 | // parseNotifyConfig会保证使用GET方法时,request一定使用QueryString 135 | method.setQueryString(request.getQueryString()); 136 | } else if (strParaFileName.equals("") && strFilePath.equals("")) { 137 | // post模式且不带上传文件 138 | method = new PostMethod(request.getUrl()); 139 | ((PostMethod) method).addParameters(request.getParameters()); 140 | method.addRequestHeader("Content-Type", 141 | "application/x-www-form-urlencoded; text/html; charset=" 142 | + charset); 143 | } else { 144 | // post模式且带上传文件 145 | method = new PostMethod(request.getUrl()); 146 | List parts = new ArrayList(); 147 | for (int i = 0; i < request.getParameters().length; i++) { 148 | parts.add(new StringPart(request.getParameters()[i].getName(), 149 | request.getParameters()[i].getValue(), charset)); 150 | } 151 | // 增加文件参数,strParaFileName是参数名,使用本地文件 152 | parts.add(new FilePart(strParaFileName, new FilePartSource( 153 | new File(strFilePath)))); 154 | 155 | // 设置请求体 156 | ((PostMethod) method).setRequestEntity(new MultipartRequestEntity( 157 | parts.toArray(new Part[0]), new HttpMethodParams())); 158 | } 159 | 160 | // 设置Http Header中的User-Agent属性 161 | method.addRequestHeader("User-Agent", "Mozilla/4.0"); 162 | HttpResponse response = new HttpResponse(); 163 | 164 | try { 165 | httpclient.executeMethod(method); 166 | if (request.getResultType().equals(HttpResultType.STRING)) { 167 | response.setStringResult(method.getResponseBodyAsString()); 168 | } else if (request.getResultType().equals(HttpResultType.BYTES)) { 169 | response.setByteResult(method.getResponseBody()); 170 | } 171 | response.setResponseHeaders(method.getResponseHeaders()); 172 | } catch (UnknownHostException ex) { 173 | 174 | return null; 175 | } catch (IOException ex) { 176 | 177 | return null; 178 | } catch (Exception ex) { 179 | 180 | return null; 181 | } finally { 182 | method.releaseConnection(); 183 | } 184 | return response; 185 | } 186 | 187 | /** 188 | * 将NameValuePairs数组转变为字符串 189 | * 190 | * @param nameValues 191 | * @return 192 | */ 193 | protected String toString(NameValuePair[] nameValues) { 194 | if (nameValues == null || nameValues.length == 0) { 195 | return "null"; 196 | } 197 | 198 | StringBuffer buffer = new StringBuffer(); 199 | 200 | for (int i = 0; i < nameValues.length; i++) { 201 | NameValuePair nameValue = nameValues[i]; 202 | 203 | if (i == 0) { 204 | buffer.append(nameValue.getName() + "=" + nameValue.getValue()); 205 | } else { 206 | buffer.append("&" + nameValue.getName() + "=" 207 | + nameValue.getValue()); 208 | } 209 | } 210 | 211 | return buffer.toString(); 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/http/HttpRequest.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util.http; 2 | 3 | import org.apache.commons.httpclient.NameValuePair; 4 | /** 5 | *类名:HttpRequest 6 | *功能:Http请求对象的封装 7 | *详细:封装Http请求 8 | *版本:3.3 9 | *日期:2011-08-17 10 | *说明: 11 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 12 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 13 | */ 14 | public class HttpRequest { 15 | 16 | /** HTTP GET method */ 17 | public static final String METHOD_GET = "GET"; 18 | 19 | /** HTTP POST method */ 20 | public static final String METHOD_POST = "POST"; 21 | 22 | /** 23 | * 待请求的url 24 | */ 25 | private String url = null; 26 | 27 | /** 28 | * 默认的请求方式 29 | */ 30 | private String method = METHOD_POST; 31 | 32 | private int timeout = 0; 33 | 34 | private int connectionTimeout = 0; 35 | 36 | /** 37 | * Post方式请求时组装好的参数值对 38 | */ 39 | private NameValuePair[] parameters = null; 40 | 41 | /** 42 | * Get方式请求时对应的参数 43 | */ 44 | private String queryString = null; 45 | 46 | /** 47 | * 默认的请求编码方式 48 | */ 49 | private String charset = "GBK"; 50 | 51 | /** 52 | * 请求发起方的ip地址 53 | */ 54 | private String clientIp; 55 | 56 | /** 57 | * 请求返回的方式 58 | */ 59 | private HttpResultType resultType = HttpResultType.BYTES; 60 | 61 | public HttpRequest(HttpResultType resultType) { 62 | super(); 63 | this.resultType = resultType; 64 | } 65 | 66 | /** 67 | * @return Returns the clientIp. 68 | */ 69 | public String getClientIp() { 70 | return clientIp; 71 | } 72 | 73 | /** 74 | * @param clientIp The clientIp to set. 75 | */ 76 | public void setClientIp(String clientIp) { 77 | this.clientIp = clientIp; 78 | } 79 | 80 | public NameValuePair[] getParameters() { 81 | return parameters; 82 | } 83 | 84 | public void setParameters(NameValuePair[] parameters) { 85 | this.parameters = parameters; 86 | } 87 | 88 | public String getQueryString() { 89 | return queryString; 90 | } 91 | 92 | public void setQueryString(String queryString) { 93 | this.queryString = queryString; 94 | } 95 | 96 | public String getUrl() { 97 | return url; 98 | } 99 | 100 | public void setUrl(String url) { 101 | this.url = url; 102 | } 103 | 104 | public String getMethod() { 105 | return method; 106 | } 107 | 108 | public void setMethod(String method) { 109 | this.method = method; 110 | } 111 | 112 | public int getConnectionTimeout() { 113 | return connectionTimeout; 114 | } 115 | 116 | public void setConnectionTimeout(int connectionTimeout) { 117 | this.connectionTimeout = connectionTimeout; 118 | } 119 | 120 | public int getTimeout() { 121 | return timeout; 122 | } 123 | 124 | public void setTimeout(int timeout) { 125 | this.timeout = timeout; 126 | } 127 | 128 | /** 129 | * @return Returns the charset. 130 | */ 131 | public String getCharset() { 132 | return charset; 133 | } 134 | 135 | /** 136 | * @param charset The charset to set. 137 | */ 138 | public void setCharset(String charset) { 139 | this.charset = charset; 140 | } 141 | 142 | public HttpResultType getResultType() { 143 | return resultType; 144 | } 145 | 146 | public void setResultType(HttpResultType resultType) { 147 | this.resultType = resultType; 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/http/HttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.binrui.shop.pay.alipay.util.http; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import org.apache.commons.httpclient.Header; 5 | import com.binrui.shop.pay.alipay.config.AlipayConfig; 6 | 7 | /** 8 | *类名:HttpResponse 9 | *功能:Http返回对象的封装 10 | *详细:封装Http返回信息 11 | *版本:3.3 12 | *日期:2011-08-17 13 | *说明: 14 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 15 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 16 | */ 17 | public class HttpResponse { 18 | 19 | /** 20 | * 返回中的Header信息 21 | */ 22 | private Header[] responseHeaders; 23 | 24 | /** 25 | * String类型的result 26 | */ 27 | private String stringResult; 28 | 29 | /** 30 | * btye类型的result 31 | */ 32 | private byte[] byteResult; 33 | 34 | public Header[] getResponseHeaders() { 35 | return responseHeaders; 36 | } 37 | 38 | public void setResponseHeaders(Header[] responseHeaders) { 39 | this.responseHeaders = responseHeaders; 40 | } 41 | 42 | public byte[] getByteResult() { 43 | if (byteResult != null) { 44 | return byteResult; 45 | } 46 | if (stringResult != null) { 47 | return stringResult.getBytes(); 48 | } 49 | return null; 50 | } 51 | 52 | public void setByteResult(byte[] byteResult) { 53 | this.byteResult = byteResult; 54 | } 55 | 56 | public String getStringResult() throws UnsupportedEncodingException { 57 | if (stringResult != null) { 58 | return stringResult; 59 | } 60 | if (byteResult != null) { 61 | return new String(byteResult, AlipayConfig.input_charset); 62 | } 63 | return null; 64 | } 65 | 66 | public void setStringResult(String stringResult) { 67 | this.stringResult = stringResult; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/com/binrui/shop/pay/alipay/util/http/HttpResultType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Alipay.com Inc. 3 | * Copyright (c) 2004-2005 All Rights Reserved. 4 | */ 5 | package com.binrui.shop.pay.alipay.util.http; 6 | /* * 7 | *类名:HttpResultType 8 | *功能:表示Http返回的结果字符方式 9 | *详细:表示Http返回的结果字符方式 10 | *版本:3.3 11 | *日期:2012-08-17 12 | *说明: 13 | *以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 14 | *该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 15 | */ 16 | public enum HttpResultType { 17 | /** 18 | * 字符串方式 19 | */ 20 | STRING, 21 | 22 | /** 23 | * 字节数组方式 24 | */ 25 | BYTES 26 | } 27 | -------------------------------------------------------------------------------- /src/com/binrui/shop/utils/ApiUtils.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/utils/ApiUtils.java -------------------------------------------------------------------------------- /src/com/binrui/shop/utils/MD5Util.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/utils/MD5Util.java -------------------------------------------------------------------------------- /src/com/binrui/shop/web/BinRuiExceptionResolver.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binrui/shopping/46c8ab64c2cbeb2adbc33c3d66126cc77e12f43f/src/com/binrui/shop/web/BinRuiExceptionResolver.java -------------------------------------------------------------------------------- /src/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://127.0.0.1:3306/brshop?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true 3 | jdbc.username=root 4 | jdbc.password=root 5 | #connection pool settings 6 | # maxIdle\u662f\u6700\u5927\u7684\u7a7a\u95f2\u8fde\u63a5\u6570\uff0c\u8fd9\u91cc\u53d6\u503c\u4e3a20\uff0c\u8868\u793a\u5373\u4f7f\u6ca1\u6709\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u4f9d\u7136\u53ef\u4ee5\u4fdd\u630120\u4e2a\u7a7a\u95f2\u7684\u8fde\u63a5\uff0c\u5b83\u4eec\u4e0d\u4f1a\u88ab\u6e05\u9664\uff0c\u968f\u65f6\u5904\u4e8e\u5f85\u547d\u72b6\u6001 7 | jdbc.pool.maxIdle=20 8 | # maxActive\u662f\u6700\u5927\u6fc0\u6d3b\u8fde\u63a5\u6570\uff0c\u8fd9\u91cc\u53d6\u503c\u4e3a200\uff0c\u8868\u793a\u540c\u65f6\u6700\u591a\u6709200\u4e2a\u6570\u636e\u5e93\u8fde\u63a5 9 | jdbc.pool.maxActive=200 10 | # jdbc \u68c0\u9a8c\u7684SQL 11 | jdbc.ValidationQuery=select 1 12 | # \u8fc7\u6ee4\u5668\u8bbe\u7f6e 13 | jdbc.filters=stat 14 | jdbc.maxActive=20 15 | jdbc.initialSize=2 16 | jdbc.maxWait=60000 17 | jdbc.minIdle=5 18 | #maxIdle=15 19 | jdbc.timeBetweenEvictionRunsMillis=60000 20 | jdbc.minEvictableIdleTimeMillis=300000 21 | jdbc.validationQuery=SELECT 'x' from dual 22 | jdbc.testWhileIdle=true 23 | jdbc.testOnBorrow=false 24 | jdbc.testOnReturn=false 25 | #poolPreparedStatements=true 26 | jdbc.maxOpenPreparedStatements=20 27 | #\u5bf9\u4e8e\u957f\u65f6\u95f4\u4e0d\u4f7f\u7528\u7684\u8fde\u63a5\u5f3a\u5236\u5173\u95ed 28 | jdbc.removeAbandoned=true 29 | #\u8d85\u8fc730\u5206\u949f\u5f00\u59cb\u5173\u95ed\u7a7a\u95f2\u8fde\u63a5 30 | jdbc.removeAbandonedTimeout=1800 31 | #\u5c06\u5f53\u524d\u5173\u95ed\u52a8\u4f5c\u8bb0\u5f55\u5230\u65e5\u5fd7 32 | jdbc.logAbandoned=true -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | #\u5b9a\u4e49\u6839\u65e5\u5fd7\u7ea7\u522b\u548c\u8f93\u51fa\u7aef(\u5b9a\u4e49\u4e86\u4e24\u4e2a\u8f93\u51fa\u7aef) 2 | log4j.rootLogger=ERROR,CONSOLE,BINRUI 3 | 4 | #\u5b9a\u4e49\u7b2c\u4e00\u4e2a\u8f93\u51fa\u7aef\uff0c\u8f93\u51fa\u5230\u63a7\u5236\u53f0 5 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 6 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.CONSOLE.layout.ConversionPattern=[BinRui] %d [%t] %-5p %c(%L) - %m%n 8 | 9 | #\u5b9a\u65f6\u7b2c\u4e8c\u4e2a\u8f93\u51fa\u7aef\uff0c\u8f93\u51fa\u5230\u6587\u4ef6,\u8be5\u6587\u4ef6\u6700\u5927\u7a7a\u95f4\u4e3a1000KB\uff0c\u8d85\u8fc71000KB\u540e\u81ea\u52a8\u5907\u4efd\uff0c\u751f\u6210\u65b0\u6587\u4ef6 10 | log4j.appender.BINRUI=org.apache.log4j.RollingFileAppender 11 | log4j.appender.BINRUI.file=orclight.log 12 | log4j.appender.BINRUI.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.BINRUI.layout.conversionPattern=%d [%t] %-5p %c(%L) - %m%n 14 | log4j.appender.BINRUI.MaxFileSize=5120KB 15 | log4j.appender.BINRUI.MaxBackupIndex=10 16 | 17 | #\u5b9a\u4e49\u5177\u4f53\u67d0\u4e2a\u5305\u4e0b\u7684\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b 18 | log4j.logger.com.binrui.shop=WARN 19 | log4j.logger.com.binrui.shop.home=INFO 20 | log4j.logger.org.springframework=ERROR,BINRUI 21 | log4j.logger.org.mybatis=ERROR,BINRUI 22 | log4j.logger.org.springframework.jdbc.support=INFO 23 | log4j.logger.org.springframework.scheduling=INFO 24 | #\u5b9a\u4e49sql\u8bed\u53e5\u7684\u8f93\u51fa\u7ea7\u522b 25 | log4j.logger.java.sql.Connection=DEBUG 26 | 27 | 28 | #log4j.appender.file=org.apache.log4j.DailyRollingFileAppender 29 | #log4j.appender.file.File=logs/shopxx.log 30 | #log4j.appender.file.File.DatePattern=.yyyy-MM-dd 31 | #log4j.appender.file.layout=org.apache.log4j.PatternLayout 32 | #log4j.appender.file.layout.ConversionPattern=[BinRUI++] %p [%t] %C.%M(%L) | %m%n 33 | --------------------------------------------------------------------------------