瀏覽代碼

开放接口-计价

叶君翔 3 年之前
父節點
當前提交
8dc9192837

+ 49 - 0
lb-app/src/main/java/com/ydd/app/dto/OrderValuationDto.java

@@ -0,0 +1,49 @@
+package com.ydd.app.dto;
+
+import com.ydd.module.domain.Product;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 订单计价dto
+ * @author 叶君翔
+ * @date 2022/04/11 09:35
+ */
+@Data
+public class OrderValuationDto extends OrderValuationReq implements Serializable {
+
+    private static final long serialVersionUID = 5981360206037435895L;
+
+    /**
+     * 商户id
+     */
+    private Long merchantId;
+
+    /**
+     * 门店id
+     */
+    private Long shopId;
+
+    /**
+     * 门店名称
+     */
+    private String shopName;
+
+    /**
+     * 猎豹订单号
+     */
+    private String orderSn;
+
+    /**
+     * 物品信息
+     */
+    private Product product;
+
+    /**
+     * 取件类型(0立即取件 1预约取件)
+     */
+    private Integer takeType;
+
+}

+ 6 - 0
lb-app/src/main/java/com/ydd/app/response/OrderValuationResponse.java

@@ -1,7 +1,10 @@
 package com.ydd.app.response;
 
 import com.ydd.app.vo.OrderValuationVo;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.util.List;
 
@@ -11,6 +14,9 @@ import java.util.List;
  * @date 2022/04/11 11:22
  */
 @Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public class OrderValuationResponse {
 
     private String outOrderSn;

+ 365 - 5
lb-app/src/main/java/com/ydd/app/service/impl/OpenApiOrderValuationServiceImpl.java

@@ -1,17 +1,35 @@
 package com.ydd.app.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ydd.app.dto.OrderValuationDto;
 import com.ydd.app.dto.OrderValuationReq;
+import com.ydd.app.dto.ValuationRes;
+import com.ydd.app.response.OrderValuationResponse;
 import com.ydd.app.service.OpenApiOrderValuationService;
+import com.ydd.app.vo.OrderValuationVo;
+import com.ydd.common.constant.BillingConstant;
 import com.ydd.common.core.domain.ResponseResult;
+import com.ydd.common.enums.DeliveryTypeEnums;
 import com.ydd.common.enums.ResponseResultCodeEnum;
+import com.ydd.common.utils.SnCodeUtils;
 import com.ydd.common.utils.StringUtils;
-import com.ydd.module.domain.Shop;
-import com.ydd.module.service.IShopService;
+import com.ydd.ecloud.core.utils.BigDecimalUtils;
+import com.ydd.module.domain.*;
+import com.ydd.module.dto.*;
+import com.ydd.module.enums.*;
+import com.ydd.module.service.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
 /**
  * 开放接口-订单计价ServiceImpl
  * @author 叶君翔
@@ -24,18 +42,355 @@ public class OpenApiOrderValuationServiceImpl implements OpenApiOrderValuationSe
 
     private final IShopService iShopService;
 
+    private final IMemberService iMemberService;
+
+    private final IProductService iProductService;
+
+    private final IPackageCityConfigService iPackageCityConfigService;
+
+    private final IPackageDeliveryService iPackageDeliveryService;
+
+    private final IPackageDiscountService iPackageDiscountService;
+
+    private final IPackageDiscountDetailService iPackageDiscountDetailService;
+
+    private final IPackageCommissionService iPackageCommissionService;
+
+    private final IPackageCommissionDetailService iPackageCommissionDetailService;
+
+    private final IDspDeliveryService iDspDeliveryService;
+
+    private final IShopDeliveryDisableService iShopDeliveryDisableService;
+
+    private final IShopDeliveryService iShopDeliveryService;
+
+    private final IMemberConfigService iMemberConfigService;
+
     @Override
     public ResponseResult valuation(OrderValuationReq valuationReq) {
+        OrderValuationDto valuationDto = new OrderValuationDto();
         // 参数校验
-        ResponseResult result = this.validParam(valuationReq);
+        ResponseResult result = this.validParam(valuationReq, valuationDto);
         if (result.getCode() != ResponseResultCodeEnum.SUCCESS.getCode()) {
             return result;
         }
-        
+        Product product = iProductService.getById(valuationReq.getCategoryId());
+        if (product == null) {
+            return ResponseResult.error(ResponseResultCodeEnum.CATEGORY_NOT_EXIST);
+        }
+        valuationDto.setProduct(product);
+        valuationDto.setOrderSn(SnCodeUtils.createSn());
+        valuationDto.setTakeType(0);
+
+        // 开放平台大商户对应的用户
+        Member member = iMemberService.getOne(new QueryWrapper<Member>().eq("member_type", MemberTypeEnum.MERCHANT.type).eq("merchant_id", valuationDto.getMerchantId()));
+        // 获取最匹配的运力包(门店 > 城市 > 全国)
+        Long deliveryPackageId = iPackageCityConfigService.getPackageId(valuationDto.getShopId(), member, null, PackageCityConfigPackageTypeEnum.DELIVERY.type);
+        List<Integer> types = Lists.newArrayList();
+        PackageDeliveryDto packageDeliveryDto = null;
+        if (deliveryPackageId != null) {
+            packageDeliveryDto = iPackageDeliveryService.getDeliveryDtoByPackageIdAndDeliveryType(deliveryPackageId);
+            List<PackageDeliveryDetailDto> deliveryDetailDtoList = packageDeliveryDto.getPackageDeliveryDetailDtoList();
+            if (CollectionUtils.isNotEmpty(deliveryDetailDtoList)) {
+                types = deliveryDetailDtoList.stream().map(PackageDeliveryDetailDto::getDeliveryType).collect(Collectors.toList());
+            }
+        }
+        // 获取门店屏蔽运力
+        List<Integer> disableDeliveryTypes = iShopDeliveryDisableService.list(new QueryWrapper<ShopDeliveryDisable>()
+                .eq("shop_id", valuationDto.getShopId()).eq("deleted", 0))
+                .stream().map(ShopDeliveryDisable::getDeliveryType).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(disableDeliveryTypes)) {
+            types.removeAll(disableDeliveryTypes);
+        }
+        // 获取可用发单运力
+        List<DeliveryInfo> deliveryInfos = this.getDeliveryInfos(valuationDto, types);
+        if (CollectionUtils.isEmpty(deliveryInfos)) {
+            log.warn("无可用发单运力!");
+            return ResponseResult.error(ResponseResultCodeEnum.NO_DELIVERY);
+        }
+        List<Integer> deliveryTypes = deliveryInfos.stream().map(DspDelivery::getType).collect(Collectors.toList());
+        // 获取最匹配的优惠包(门店 > 代理商 > 全国)
+        Long discountPackageId = iPackageCityConfigService.getPackageId(valuationDto.getShopId(), member, null, PackageCityConfigPackageTypeEnum.DISCOUNT.type);
+        Map<Integer, List<PackageDiscountDetailDto>> packageDiscountMap = new HashMap<>();
+        if (discountPackageId != null) {
+            List<PackageDiscountDetailDto> discountDetailDtoList = iPackageDiscountDetailService.getDiscountListByPackageIdAndDeliveryType(discountPackageId, deliveryTypes);
+            packageDiscountMap = discountDetailDtoList.stream().collect(Collectors.groupingBy(PackageDiscountDetailDto::getDeliveryType));
+        }
+        // 获取最匹配的佣金包(门店 > 代理商 > 全国)
+        Long commissionPackageId = iPackageCityConfigService.getPackageId(valuationDto.getShopId(), member, null, PackageCityConfigPackageTypeEnum.COMMISSION.type);
+        Map<Integer, List<PackageCommissionDetailDto>> packageCommissionMap = new HashMap<>();
+        if (commissionPackageId != null) {
+            List<PackageCommissionDetailDto> commissionDetailDtoList = iPackageCommissionDetailService.getCommissionListByPackageIdAndDeliveryType(commissionPackageId, deliveryTypes);
+            packageCommissionMap = commissionDetailDtoList.stream().collect(Collectors.groupingBy(PackageCommissionDetailDto::getDeliveryType));
+        }
+        // 计价
+        List<ValuationRes> list = this.getValuationResList(member, valuationDto, deliveryInfos, packageDeliveryDto, packageDiscountMap, packageCommissionMap);
+        // 默认价格优先
+        list.sort(Comparator.comparing(ValuationRes::getDeliveryAmount));
+        // 运力包发单类型为自定义, 则先按照sort排,再按价格排
+        if (packageDeliveryDto != null && PackageDeliveryTypeEnum.CUSTOM.type.equals(packageDeliveryDto.getType())) {
+            Collections.sort(list);
+        }
+        // 处理发单运力
+        List<ValuationRes> billList = this.handleBillList(member.getId(), list);
+        // 设置发单时长
+        if (packageDeliveryDto != null) {
+            billList = this.setBillingDuration(packageDeliveryDto, billList);
+        }
+        // todo: 计价结果缓存到redis, 10分钟有效
+        // 数据转换
+        List<OrderValuationVo> valuationVos = this.convertResult(billList);
+        OrderValuationResponse response = OrderValuationResponse.builder().valuationList(valuationVos).outOrderSn(valuationReq.getOutOrderSn()).build();
+        return ResponseResult.success(response);
+    }
+
+    private List<OrderValuationVo> convertResult(List<ValuationRes> billList) {
+        // todo: 数据转换
         return null;
     }
 
-    private ResponseResult validParam(OrderValuationReq valuationReq) {
+    private List<ValuationRes> handleBillList(Long memberId, List<ValuationRes> list) {
+        // 查询下单设置推荐屏蔽运力
+        List<ValuationRes> billList = Lists.newArrayList();
+        MemberConfig config = iMemberConfigService.getOne(new QueryWrapper<MemberConfig>().eq("member_id", memberId));
+        if (config != null) {
+            if (StringUtils.isNotEmpty(config.getBillDeliveryIds())) {
+                List<String> billDeliveryIds = Arrays.asList(config.getBillDeliveryIds().split(","));
+                // 过滤出商家设置的推荐运力, 计价页面靠前显示
+                billList = list.stream().filter(a -> billDeliveryIds.contains(a.getDeliveryId().toString())).collect(Collectors.toList());
+            }
+            if (StringUtils.isNotEmpty(config.getShieldDeliveryIds())) {
+                List<String> shieldDeliveryIds = Arrays.asList(config.getShieldDeliveryIds().split(","));
+                // 过滤掉商家设置的屏蔽运力
+                list = list.stream().filter(a -> !shieldDeliveryIds.contains(a.getDeliveryId().toString())).collect(Collectors.toList());
+            }
+        }
+        list.removeAll(billList);
+        billList.addAll(list);
+
+        // 闪送距离替换
+        Optional<ValuationRes> optional = billList.stream().filter(item -> !item.getDeliveryType().equals(DeliveryTypeEnums.SHAN_SONG.getType())).findFirst();
+        if (optional.isPresent()) {
+            String desc = optional.get().getDesc();
+            for (ValuationRes res1 : billList) {
+                if (DeliveryTypeEnums.SHAN_SONG.getType().equals(res1.getDeliveryType())) {
+                    res1.setDesc(desc);
+                    break;
+                }
+            }
+        }
+        return billList;
+    }
+
+    private List<ValuationRes> getValuationResList(Member member, OrderValuationDto valuationDto, List<DeliveryInfo> deliveryInfos, PackageDeliveryDto packageDeliveryDto, Map<Integer, List<PackageDiscountDetailDto>> packageDiscountMap, Map<Integer, List<PackageCommissionDetailDto>> packageCommissionMap) {
+        List<ValuationRes> valuationResList = Lists.newArrayList();
+        for (DeliveryInfo info : deliveryInfos) {
+            // 计价
+            ValuationRes valuationRes = this.doValuation(valuationDto, info, valuationDto.getMerchantId(), valuationDto.getShopId());
+            if (valuationRes == null) {
+                continue;
+            }
+            valuationRes.setPreferredDelivery(info.getPreferredDelivery());
+            valuationRes.setOriginalMoney(valuationRes.getDeliveryAmount());
+            // 设置排序
+            if (packageDeliveryDto != null && PackageDeliveryTypeEnum.CUSTOM.type.equals(packageDeliveryDto.getType())) {
+                this.setBillingSort(packageDeliveryDto, valuationRes);
+            }
+            // 设置优惠
+            if (packageDiscountMap.size() > 0) {
+                this.setDiscountInfo(packageDiscountMap.get(info.getType()), valuationRes);
+            }
+            // 设置佣金
+            if (packageCommissionMap.size() > 0) {
+                this.setCommissionInfo(packageCommissionMap.get(info.getType()), valuationRes);
+            }
+            valuationRes.setIsMerchant(info.getIsMerchant());
+            if (valuationRes.getIsMine() == 0) {
+                // 校验余额是否充足
+                if (member.getAmount().compareTo(valuationRes.getDeliveryAmount()) >= 0) {
+                    valuationRes.setIsEnough(StatusEnum.SHOW.status);
+                }
+            }
+            valuationResList.add(valuationRes);
+        }
+        return valuationResList;
+    }
+
+    private ValuationRes doValuation(OrderValuationDto valuationDto, DeliveryInfo info, Long merchantId, Long shopId) {
+        // todo: 计价主逻辑
+        return null;
+    }
+
+    private void setBillingSort(PackageDeliveryDto packageDeliveryDto, ValuationRes valuationRes) {
+        List<PackageDeliveryDetailDto> deliveryDetailDtoList = packageDeliveryDto.getPackageDeliveryDetailDtoList();
+        if (CollectionUtils.isNotEmpty(deliveryDetailDtoList)) {
+            Optional<PackageDeliveryDetailDto> optional = deliveryDetailDtoList.stream().filter(item -> valuationRes.getDeliveryType().equals(item.getDeliveryType())).findFirst();
+            if (optional.isPresent()) {
+                PackageDeliveryDetailDto packageDeliveryDetailDto = optional.get();
+                valuationRes.setSort((packageDeliveryDetailDto.getSort() == null || packageDeliveryDetailDto.getSort() == 0) ? BillingConstant.DEFAULT_BILL_SORT : packageDeliveryDetailDto.getSort());
+            }
+        }
+    }
+
+    private List<ValuationRes> setBillingDuration(PackageDeliveryDto packageDeliveryDto, List<ValuationRes> billList) {
+        String billDurationStr = packageDeliveryDto.getBillDurationStr();
+        List<PackageDeliveryDetailDto> deliveryDetailList = packageDeliveryDto.getPackageDeliveryDetailDtoList();
+        if (StringUtils.isNotEmpty(billDurationStr) && CollectionUtils.isNotEmpty(deliveryDetailList)) {
+            String[] split = billDurationStr.split(",");
+            if (PackageDeliveryTypeEnum.CUSTOM.type.equals(packageDeliveryDto.getType())) {
+                deliveryDetailList = deliveryDetailList.stream().filter(item -> item.getSort() != null && item.getSort() > 0).collect(Collectors.toList());
+                deliveryDetailList.sort(Comparator.comparing(PackageDeliveryDetailDto::getSort));
+                for (int i = 0; i < deliveryDetailList.size(); i++) {
+                    PackageDeliveryDetailDto packageDeliveryDetailDto = deliveryDetailList.get(i);
+                    if (i < split.length) {
+                        packageDeliveryDetailDto.setBillDuration(Integer.parseInt(split[i]));
+                    }
+                }
+                for (ValuationRes valuationRes : billList) {
+                    int billDuration = BillingConstant.DEFAULT_BILL_DURATION;
+                    Optional<PackageDeliveryDetailDto> optional = deliveryDetailList.stream().filter(item -> item.getDeliveryType().equals(valuationRes.getDeliveryType())).findAny();
+                    if (optional.isPresent()) {
+                        PackageDeliveryDetailDto packageDeliveryDetailDto = optional.get();
+                        billDuration = packageDeliveryDetailDto.getBillDuration();
+                    }
+                    valuationRes.setBillDuration(billDuration == 0 ? BillingConstant.DEFAULT_BILL_DURATION : billDuration);
+                }
+            } else {
+                for (int i = 0; i < billList.size(); i++) {
+                    ValuationRes valuationRes = billList.get(i);
+                    int billDuration = BillingConstant.DEFAULT_BILL_DURATION;
+                    if (i < split.length) {
+                        billDuration = Integer.parseInt(split[i]);
+                    }
+                    valuationRes.setBillDuration(billDuration);
+                }
+            }
+        } else {
+            billList = billList.stream().map(valuationRes -> valuationRes.setBillDuration(BillingConstant.DEFAULT_BILL_DURATION)).collect(Collectors.toList());
+        }
+        return billList;
+    }
+
+    private void setCommissionInfo(List<PackageCommissionDetailDto> packageCommissionDetailDtoList, ValuationRes valuationRes) {
+        BigDecimal commission = BigDecimal.ZERO;
+        if (valuationRes.getIsMine() == 1 || DeliveryTypeEnums.HUO_LA_LA.getType().equals(valuationRes.getDeliveryType())) {
+            valuationRes.setCommission(commission);
+            return;
+        }
+        if (CollectionUtils.isNotEmpty(packageCommissionDetailDtoList) && packageCommissionDetailDtoList.size() > 0) {
+            PackageCommissionDetailDto packageCommissionDetailDto = packageCommissionDetailDtoList.get(0);
+            if (PackageCommissionTypeEnum.RATE.type.equals(packageCommissionDetailDto.getCommissionType())) {
+                if (packageCommissionDetailDto.getValue() != null) {
+                    commission = packageCommissionDetailDto.getValue().multiply(valuationRes.getDeliveryAmount())
+                            .divide(new BigDecimal("100"), BigDecimal.ROUND_HALF_UP).setScale(6, BigDecimal.ROUND_HALF_UP);
+                }
+            } else if (PackageDiscountDetailTypeEnum.GRADIENT.type.equals(packageCommissionDetailDto.getCommissionType())) {
+                for (PackageCommissionDetailDto item : packageCommissionDetailDtoList) {
+                    boolean inRange = BigDecimalUtils.inRange(item.getLeftValue(), item.getRightValue(), valuationRes.getDeliveryAmount());
+                    if (inRange) {
+                        if (item.getValue() != null) {
+                            commission = item.getValue();
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+        valuationRes.setCommission(commission);
+        valuationRes.setDeliveryAmount(commission.add(valuationRes.getDeliveryAmount()));
+    }
+
+    private void setDiscountInfo(List<PackageDiscountDetailDto> discountDetailDtoList, ValuationRes valuationRes) {
+        if (valuationRes.getIsMine() == 1) {
+            return;
+        }
+        if (CollectionUtils.isNotEmpty(discountDetailDtoList) && discountDetailDtoList.size() > 0) {
+            PackageDiscountDetailDto discountDetailDto = discountDetailDtoList.get(0);
+            if (PackageDiscountDetailTypeEnum.ZHE_KOU.type.equals(discountDetailDto.getType())) {
+                if (discountDetailDto.getValue() != null) {
+                    BigDecimal discountValue = discountDetailDto.getValue().multiply(valuationRes.getDeliveryAmount())
+                            .divide(BigDecimal.TEN, BigDecimal.ROUND_HALF_UP).setScale(6, BigDecimal.ROUND_HALF_UP);
+                    double abs = Math.abs(valuationRes.getDeliveryAmount().subtract(discountValue).doubleValue());
+                    if (discountDetailDto.getMaxValue() != null) {
+                        abs = Math.min(abs, discountDetailDto.getMaxValue().doubleValue());
+                    }
+                    // 判断是优惠还是提价
+                    boolean positiveNum = discountValue.subtract(valuationRes.getDeliveryAmount()).compareTo(BigDecimal.ZERO) >= 0;
+                    if (positiveNum) {
+                        valuationRes.setDeliveryAmount(valuationRes.getDeliveryAmount().add(new BigDecimal(abs)));
+                    } else {
+                        valuationRes.setDeliveryAmount(valuationRes.getDeliveryAmount().subtract(new BigDecimal(abs)));
+                    }
+                    valuationRes.setZk(discountDetailDto.getValue());
+                }
+            } else if (PackageDiscountDetailTypeEnum.GRADIENT.type.equals(discountDetailDto.getType())) {
+                for (PackageDiscountDetailDto item : discountDetailDtoList) {
+                    boolean inRange = BigDecimalUtils.inRange(item.getLeftValue(), item.getRightValue(), valuationRes.getDeliveryAmount());
+                    if (inRange) {
+                        if (item.getValue() != null) {
+                            BigDecimal discountAmount = valuationRes.getDeliveryAmount().subtract(item.getValue());
+                            valuationRes.setDeliveryAmount(discountAmount.compareTo(BigDecimal.ZERO) > 0 ? discountAmount : BigDecimal.ZERO);
+                            valuationRes.setMj(item.getValue());
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    private List<DeliveryInfo> getDeliveryInfos(OrderValuationDto valuationDto, List<Integer> types) {
+        List<DspDelivery> list = iDspDeliveryService.list(new QueryWrapper<DspDelivery>()
+                .isNotNull("parent_id")
+                .eq("status", StatusEnum.SHOW.status)
+                .eq("deleted", IsDeleteEnum.NORMAL.status)
+                .ne("type", DeliveryTypeEnums.HUO_LA_LA.getType())
+                .in(CollectionUtils.isNotEmpty(types), "type", types));
+        List<DeliveryInfo> infos = Lists.newArrayList();
+
+        List<Integer> deliveryTypes = Arrays.asList(DeliveryTypeEnums.DADA.getType(), DeliveryTypeEnums.DADA_YZ.getType(),
+                DeliveryTypeEnums.DWD.getType(), DeliveryTypeEnums.FENG_NIAO.getType(), DeliveryTypeEnums.FENG_NIAO_PT.getType(),
+                DeliveryTypeEnums.MEI_TUAN.getType(), DeliveryTypeEnums.SHAN_SONG.getType(), DeliveryTypeEnums.SHUN_FENG.getType());
+
+        List<Long> deliveryIds = list.stream().map(DspDelivery::getId).collect(Collectors.toList());
+        Map<String, List<ShopDelivery>> deliveryMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(deliveryIds)) {
+            deliveryMap = iShopDeliveryService.list(new QueryWrapper<ShopDelivery>()
+                    .eq("merchant_id", valuationDto.getMerchantId())
+                    .in("delivery_id", deliveryIds)
+                    .eq("deleted", IsDeleteEnum.NORMAL.status)
+                    .eq("shop_id", valuationDto.getShopId())
+                    .eq("bind_status",1))
+                    .stream()
+                    .collect(Collectors.groupingBy(item -> item.getDeliveryId() + "-" + item.getMerchantId() + "-" + item.getShopId()));
+        }
+        for (DspDelivery delivery : list) {
+            DeliveryInfo info = new DeliveryInfo();
+            BeanUtils.copyProperties(delivery, info);
+            if (deliveryTypes.contains(info.getType()) && valuationDto.getMerchantId() != null && valuationDto.getShopId() != null) {
+                List<ShopDelivery> shopDeliveries = deliveryMap.get(info.getId() + "-" + valuationDto.getMerchantId() + "-" + valuationDto.getShopId());
+                ShopDelivery sd = new ShopDelivery();
+                if (CollectionUtils.isNotEmpty(shopDeliveries)) {
+                    sd = shopDeliveries.get(0);
+                }
+                if (sd.getThirdShopId() != null && (DeliveryTypeEnums.DADA.getType().equals(info.getType())
+                        || DeliveryTypeEnums.DADA_YZ.getType().equals(info.getType())
+                        || DeliveryTypeEnums.SHAN_SONG.getType().equals(info.getType()))) {
+                    info.setShopId(sd.getThirdShopId());
+                }
+                if(sd.getThirdShopId() != null && (DeliveryTypeEnums.FENG_NIAO.getType().equals(info.getType())
+                        || DeliveryTypeEnums.FENG_NIAO_PT.getType().equals(info.getType())
+                        || DeliveryTypeEnums.MEI_TUAN.getType().equals(info.getType()))) {
+                    info.setThirdShopId(sd.getThirdShopId());
+                }
+            }
+            info.setIsMine(0);
+            infos.add(info);
+        }
+        return infos;
+    }
+
+    private ResponseResult validParam(OrderValuationReq valuationReq, OrderValuationDto valuationDto) {
         ResponseResult result = ResponseResult.success();
         if (StringUtils.isBlank(valuationReq.getShopCode())) {
             if (StringUtils.isBlank(valuationReq.getSendName())) {
@@ -73,7 +428,12 @@ public class OpenApiOrderValuationServiceImpl implements OpenApiOrderValuationSe
             valuationReq.setSendHouseNumber(shop.getStreet());
             valuationReq.setSendLat(shop.getLat());
             valuationReq.setSendLng(shop.getLng());
+
+            valuationDto.setShopId(shop.getId());
+            valuationDto.setShopName(shop.getName());
+            valuationDto.setMerchantId(shop.getMerchantId());
         }
+        BeanUtils.copyProperties(valuationReq, valuationDto);
         return result;
     }
 

+ 3 - 4
lb-common/src/main/java/com/ydd/common/enums/ResponseResultCodeEnum.java

@@ -21,13 +21,12 @@ public enum ResponseResultCodeEnum {
     TIMESTAMP_ERR(1001, "timestamp错误"),
     APP_ID_ERR(1002, "appId无效"),
     SIGN_ERR(1003, "签名验证失败"),
-
+    FIELD_EMPTY(1004, "参数为空"),
 
     // 门店、订单类状态码
     SHOP_NOT_EXIST(2001, "门店不存在"),
-
-    // 字段为空状态码
-    FIELD_EMPTY(3001, "参数为空"),
+    CATEGORY_NOT_EXIST(2002, "物品分类不存在"),
+    NO_DELIVERY(2003, "无可用发单运力"),
     ;
 
     private final int code;

+ 1 - 1
lb-module/src/main/java/com/ydd/module/domain/ShopDeliveryDisable.java

@@ -45,7 +45,7 @@ private static final long serialVersionUID=1L;
 
     /** 运力 */
     @Excel(name = "运力")
-    private Long deliveryType;
+    private Integer deliveryType;
 
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

+ 1 - 3
lb-module/src/main/java/com/ydd/module/service/impl/DspDeliveryServiceImpl.java

@@ -408,9 +408,7 @@ public class DspDeliveryServiceImpl extends ServiceImpl<DspDeliveryMapper, DspDe
                         }
                     }
                 }
-
-
-        }
+            }
             if ((delivery.getType().equals(DeliveryTypeEnums.DADA.getType()) || delivery.getType().equals(DeliveryTypeEnums.DADA_YZ.getType())) && member.getMemberType().equals(MemberTypeEnum.PERSON.type)){
                 info.setIsMerchant(StatusEnum.SHOW.status);
             }