| @@ -192,10 +192,11 @@ public class AliPayController extends BaseController { | |||||
| * @throws Exception 可能产生的任何异常 | * @throws Exception 可能产生的任何异常 | ||||
| */ | */ | ||||
| @RequestMapping(value = "/notify") | @RequestMapping(value = "/notify") | ||||
| public void __Notify(@RequestParam Map<String, Object> paramMap) throws Exception { | |||||
| public String __Notify(@RequestParam Map<String, Object> paramMap) throws Exception { | |||||
| String msgMethod = (String) paramMap.get("msg_method"); | String msgMethod = (String) paramMap.get("msg_method"); | ||||
| if (StringUtils.isBlank(msgMethod)) { | if (StringUtils.isBlank(msgMethod)) { | ||||
| logger.error("alipay notify notify error. msg_method empity:"+paramMap); | logger.error("alipay notify notify error. msg_method empity:"+paramMap); | ||||
| return "fail"; | |||||
| }else { | }else { | ||||
| //支付成功 | //支付成功 | ||||
| if ("alipay.business.mall.trade.success".equals(msgMethod)) { | if ("alipay.business.mall.trade.success".equals(msgMethod)) { | ||||
| @@ -218,6 +219,7 @@ public class AliPayController extends BaseController { | |||||
| }*/ | }*/ | ||||
| if (StringUtils.isBlank(bizContent)) { | if (StringUtils.isBlank(bizContent)) { | ||||
| logger.error("alipay notify notify error. bizContent empity:"+paramMap); | logger.error("alipay notify notify error. bizContent empity:"+paramMap); | ||||
| return "fail"; | |||||
| }else { | }else { | ||||
| JSONObject jo = JSON.parseObject(bizContent); | JSONObject jo = JSON.parseObject(bizContent); | ||||
| String gmtPayment = jo.getString("gmt_payment");//付款时间 | String gmtPayment = jo.getString("gmt_payment");//付款时间 | ||||
| @@ -234,7 +236,10 @@ public class AliPayController extends BaseController { | |||||
| String mallName = jo.getString("mall_name"); | String mallName = jo.getString("mall_name"); | ||||
| WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | ||||
| if(merchant == null){return;} | |||||
| if(merchant == null){ | |||||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||||
| return "fail"; | |||||
| } | |||||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | ||||
| aliBusinessCircleOrder.updateTenantInfo(merchant); | aliBusinessCircleOrder.updateTenantInfo(merchant); | ||||
| aliBusinessCircleOrder.setTransactionId(tradeNo); | aliBusinessCircleOrder.setTransactionId(tradeNo); | ||||
| @@ -247,13 +252,14 @@ public class AliPayController extends BaseController { | |||||
| aliBusinessCircleOrder.setMallName(mallName); | aliBusinessCircleOrder.setMallName(mallName); | ||||
| aliBusinessCircleOrderService.createOrder(aliBusinessCircleOrder); | aliBusinessCircleOrderService.createOrder(aliBusinessCircleOrder); | ||||
| return "success"; | |||||
| } | } | ||||
| //退款成功 | //退款成功 | ||||
| }else if ("alipay.business.mall.trade.refunded".equals(msgMethod)) { | }else if ("alipay.business.mall.trade.refunded".equals(msgMethod)) { | ||||
| String bizContent = (String) paramMap.get("biz_content"); | String bizContent = (String) paramMap.get("biz_content"); | ||||
| if (StringUtils.isBlank(bizContent)) { | if (StringUtils.isBlank(bizContent)) { | ||||
| logger.error("alipay notify notify error. bizContent empity:"+paramMap); | logger.error("alipay notify notify error. bizContent empity:"+paramMap); | ||||
| return "fail"; | |||||
| }else { | }else { | ||||
| JSONObject jo = JSON.parseObject(bizContent); | JSONObject jo = JSON.parseObject(bizContent); | ||||
| String gmtRefundPay = jo.getString("gmt_refund_pay");//退款时间 | String gmtRefundPay = jo.getString("gmt_refund_pay");//退款时间 | ||||
| @@ -268,7 +274,10 @@ public class AliPayController extends BaseController { | |||||
| String mallName = jo.getString("mall_name"); | String mallName = jo.getString("mall_name"); | ||||
| WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | ||||
| if(merchant == null){return;} | |||||
| if(merchant == null){ | |||||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||||
| return "fail"; | |||||
| } | |||||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | ||||
| aliBusinessCircleOrder.updateTenantInfo(merchant); | aliBusinessCircleOrder.updateTenantInfo(merchant); | ||||
| aliBusinessCircleOrder.setTransactionId(tradeNo); | aliBusinessCircleOrder.setTransactionId(tradeNo); | ||||
| @@ -280,11 +289,13 @@ public class AliPayController extends BaseController { | |||||
| aliBusinessCircleOrder.setMallName(mallName); | aliBusinessCircleOrder.setMallName(mallName); | ||||
| aliBusinessCircleOrderService.insertRefundNoticeOrder(aliBusinessCircleOrder); | aliBusinessCircleOrderService.insertRefundNoticeOrder(aliBusinessCircleOrder); | ||||
| return "success"; | |||||
| } | } | ||||
| } | |||||
| }else{ | |||||
| logger.error("alipay notify . 未知通知:"+paramMap); | |||||
| return "fail"; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||