資源簡介
微信支付-商戶支付模式一url接口回調-java版,代碼清晰,可直接運行

代碼片段和文件信息
package?com.cn.ssm.controller;
import?java.io.ByteArrayOutputStream;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.PrintWriter;
import?java.util.HashMap;
import?java.util.Map;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.RequestMapping;
import?com.cn.ssm.service.BillNoService;
import?tool.Parsexml;
import?tool.StrKit;
@Controller
@RequestMapping(“/pay“)
public?class?PayUrlBackController?{
@Autowired?BillNoService?billNoService;
public?static?String??product_id;
@RequestMapping(“/back“)
public?void?back(HttpServletRequest?requestHttpServletResponse?response)?{
InputStream?inStream;
try?{
inStream?=?request.getInputStream();
ByteArrayOutputStream?outSteam?=?new?ByteArrayOutputStream();
byte[]?buffer?=?new?byte[1024];
int?len?=?0;
while?((len?=?inStream.read(buffer))?!=?-1)?{
outSteam.write(buffer?0?len);
}
outSteam.close();
inStream.close();
String?result?=?new?String(outSteam.toByteArray()?“utf-8“);
//System.out.println(“回調通知為:“+result);
/*String?aString=“l> “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“ “+
“1 “+
“ “+
“ “+
“ l>“;*/
Map?map?=Parsexml.callxmlToMap(result);
String?return_code?=?map.get(“return_code“);
String?result_code?=?map.get(“result_code“);
if?(StrKit.notBlank(return_code)?&&?StrKit.notBlank(result_code)?&&?return_code.equalsIgnoreCase(“SUCCESS“)&&result_code.equalsIgnoreCase(“SUCCESS“))?{
????????????????//?以下字段在return_code?和result_code都為SUCCESS的時候有返回
????????????????Map?prepayParams?=?new?HashMap();
????????????????prepayParams.put(“return_code“?“SUCCESS“);
????????????????prepayParams.put(“return_msg“?“OK“);
????????????????byte[]?bytexmls=Parsexml.callMapToxml(prepayParams);
????????????????String?xml=new?String(bytexmls);
????????????????//System.out.println(“回調生成返回的xml:“+xml);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1239??2017-06-12?13:59??WeChat\.classpath
?????文件???????1215??2017-06-12?13:56??WeChat\.project
?????文件????????639??2017-06-12?13:45??WeChat\.settings\.jsdtscope
?????文件????????430??2017-06-12?13:59??WeChat\.settings\org.eclipse.jdt.core.prefs
?????文件?????????90??2017-06-12?13:45??WeChat\.settings\org.eclipse.m2e.core.prefs
?????文件????????659??2017-06-12?13:59??WeChat\.settings\org.eclipse.wst.common.component
?????文件????????321??2017-06-12?13:58??WeChat\.settings\org.eclipse.wst.common.project.facet.core.prefs.xm
?????文件????????346??2017-06-12?13:58??WeChat\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2017-06-12?13:45??WeChat\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2017-06-12?13:45??WeChat\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件?????????50??2017-06-12?13:45??WeChat\.settings\org.eclipse.wst.validation.prefs
?????文件???????7607??2017-06-13?11:13??WeChat\pom.xm
?????文件???????3689??2017-06-13?17:35??WeChat\src\main\java\com\cn\ssm\controller\PayUrlBackController.java
?????文件???????6695??2017-06-14?09:29??WeChat\src\main\java\com\cn\ssm\controller\PayUrlController.java
?????文件????????584??2017-06-14?09:29??WeChat\src\main\java\com\cn\ssm\dao\BillNoDao.java
?????文件????????574??2017-06-13?16:46??WeChat\src\main\java\com\cn\ssm\pojo\BillNo.java
?????文件????????196??2017-06-13?17:09??WeChat\src\main\java\com\cn\ssm\service\BillNoService.java
?????文件????????676??2017-06-13?17:09??WeChat\src\main\java\com\cn\ssm\service\impl\BillNoServiceImpl.java
?????文件???????1056??2017-06-12?15:48??WeChat\src\main\java\tool\CreateSign.java
?????文件???????2380??2017-06-13?17:19??WeChat\src\main\java\tool\DESUtils.java
?????文件???????1142??2016-12-31?15:09??WeChat\src\main\java\tool\EncryptPropertyPlaceholderConfigurer.java
?????文件???????3640??2017-06-13?15:10??WeChat\src\main\java\tool\HttpRequest.java
?????文件???????1488??2017-06-12?15:39??WeChat\src\main\java\tool\MD5.java
?????文件???????2878??2017-06-13?15:12??WeChat\src\main\java\tool\Parsexm
?????文件????????177??2017-06-12?17:03??WeChat\src\main\java\tool\StrKit.java
?????文件????????438??2017-06-14?09:27??WeChat\src\main\resources\jdbc.properties
?????文件????????916??2017-05-09?10:41??WeChat\src\main\resources\log4j.properties
?????文件???????4425??2016-10-07?15:50??WeChat\src\main\resources\spring_mvc.xm
?????文件???????4621??2017-06-12?14:05??WeChat\src\main\resources\spring_mybatis.xm
?????文件?????????57??2017-06-12?13:45??WeChat\src\main\webapp\index.jsp
............此處省略67個文件信息
評論
共有 條評論