| @@ -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) { | ||||
| @@ -58,9 +58,9 @@ public class WxMsgConfigServiceImpl implements WxMsgConfigService { | |||||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | WxMsgConfig wxMsgConfig = new WxMsgConfig(); | ||||
| wxMsgConfig.updateTenantInfo(tenantInfo); | wxMsgConfig.updateTenantInfo(tenantInfo); | ||||
| wxMsgConfig.setSmsChannel(EnumSMSChannel.ALIYUN.getCode()); | wxMsgConfig.setSmsChannel(EnumSMSChannel.ALIYUN.getCode()); | ||||
| wxMsgConfig.setTotal((long) 100000); | |||||
| wxMsgConfig.setTotal((long) 5000); | |||||
| wxMsgConfig.setRecharge((long) 0); | wxMsgConfig.setRecharge((long) 0); | ||||
| wxMsgConfig.setRemains((long) 100000); | |||||
| wxMsgConfig.setRemains((long) 5000); | |||||
| wxMsgConfig.setReminderstatus(0); | wxMsgConfig.setReminderstatus(0); | ||||
| wxMsgConfigMapper.insert(wxMsgConfig); | wxMsgConfigMapper.insert(wxMsgConfig); | ||||
| } | } | ||||
| @@ -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); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -2302,7 +2314,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| public int updateOrderStatus(WxOrder updateOrder, EnumOrderStatus enumOrderStatus) { | public int updateOrderStatus(WxOrder updateOrder, EnumOrderStatus enumOrderStatus) { | ||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| WxOrder oldOrder = wxOrderMapper.selectById(updateOrder.getId(),updateOrder.getTenantId()); | WxOrder oldOrder = wxOrderMapper.selectById(updateOrder.getId(),updateOrder.getTenantId()); | ||||
| if (!oldOrder.getOrderStatus().equals(enumOrderStatus.getCode())) { | |||||
| if ((!oldOrder.getOrderStatus().equals(enumOrderStatus.getCode())) && (!oldOrder.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_OVERTIME_PAID_REFUND.getCode()))) { | |||||
| // 状态已更新,库存不退回, 保证不会多退 | // 状态已更新,库存不退回, 保证不会多退 | ||||
| switch (enumOrderStatus) { | switch (enumOrderStatus) { | ||||
| case ORDER_STATUS_OVERTIME_CANCEL: // 支付取消,库存退回 | case ORDER_STATUS_OVERTIME_CANCEL: // 支付取消,库存退回 | ||||
| @@ -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()); | ||||
| } | } | ||||
| @@ -339,7 +339,7 @@ | |||||
| o.compose_order_type,o.compose_order_id,o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`,o.parent_order_id,o.ext_param | o.compose_order_type,o.compose_order_id,o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`,o.parent_order_id,o.ext_param | ||||
| from wx_order o | from wx_order o | ||||
| where o.order_status in (0,1,2,3,4,5) | |||||
| where o.order_status in (0,1,2,3,4,5,97) | |||||
| <if test="cUserId != null"> | <if test="cUserId != null"> | ||||
| and o.c_user_id = #{cUserId} | and o.c_user_id = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -799,7 +799,7 @@ | |||||
| c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,2 attribute from wx_order o | c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,2 attribute from wx_order o | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| left join wx_coupon c on o.product_id=c.id | left join wx_coupon c on o.product_id=c.id | ||||
| where c.type in (1,2,3,4,5,6,10,50,51,66) and o.order_status in(0,1,2,3,4,5) | |||||
| where c.type in (1,2,3,4,5,6,10,50,51,66) and o.order_status in(0,1,2,3,4,5,97) | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -812,7 +812,7 @@ | |||||
| c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,6 attribute from wx_order o | c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,6 attribute from wx_order o | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| left join wx_coupon c on o.product_id=c.id | left join wx_coupon c on o.product_id=c.id | ||||
| where c.type = 11 and o.order_status in(0,1,2,3,4,5) | |||||
| where c.type = 11 and o.order_status in(0,1,2,3,4,5,97) | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -824,7 +824,7 @@ | |||||
| c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,7 attribute from wx_order o | c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,7 attribute from wx_order o | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| left join wx_coupon c on o.product_id=c.id | left join wx_coupon c on o.product_id=c.id | ||||
| where c.type = 12 and o.order_status in(0,1,2,3,4,5) | |||||
| where c.type = 12 and o.order_status in(0,1,2,3,4,5,97) | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -1139,7 +1139,7 @@ | |||||
| where c_user_id = #{cUserId} | where c_user_id = #{cUserId} | ||||
| and parent_order_id = 0 | and parent_order_id = 0 | ||||
| and (`type` = 0 or `type` = 4) | and (`type` = 0 or `type` = 4) | ||||
| and order_status in (0,1,2,3,4,5) | |||||
| and order_status in (0,1,2,3,4,5,97) | |||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| @@ -72,7 +72,7 @@ | |||||
| <if test=" null != price ">and `price` = #{price}</if> | <if test=" null != price ">and `price` = #{price}</if> | ||||
| <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if> | <if test=" null != rentalStartDate ">and `rental_start_date` = #{rentalStartDate}</if> | ||||
| <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | <if test=" null != rentalEndDate ">and `rental_end_date` = #{rentalEndDate}</if> | ||||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and and out_date_notify_days is not null and out_date_notify_days > 0 and rental_end_date <= NOW()</if> | |||||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and and out_date_notify_days is not null and out_date_notify_days > 0 </if> | |||||
| <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | <if test=" null != signDate ">and `sign_date` = #{signDate}</if> | ||||
| <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | <if test=" null != receivePeriod ">and `receive_period` = #{receivePeriod}</if> | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -156,7 +156,7 @@ | |||||
| <if test=" null != price and '' != price">and `price` = #{price}</if> | <if test=" null != price and '' != price">and `price` = #{price}</if> | ||||
| <if test=" null != rentalStartDate and '' != rentalStartDate">and `rental_start_date` = #{rentalStartDate}</if> | <if test=" null != rentalStartDate and '' != rentalStartDate">and `rental_start_date` = #{rentalStartDate}</if> | ||||
| <if test=" null != rentalEndDate and '' != rentalEndDate">and `rental_end_date` = #{rentalEndDate}</if> | <if test=" null != rentalEndDate and '' != rentalEndDate">and `rental_end_date` = #{rentalEndDate}</if> | ||||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and out_date_notify_days is not null and out_date_notify_days > 0 and rental_end_date <= NOW()</if> | |||||
| <if test=" null != outDateNofity ">and out_date_notify_phone is not null and out_date_notify_phone != '' and out_date_notify_days is not null and out_date_notify_days > 0 </if> | |||||
| <if test=" null != signDate and '' != signDate">and `sign_date` = #{signDate}</if> | <if test=" null != signDate and '' != signDate">and `sign_date` = #{signDate}</if> | ||||
| <if test=" null != receivePeriod and '' != receivePeriod">and `receive_period` = #{receivePeriod}</if> | <if test=" null != receivePeriod and '' != receivePeriod">and `receive_period` = #{receivePeriod}</if> | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||