| @@ -168,14 +168,6 @@ public class OrderExpiringSchedule { | |||||
| // 拼团取消 | // 拼团取消 | ||||
| WxOrder order = new WxOrder(); | WxOrder order = new WxOrder(); | ||||
| // order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||||
| // wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | |||||
| // try { | |||||
| // proxy.orderGroupExpired((WxOrder) o,true,true,payWay); | |||||
| // } catch (Exception e) { | |||||
| // logger.error("拼团取消失败" + e.getMessage()); | |||||
| // } | |||||
| // }); | |||||
| Date groupExpireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | Date groupExpireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", groupExpireDate); | dateMap.put("endDate", groupExpireDate); | ||||
| @@ -260,6 +252,19 @@ public class OrderExpiringSchedule { | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| //此处是订单已取消,但是已支付成功的,仅需退款(取消的时候退过一次库存。此状态退款回调不会再回滚库存) | |||||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_PAID_REFUND.getCode()); | |||||
| _orderList = wxOrderMapper.selectList(new QueryWrapper(order)); | |||||
| if (null != _orderList && _orderList.size() > 0) { | |||||
| _orderList.stream().forEach(o -> { | |||||
| try { | |||||
| proxy.returnMoney((WxOrder) o,payWay); | |||||
| } catch (Exception e) { | |||||
| logger.error("参团失败退款失败" + e.getMessage()); | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -28,7 +28,8 @@ public enum EnumOrderStatus { | |||||
| ORDER_STATUS_COOPERATING_UNPAID(15, "拼团待付款"),//占库存 | ORDER_STATUS_COOPERATING_UNPAID(15, "拼团待付款"),//占库存 | ||||
| ORDER_STATUS_COOPERATING_BREAK(16, "拼团取消"), | ORDER_STATUS_COOPERATING_BREAK(16, "拼团取消"), | ||||
| ORDER_STATUS_COOPERATING_SCHEDU_REFUND(99,"订单定时状态-需要返款和回滚库存,无需再次查询真实支付状态"), | ORDER_STATUS_COOPERATING_SCHEDU_REFUND(99,"订单定时状态-需要返款和回滚库存,无需再次查询真实支付状态"), | ||||
| ORDER_STATUS_COOPERATING_COMPLETE_REFUND(98,"拼团完成会更新未支付的为此状态,未有效的订单统一置成该状态") | |||||
| ORDER_STATUS_COOPERATING_COMPLETE_REFUND(98,"拼团完成会更新未支付的为此状态,未有效的订单统一置成该状态"), | |||||
| ORDER_STATUS_OVERTIME_PAID_REFUND(97,"订单已取消.订单超时前打开收银台,超时后输入密码进行支付,此时仅需要退款") | |||||
| ; | ; | ||||
| public static EnumOrderStatus getEnum(Integer code) { | public static EnumOrderStatus getEnum(Integer code) { | ||||
| @@ -740,6 +740,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_SCHEDU_REFUND.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_SCHEDU_REFUND.getCode()); | ||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode()); | ||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_OVERTIME_PAID_REFUND.getCode()); | |||||
| orderQ.setStatusS(statusS); | orderQ.setStatusS(statusS); | ||||
| WxCoupon couponQ = new WxCoupon(); | WxCoupon couponQ = new WxCoupon(); | ||||
| @@ -2021,33 +2022,44 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| logger.error("用户不存在, userId: " + updateOrder.getCUserId()); | logger.error("用户不存在, userId: " + updateOrder.getCUserId()); | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | throw new MallinkException(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| // 已支付,更新支付时间 | |||||
| WxOrder updateT = new WxOrder(); | |||||
| updateT.setId(updateOrder.getId()); | |||||
| updateT.setPaymentTime(currentDate); | |||||
| updateT.updateTenantInfo(updateOrder); | |||||
| //拼团到此处为已完成状态 | |||||
| if (updateOrder.getOrderGroupId().equals(0L)) { | |||||
| updateT.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| } else { | |||||
| // 拼团设为已完成状态 | |||||
| updateT.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | |||||
| } | |||||
| updateT.setUpdateDate(currentDate); | |||||
| int ret = 0; | |||||
| try { | |||||
| ret = wxOrderMapper.updateById(updateT); | |||||
| } catch (Exception e) { | |||||
| logger.error("订单更新失败:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_UPDATE_ERR); | |||||
| } | |||||
| // 创建couponOrder | |||||
| try { | |||||
| return createCouponOrder(currentDate,updateOrder, user, coupon, null,null,null,null,null,null); | |||||
| } catch (Exception e) { | |||||
| logger.error("创建券包:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||||
| // 如果订单状态此时已经被超时取消 | |||||
| WxOrder order = wxOrderMapper.selectById(updateOrder.getId(), updateOrder.getTenantId()); | |||||
| if (order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()) || order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_PRESS_OVERTIME.getCode()) | |||||
| || order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode())) { | |||||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_PAID_REFUND.getCode()); | |||||
| order.setUpdateDate(currentDate); | |||||
| wxOrderMapper.updateById(order); | |||||
| return null; | |||||
| }else { | |||||
| // 已支付,更新支付时间 | |||||
| WxOrder updateT = new WxOrder(); | |||||
| updateT.setId(updateOrder.getId()); | |||||
| updateT.setPaymentTime(currentDate); | |||||
| updateT.updateTenantInfo(updateOrder); | |||||
| //拼团到此处为已完成状态 | |||||
| if (updateOrder.getOrderGroupId().equals(0L)) { | |||||
| updateT.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| } else { | |||||
| // 拼团设为已完成状态 | |||||
| updateT.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | |||||
| } | |||||
| updateT.setUpdateDate(currentDate); | |||||
| int ret = 0; | |||||
| try { | |||||
| ret = wxOrderMapper.updateById(updateT); | |||||
| } catch (Exception e) { | |||||
| logger.error("订单更新失败:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_UPDATE_ERR); | |||||
| } | |||||
| // 创建couponOrder | |||||
| try { | |||||
| return createCouponOrder(currentDate,updateOrder, user, coupon, null,null,null,null,null,null); | |||||
| } catch (Exception e) { | |||||
| logger.error("创建券包:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -958,17 +958,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| // 普通券, 修改订单状态 | // 普通券, 修改订单状态 | ||||
| try { | try { | ||||
| WxCouponOrder couponOrder = wxOrderService.couponOrderSuccess(order); | WxCouponOrder couponOrder = wxOrderService.couponOrderSuccess(order); | ||||
| // try { | |||||
| // WxAppinfo appinfo = wxAppinfoService.getCAppInfo(order,EnumPayWay.getEnum(record.getPayVendor()).getPlat()); | |||||
| // //订单同步 | |||||
| // payServiceFactory.getPayAdapterService(record.getPayVendor()).payOrderPush(appinfo, order, record, wxCoupon); | |||||
| // }catch (Exception e) { | |||||
| // logger.error("doOthersAfterPaySuccess----error"+e.getMessage()); | |||||
| // } | |||||
| try{ | try{ | ||||
| orderFactory.getOrderAdapterService(record.getComposeOrder()).doOthersAfterPaySuccess(order, record,couponOrder); | |||||
| if (null != couponOrder) { | |||||
| orderFactory.getOrderAdapterService(record.getComposeOrder()).doOthersAfterPaySuccess(order, record,couponOrder); | |||||
| } | |||||
| }catch (Exception e) { | }catch (Exception e) { | ||||
| logger.error("doOthersAfterPaySuccess----error"+e.getMessage()); | logger.error("doOthersAfterPaySuccess----error"+e.getMessage()); | ||||
| } | } | ||||