You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					
					
						
							67 lines
						
					
					
						
							2.4 KiB
						
					
					
				
			
		
		
	
	
							67 lines
						
					
					
						
							2.4 KiB
						
					
					
				| package com.ynxbd.wx.servlet.oldpay;
 | |
| 
 | |
| import com.ynxbd.common.bean.enums.MerchantEnum;
 | |
| import com.ynxbd.common.helper.common.HttpHelper;
 | |
| import com.ynxbd.common.result.Result;
 | |
| import com.ynxbd.common.result.ServiceException;
 | |
| import com.ynxbd.common.service.RecipeService;
 | |
| import com.ynxbd.wx.wxfactory.WxPayHelper;
 | |
| import com.ynxbd.wx.wxfactory.bean.WxPayNotify;
 | |
| import com.ynxbd.wx.wxfactory.utils.WxRespHelper;
 | |
| import lombok.extern.slf4j.Slf4j;
 | |
| import org.slf4j.MDC;
 | |
| 
 | |
| import javax.servlet.ServletException;
 | |
| import javax.servlet.annotation.WebServlet;
 | |
| import javax.servlet.http.HttpServlet;
 | |
| import javax.servlet.http.HttpServletRequest;
 | |
| import javax.servlet.http.HttpServletResponse;
 | |
| import java.io.IOException;
 | |
| import java.math.BigDecimal;
 | |
| 
 | |
| /**
 | |
|  * 处方支付(旧版)
 | |
|  *
 | |
|  * @author 张剑峰
 | |
|  * @version v1.0.0
 | |
|  * @project:微信公众号
 | |
|  * @date 2017年8月8日下午5:07:44
 | |
|  * @Copyright: 2017云南新八达科技有限公司 All rights reserved.
 | |
|  */
 | |
| @Slf4j
 | |
| @WebServlet("/old_pay_notify_servlet")
 | |
| public class PayNotifyServlet extends HttpServlet {
 | |
| 
 | |
|     @Override
 | |
|     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | |
|         MDC.remove("ip");
 | |
|         MDC.put("ip", HttpHelper.getIpAddress(request));
 | |
| 
 | |
|         try {
 | |
|             WxPayNotify notifyInfo = WxPayHelper.payNotify(request);
 | |
|             Result.respXml(response, WxRespHelper.respOk()); // 收到请求-解析成功
 | |
| 
 | |
|             String openid = notifyInfo.getOpenid();
 | |
|             String bankTransNo = notifyInfo.getTransactionId();
 | |
|             String outTradeNo = notifyInfo.getOutTradeNo();
 | |
|             BigDecimal totalFee = notifyInfo.getTotalFee();
 | |
|             //
 | |
|             String payInfo = notifyInfo.getPayInfo();
 | |
|             String payDate = notifyInfo.getPayDate();
 | |
|             String payTime = notifyInfo.getPayTime();
 | |
| 
 | |
|             // 和HIS交互
 | |
|             new RecipeService().recipeListPay(MerchantEnum.WX, totalFee.toString(), openid, outTradeNo, bankTransNo, null, payDate, payTime, payInfo);
 | |
| 
 | |
|         } catch (ServiceException e) {
 | |
|             Result.respXml(response, WxRespHelper.resp(e)); // 收到请求-解析成功
 | |
|         }
 | |
|     }
 | |
| 
 | |
| //
 | |
| //	public static void main(String[] args) throws Exception {
 | |
| //		DBDao dbDao = new DBDao();
 | |
| //		boolean refundResult = dbDao.refund(2, UUID.randomUUID().toString().replace("-", ""), "111", 1, "缴费失败退款");
 | |
| //	}
 | |
| 
 | |
| }
 | |
| 
 |