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.
89 lines
3.8 KiB
89 lines
3.8 KiB
//package com.ynxbd.wx.servlet.pay;
|
|
//
|
|
//import com.ynxbd.common.action.pay.PEnum;
|
|
//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.*;
|
|
//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.annotation.WebServlet;
|
|
//import javax.servlet.http.HttpServlet;
|
|
//import javax.servlet.http.HttpServletRequest;
|
|
//import javax.servlet.http.HttpServletResponse;
|
|
//import java.math.BigDecimal;
|
|
//import java.util.Date;
|
|
//
|
|
///**
|
|
// * [微信]回调通知
|
|
// *
|
|
// * @Author wsq
|
|
// * @Date 2020/11/19 10:36
|
|
// * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
|
// */
|
|
//@Slf4j
|
|
//@WebServlet("/notify/wx_pay_notify_servlet")
|
|
//public class WxPayNotifyServlet extends HttpServlet {
|
|
//
|
|
// @Override
|
|
// protected void doPost(HttpServletRequest request, HttpServletResponse response) {
|
|
// MDC.remove("ip");
|
|
// MDC.put("ip", HttpHelper.getIpAddress(request));
|
|
//
|
|
// try {
|
|
// WxPayNotify notifyInfo = WxPayHelper.newPayNotify(request);
|
|
// Result.respXml(response, WxRespHelper.respOk()); // 收到请求-解析成功
|
|
//
|
|
// String openid = notifyInfo.getOpenid();
|
|
// String bankTransNo = notifyInfo.getTransactionId();
|
|
// String outTradeNo = notifyInfo.getOutTradeNo();
|
|
// String payInfo = notifyInfo.getPayInfo();
|
|
// BigDecimal totalFee = notifyInfo.getTotalFee();
|
|
// String payDate = notifyInfo.getPayDate();
|
|
// String payTime = notifyInfo.getPayTime();
|
|
//
|
|
// String notifyType = notifyInfo.getAttach();
|
|
//
|
|
// log.info("【微信】[{}]收到通知 outTradeNo={}, bankTransNo={}", notifyType, outTradeNo, bankTransNo);
|
|
//
|
|
// switch (PEnum.toEnum(notifyType)) {
|
|
// case RECIPE:
|
|
// new RecipeService().recipeListPay(MerchantEnum.WX, totalFee.toString(), openid, outTradeNo, bankTransNo, null, payDate, payTime, payInfo);
|
|
// break;
|
|
//
|
|
// case REG: // 挂号
|
|
// try {
|
|
// new RegService().regPaidNotify(MerchantEnum.WX, totalFee, openid, bankTransNo, outTradeNo, null, payDate, payTime, payInfo, new Date());
|
|
// } catch (ServiceException e) {
|
|
// log.info("【微信】[挂号]通知异常 outTradeNo={}, bankTransNo={}, message={}", outTradeNo, bankTransNo, e.getMessage());
|
|
// }
|
|
// break;
|
|
//
|
|
// case IN_HOSP:
|
|
// boolean isInsert = new InHospService().inHospNotify(MerchantEnum.WX, openid, totalFee, outTradeNo, bankTransNo, payDate, payTime, payInfo);
|
|
// log.info("【微信】[住院预交金] 预存{}", (isInsert ? "成功" : "失败"));
|
|
// break;
|
|
//
|
|
// case CASEBOOK:
|
|
// new CasebookService().payNotify(MerchantEnum.WX, openid, totalFee, outTradeNo, bankTransNo, payInfo);
|
|
// break;
|
|
//
|
|
// case OUT_COLLECT:
|
|
// new OutCollectService().ocPayNotify(MerchantEnum.WX, openid, totalFee, outTradeNo, bankTransNo, payInfo);
|
|
// break;
|
|
//
|
|
// default:
|
|
// log.info("【微信】通知类型错误,结束请求");
|
|
// break;
|
|
// }
|
|
//
|
|
// } catch (ServiceException e) {
|
|
// Result.respXml(response, WxRespHelper.resp(e)); // 收到请求-解析失败
|
|
// }
|
|
// }
|
|
//}
|
|
|