| | |
| | | import cn.lili.modules.lmk.mapper.LmkOrderSelectMapper; |
| | | import cn.lili.modules.lmk.service.CouponVirtualService; |
| | | import cn.lili.modules.member.entity.dto.MemberAddressDTO; |
| | | import cn.lili.modules.member.entity.dto.UpdateTracesDTO; |
| | | import cn.lili.modules.member.mapper.MemberMapper; |
| | | import cn.lili.modules.order.cart.entity.dto.TradeDTO; |
| | | import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateTraces(UpdateTracesDTO updateTracesDTO) { |
| | | LambdaQueryWrapper<OrderPackage> eq = Wrappers.<OrderPackage>lambdaQuery() |
| | | .eq(OrderPackage::getOrderSn, updateTracesDTO.getOrderSn()) |
| | | .eq(OrderPackage::getPackageNo, updateTracesDTO.getPackageNo()); |
| | | OrderPackage one = orderPackageService.getOne(eq); |
| | | if (one == null) { |
| | | throw new ServiceException("当前包裹不存在"); |
| | | } |
| | | |
| | | String logisticsId = updateTracesDTO.getLogisticsId(); |
| | | if (StringUtils.isNotBlank(logisticsId)) { |
| | | Logistics logic = logisticsService.getById(logisticsId); |
| | | one.setLogisticsNo(updateTracesDTO.getLogisticsNo()); |
| | | one.setLogisticsCode(logic.getCode()); |
| | | one.setLogisticsName(logic.getName()); |
| | | orderPackageService.updateById(one); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Traces getMapTraces(String orderSn) { |
| | | //获取订单信息 |
| | | Order order = this.getBySn(orderSn); |
| | |
| | | checkBatchDeliver(orderBatchDeliverDTOList); |
| | | //订单批量发货 |
| | | for (OrderBatchDeliverDTO orderBatchDeliverDTO : orderBatchDeliverDTOList) { |
| | | this.delivery(orderBatchDeliverDTO.getOrderSn(), orderBatchDeliverDTO.getLogisticsNo(), orderBatchDeliverDTO.getLogisticsId()); |
| | | String logisticsNo = orderBatchDeliverDTO.getLogisticsNo(); |
| | | String[] split = logisticsNo.split(","); |
| | | //如果物流单号包含多个,则进行拆单 |
| | | if (split.length > 1) { |
| | | for (int i = 0; i < split.length; i++) { |
| | | PartDeliveryParamsDTO partDeliveryParamsDTO = new PartDeliveryParamsDTO(); |
| | | partDeliveryParamsDTO.setOrderSn(orderBatchDeliverDTO.getOrderSn()); |
| | | partDeliveryParamsDTO.setLogisticsNo(split[i]); |
| | | partDeliveryParamsDTO.setLogisticsId(orderBatchDeliverDTO.getLogisticsId()); |
| | | ArrayList<PartDeliveryDTO> partDeliveryDTOList = new ArrayList<>(); |
| | | partDeliveryParamsDTO.setPartDeliveryDTOList(partDeliveryDTOList); |
| | | if (i == split.length - 1){ |
| | | List<OrderItem> orderItemList = orderItemService.getByOrderSn(orderBatchDeliverDTO.getOrderSn()); |
| | | for (OrderItem orderItem : orderItemList) { |
| | | if (RefundStatusEnum.NO_REFUND.name().equals(orderItem.getIsRefund())) { |
| | | PartDeliveryDTO partDeliveryDTO = new PartDeliveryDTO(); |
| | | partDeliveryDTO.setDeliveryNum(orderItem.getNum()); |
| | | partDeliveryDTO.setOrderItemId(orderItem.getId()); |
| | | partDeliveryDTOList.add(partDeliveryDTO); |
| | | } |
| | | } |
| | | } |
| | | this.partDelivery(partDeliveryParamsDTO); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // 提取商品名(注意:键是resultMap中定义的property值"goodsName") |
| | | if (Objects.nonNull(map.get("goodsName"))) { |
| | | String goodsName = map.get("goodsName").toString(); |
| | | goodsData.add(goodsName); |
| | | String buyerCount = map.get("buyerCount").toString(); |
| | | String repurchaseBuyerCount = map.get("repurchaseBuyerCount").toString(); |
| | | String format = String.format("%s:购买人数 %s 复购人数%s", goodsName, buyerCount, repurchaseBuyerCount); |
| | | goodsData.add(format); |
| | | } |
| | | |
| | | // 提取复购率(复购率通常是数字类型,这里用BigDecimal接收) |