diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java
index 5c6a14fbb..d5e9dbfe1 100644
--- a/mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java
+++ b/mallinkSchedule/src/main/java/com/iformall/schedule/OrderExpiringSchedule.java
@@ -168,14 +168,6 @@ public class OrderExpiringSchedule {
// 拼团取消
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 );
dateMap.put("type", EnumOrderType.COUPON.getCode());
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})
diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumOrderStatus.java b/mallinkService/src/main/java/com/iformall/enums/EnumOrderStatus.java
index 77346978b..2c801f0cb 100644
--- a/mallinkService/src/main/java/com/iformall/enums/EnumOrderStatus.java
+++ b/mallinkService/src/main/java/com/iformall/enums/EnumOrderStatus.java
@@ -28,7 +28,8 @@ public enum EnumOrderStatus {
ORDER_STATUS_COOPERATING_UNPAID(15, "拼团待付款"),//占库存
ORDER_STATUS_COOPERATING_BREAK(16, "拼团取消"),
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) {
diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgConfigServiceImpl.java
index 8bcb8b7be..a9791f6f2 100644
--- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgConfigServiceImpl.java
+++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgConfigServiceImpl.java
@@ -58,9 +58,9 @@ public class WxMsgConfigServiceImpl implements WxMsgConfigService {
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.updateTenantInfo(tenantInfo);
wxMsgConfig.setSmsChannel(EnumSMSChannel.ALIYUN.getCode());
- wxMsgConfig.setTotal((long) 100000);
+ wxMsgConfig.setTotal((long) 5000);
wxMsgConfig.setRecharge((long) 0);
- wxMsgConfig.setRemains((long) 100000);
+ wxMsgConfig.setRemains((long) 5000);
wxMsgConfig.setReminderstatus(0);
wxMsgConfigMapper.insert(wxMsgConfig);
}
diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
index c2b6c71ed..70cce4adf 100644
--- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
+++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
@@ -740,6 +740,7 @@ public class WxOrderServiceImpl implements WxOrderService {
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_SCHEDU_REFUND.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode());
+ statusS.add(EnumOrderStatus.ORDER_STATUS_OVERTIME_PAID_REFUND.getCode());
orderQ.setStatusS(statusS);
WxCoupon couponQ = new WxCoupon();
@@ -2021,33 +2022,44 @@ public class WxOrderServiceImpl implements WxOrderService {
logger.error("用户不存在, userId: " + updateOrder.getCUserId());
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) {
Date currentDate = new Date();
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) {
case ORDER_STATUS_OVERTIME_CANCEL: // 支付取消,库存退回
diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
index 9024e39e8..079959a49 100644
--- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
+++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
@@ -958,17 +958,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
// 普通券, 修改订单状态
try {
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{
- orderFactory.getOrderAdapterService(record.getComposeOrder()).doOthersAfterPaySuccess(order, record,couponOrder);
+ if (null != couponOrder) {
+ orderFactory.getOrderAdapterService(record.getComposeOrder()).doOthersAfterPaySuccess(order, record,couponOrder);
+ }
}catch (Exception e) {
logger.error("doOthersAfterPaySuccess----error"+e.getMessage());
}
diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml
index 05b1af88b..e1e953e4f 100644
--- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml
@@ -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
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)
and o.c_user_id = #{cUserId}
@@ -799,7 +799,7 @@
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_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)
and o.`tenant_id` = #{tenantId}
@@ -812,7 +812,7 @@
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_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)
and o.`tenant_id` = #{tenantId}
@@ -824,7 +824,7 @@
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_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)
and o.`tenant_id` = #{tenantId}
@@ -1139,7 +1139,7 @@
where c_user_id = #{cUserId}
and parent_order_id = 0
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 `parent_tenant_id` = #{parentTenantId}
diff --git a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
index 2b40efc2d..5e783f54c 100644
--- a/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxPropertyContractMapper.xml
@@ -72,7 +72,7 @@
and `price` = #{price}
and `rental_start_date` = #{rentalStartDate}
and `rental_end_date` = #{rentalEndDate}
- 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()
+ 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 `sign_date` = #{signDate}
and `receive_period` = #{receivePeriod}
diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml
index 48aff48f7..8a719a5f5 100644
--- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml
@@ -156,7 +156,7 @@
and `price` = #{price}
and `rental_start_date` = #{rentalStartDate}
and `rental_end_date` = #{rentalEndDate}
- 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()
+ 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 `sign_date` = #{signDate}
and `receive_period` = #{receivePeriod}