|
@@ -9,6 +9,7 @@ import cn.hutool.http.Header;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.kxs.common.core.constant.CommonConstants;
|
|
@@ -356,12 +357,23 @@ public class LhbOrderServiceImpl extends MPJBaseServiceImpl<LhbOrderMapper, LhbO
|
|
|
orders.forEach(order -> {
|
|
|
QueryOrderReq req = QueryOrderReq.builder().orderId(order.getOutOrderSn()).build();
|
|
|
String outStatus = channelFactory.getChannel(order.getIfCode()).queryStatus(req);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<LhbOrder> updateWrapper = Wrappers.lambdaUpdate(LhbOrder.class).eq(LhbOrder::getId, order.getId()).set(LhbOrder::getOutStatus, outStatus);
|
|
|
//更新状态
|
|
|
if("41".equals(outStatus) || "2".equals(outStatus)){
|
|
|
//41-配送中,不可取消订单 2-订单成功结束
|
|
|
sendToOrder(order, "41".equals(outStatus) ? NotifyStatusEnum.DISTRIBUTION : NotifyStatusEnum.FINISH);
|
|
|
}
|
|
|
- update(Wrappers.lambdaUpdate(LhbOrder.class).eq(LhbOrder::getId, order.getId()).set(LhbOrder::getOutStatus, outStatus));
|
|
|
+ if("3".equals(outStatus)){
|
|
|
+ //3-订单异常取消
|
|
|
+ sendToOrder(order, NotifyStatusEnum.CANCEL);
|
|
|
+ //如果是0服务费直接订单也变成已取消
|
|
|
+ if(order.getServerFee().compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ updateWrapper.set(LhbOrder::getStatus, OrderStatusEnum.CANCEL.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ update(updateWrapper);
|
|
|
});
|
|
|
}
|
|
|
|