| @@ -103,15 +103,11 @@ public class OrderExpiringSchedule { | |||
| public void orderExpireSchedule() { | |||
| List<WxMall> malls = getMalls(); | |||
| for (WxMall mall : malls) { | |||
| for (EnumPayWay payWay: EnumPayWay.values()) { | |||
| if(null != payWay.getPlat()) { | |||
| orderExpireSchedule(payWay,mall.getTenantId()); | |||
| } | |||
| } | |||
| orderExpireSchedule(mall.getTenantId()); | |||
| } | |||
| } | |||
| private void orderExpireSchedule(EnumPayWay payWay,String tenantId) { | |||
| private void orderExpireSchedule(String tenantId) { | |||
| Map dateMap = new HashMap(); | |||
| Date curDate = new Date(); | |||
| @@ -128,7 +124,7 @@ public class OrderExpiringSchedule { | |||
| if (null != orderCoupons && orderCoupons.size() > 0) { | |||
| orderCoupons.stream().forEach( o -> { | |||
| try { | |||
| proxy.orderExpired(o,true,payWay); | |||
| proxy.orderExpired(o,true); | |||
| } catch (Exception e) { | |||
| logger.error("券过期失败" + e.getMessage()); | |||
| } | |||
| @@ -145,7 +141,7 @@ public class OrderExpiringSchedule { | |||
| if (null != orderPresss && orderPresss.size() > 0) { | |||
| orderPresss.stream().forEach( o -> { | |||
| try { | |||
| proxy.orderPressExpired(o, true,true,payWay); | |||
| proxy.orderPressExpired(o, true,true); | |||
| } catch (Exception e) { | |||
| logger.error("砍价券支付过期失败" + e.getMessage()); | |||
| } | |||
| @@ -159,7 +155,7 @@ public class OrderExpiringSchedule { | |||
| if (null != orderPresss && orderPresss.size() > 0) { | |||
| orderPresss.stream().forEach( o -> { | |||
| try { | |||
| proxy.orderPressExpired(o, false,true,payWay); | |||
| proxy.orderPressExpired(o, false,true); | |||
| } catch (Exception e) { | |||
| logger.error("砍价券过期失败" +e.getMessage()); | |||
| } | |||
| @@ -177,7 +173,7 @@ public class OrderExpiringSchedule { | |||
| if (null != orderGroups && orderGroups.size() > 0) { | |||
| orderGroups.stream().forEach( o -> { | |||
| try { | |||
| proxy.orderGroupExpired(o,true,true,payWay); | |||
| proxy.orderGroupExpired(o,true,true); | |||
| } catch (Exception e) { | |||
| logger.error("砍价券支付过期失败" + e.getMessage()); | |||
| } | |||
| @@ -194,7 +190,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.expiredAndReturnMoney((WxOrder) o,false,payWay); | |||
| proxy.expiredAndReturnMoney((WxOrder) o,false); | |||
| } catch (Exception e) { | |||
| logger.error("拼团过期退款失败" + e.getMessage()); | |||
| } | |||
| @@ -208,7 +204,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.returnMoney((WxOrder) o,payWay); | |||
| proxy.returnMoney((WxOrder) o); | |||
| } catch (Exception e) { | |||
| logger.error("拼团券下架退款失败" + e.getMessage()); | |||
| } | |||
| @@ -221,7 +217,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.expiredAndReturnMoney((WxOrder) o,true,payWay); | |||
| proxy.expiredAndReturnMoney((WxOrder) o,true); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败退款失败" + e.getMessage()); | |||
| } | |||
| @@ -234,7 +230,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.expiredAndReturnMoney((WxOrder) o,false,payWay); | |||
| proxy.expiredAndReturnMoney((WxOrder) o,false); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败退款失败" + e.getMessage()); | |||
| } | |||
| @@ -247,7 +243,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.expiredCheckAndReturnMoney((WxOrder) o,payWay); | |||
| proxy.expiredCheckAndReturnMoney((WxOrder) o); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败退款失败" + e.getMessage()); | |||
| } | |||
| @@ -260,7 +256,7 @@ public class OrderExpiringSchedule { | |||
| if (null != _orderList && _orderList.size() > 0) { | |||
| _orderList.stream().forEach(o -> { | |||
| try { | |||
| proxy.returnMoney((WxOrder) o,payWay); | |||
| proxy.returnMoney((WxOrder) o); | |||
| } catch (Exception e) { | |||
| logger.error("参团失败退款失败" + e.getMessage()); | |||
| } | |||
| @@ -269,23 +265,23 @@ public class OrderExpiringSchedule { | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void expiredCheckAndReturnMoney(WxOrder wxOrder,EnumPayWay payWay) throws MallinkException, Exception { | |||
| if (wxPaySuccess(wxOrder, false, payWay)) { | |||
| orderGroupExpired(wxOrder,false,false,payWay); | |||
| returnMoney(wxOrder,payWay); | |||
| public void expiredCheckAndReturnMoney(WxOrder wxOrder) throws MallinkException, Exception { | |||
| if (wxPaySuccess(wxOrder, false)) { | |||
| orderGroupExpired(wxOrder,false,false); | |||
| returnMoney(wxOrder); | |||
| }else { | |||
| orderGroupExpired(wxOrder,false,true,payWay); | |||
| orderGroupExpired(wxOrder,false,true); | |||
| } | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void expiredAndReturnMoney(WxOrder wxOrder,boolean checkRealPay,EnumPayWay payWay) throws MallinkException, Exception { | |||
| orderGroupExpired(wxOrder,checkRealPay,false,payWay); | |||
| returnMoney(wxOrder,payWay); | |||
| public void expiredAndReturnMoney(WxOrder wxOrder,boolean checkRealPay) throws MallinkException, Exception { | |||
| orderGroupExpired(wxOrder,checkRealPay,false); | |||
| returnMoney(wxOrder); | |||
| } | |||
| public boolean wxPaySuccess(WxOrder order,boolean autoReHandle,EnumPayWay payWay) throws MallinkException, Exception { | |||
| public boolean wxPaySuccess(WxOrder order,boolean autoReHandle) throws MallinkException, Exception { | |||
| WxPayOrder payOrderq = new WxPayOrder(); | |||
| payOrderq.setOrderId(order.getComposeOrderId()); | |||
| payOrderq.setTenantId(order.getTenantId()); | |||
| @@ -310,6 +306,13 @@ public class OrderExpiringSchedule { | |||
| // if (null == cUser) { | |||
| // return true; | |||
| // } | |||
| if (null == order.getPayVendor()) { | |||
| return false; | |||
| } | |||
| EnumPayWay payWay = EnumPayWay.getEnum(order.getPayVendor()); | |||
| if (null == payWay || null == payWay.getPlat()) { | |||
| return false; | |||
| } | |||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(order, payWay.getPlat()); | |||
| //WxAppinfo appInfo = wxAppinfoService.getByAppId(cUser.getAppId()); | |||
| //找不到appInfo,问题单,不能删 | |||
| @@ -343,9 +346,9 @@ public class OrderExpiringSchedule { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void orderExpired(WxOrder order,boolean checkRealPay,EnumPayWay payWay) throws MallinkException, Exception { | |||
| public void orderExpired(WxOrder order,boolean checkRealPay) throws MallinkException, Exception { | |||
| if (checkRealPay) { | |||
| if (wxPaySuccess(order,true,payWay)) { | |||
| if (wxPaySuccess(order,true)) { | |||
| return; | |||
| } | |||
| } | |||
| @@ -369,9 +372,9 @@ public class OrderExpiringSchedule { | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void orderPressExpired(WxOrder order, boolean payExpired,boolean checkRealPay,EnumPayWay payWay) throws MallinkException, Exception { | |||
| public void orderPressExpired(WxOrder order, boolean payExpired,boolean checkRealPay) throws MallinkException, Exception { | |||
| if (checkRealPay) { | |||
| if (wxPaySuccess(order,true,payWay)) { | |||
| if (wxPaySuccess(order,true)) { | |||
| return; | |||
| } | |||
| } | |||
| @@ -414,9 +417,9 @@ public class OrderExpiringSchedule { | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void orderGroupExpired(WxOrder order,boolean checkRealPay,boolean stockBack,EnumPayWay payWay) throws MallinkException, Exception { | |||
| public void orderGroupExpired(WxOrder order,boolean checkRealPay,boolean stockBack) throws MallinkException, Exception { | |||
| if (checkRealPay) { | |||
| if (wxPaySuccess(order,true,payWay)) { | |||
| if (wxPaySuccess(order,true)) { | |||
| return; | |||
| } | |||
| } | |||
| @@ -444,9 +447,9 @@ public class OrderExpiringSchedule { | |||
| * @throws MallinkException | |||
| */ | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void returnMoney(WxOrder order,EnumPayWay payWay) throws MallinkException, Exception { | |||
| public void returnMoney(WxOrder order) throws MallinkException, Exception { | |||
| //支付成功的才退款 | |||
| if (!wxPaySuccess(order,false,payWay)) { | |||
| if (!wxPaySuccess(order,false)) { | |||
| return; | |||
| } | |||