|
|
@@ -14,6 +14,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.google.gson.internal.LinkedTreeMap;
|
|
|
import com.yami.shop.bean.enums.DvyType;
|
|
|
import com.yami.shop.bean.enums.OrderStatus;
|
|
|
import com.yami.shop.bean.model.*;
|
|
|
@@ -21,9 +22,10 @@ import com.yami.shop.bean.param.*;
|
|
|
import com.yami.shop.bean.vo.OrderCountVo;
|
|
|
import com.yami.shop.common.config.Constant;
|
|
|
import com.yami.shop.common.exception.GlobalException;
|
|
|
+import com.yami.shop.common.util.HttpUtil;
|
|
|
import com.yami.shop.common.util.PageParam;
|
|
|
import com.yami.shop.common.util.R;
|
|
|
-import com.yami.shop.dao.ExportTaskMapper;
|
|
|
+import com.yami.shop.config.SMConstants;
|
|
|
import com.yami.shop.security.comment.dao.AppConnectMapper;
|
|
|
import com.yami.shop.security.comment.model.AppConnect;
|
|
|
import com.yami.shop.security.platform.util.SecurityUtils;
|
|
|
@@ -33,17 +35,13 @@ import com.yami.shop.utils.CullenUtils;
|
|
|
import com.yami.shop.wx.service.impl.WxProviderServiceImpl;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import lombok.extern.log4j.Log4j;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -213,29 +211,42 @@ public class OrderController {
|
|
|
orderParam.setUserId(order.getUserId());
|
|
|
|
|
|
orderService.delivery(orderParam);
|
|
|
+ pushDeliveryInfo(order);
|
|
|
|
|
|
for (OrderItem orderItem : orderItems) {
|
|
|
productService.removeProductCacheByProdId(orderItem.getProdId());
|
|
|
skuService.removeSkuCacheBySkuId(orderItem.getSkuId(), orderItem.getProdId());
|
|
|
}
|
|
|
-
|
|
|
- OrderSettlement settlement = orderSettlementService.getOne(new LambdaQueryWrapper<OrderSettlement>().eq(OrderSettlement::getOrderNumber, deliveryOrderParam.getOrderNumber()));
|
|
|
- UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());
|
|
|
- AppConnect connect = appConnectMapper.getByUserId(order.getUserId(), 1);
|
|
|
- Delivery delivery = deliveryService.getById(deliveryOrderParam.getDvyId());
|
|
|
- CullenUtils.validateDataThrowException(connect == null, "openid不存在..." + order.getUserId());
|
|
|
- CullenUtils.validateDataThrowException(connect.getBizUserId() == null, "openid不存在..." + order.getUserId());
|
|
|
- WxProviderServiceImpl.uploadShippingInfo(
|
|
|
- deliveryOrderParam.getDvyFlowId(),
|
|
|
- settlement.getBizPayNo(),
|
|
|
- toOrderStr(orderItems),
|
|
|
- userAddrOrder.getMobile(),
|
|
|
- connect.getBizUserId(),
|
|
|
- delivery.getDvyNo(), 1
|
|
|
- );
|
|
|
+ if (!order.getOrderType().equals(4)){
|
|
|
+ OrderSettlement settlement = orderSettlementService.getOne(new LambdaQueryWrapper<OrderSettlement>().eq(OrderSettlement::getOrderNumber, deliveryOrderParam.getOrderNumber()));
|
|
|
+ UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());
|
|
|
+ AppConnect connect = appConnectMapper.getByUserId(order.getUserId(), 1);
|
|
|
+ Delivery delivery = deliveryService.getById(deliveryOrderParam.getDvyId());
|
|
|
+ CullenUtils.validateDataThrowException(connect == null, "openid不存在..." + order.getUserId());
|
|
|
+ CullenUtils.validateDataThrowException(connect.getBizUserId() == null, "openid不存在..." + order.getUserId());
|
|
|
+ WxProviderServiceImpl.uploadShippingInfo(
|
|
|
+ deliveryOrderParam.getDvyFlowId(),
|
|
|
+ settlement.getBizPayNo(),
|
|
|
+ toOrderStr(orderItems),
|
|
|
+ userAddrOrder.getMobile(),
|
|
|
+ connect.getBizUserId(),
|
|
|
+ delivery.getDvyNo(), 1
|
|
|
+ );
|
|
|
+ }
|
|
|
return R.SUCCESS();
|
|
|
}
|
|
|
|
|
|
+ private void pushDeliveryInfo(Order order) {
|
|
|
+ if (order.getOrderType().equals(4)) {
|
|
|
+ Map<Object, Object> map = new LinkedTreeMap<>();
|
|
|
+ map.put("orderNumber", order.getOrderNumber());
|
|
|
+ map.put("dvyId", order.getDvyId());
|
|
|
+ map.put("dvyFlowId", order.getDvyFlowId());
|
|
|
+ map.put("dvyTime", order.getDvyTime());
|
|
|
+ HttpUtil.post(SMConstants.SM_BASE_URL + "/api/v1/order/updateDeliveryStatus", map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 配送订单模块
|
|
|
*/
|