|
@@ -3,20 +3,19 @@ package com.chelvc.cloud.vehicle.server.service.impl;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.chelvc.cloud.vehicle.api.dto.CategoryDTO;
|
|
|
+import com.chelvc.cloud.vehicle.api.constant.CategoryType;
|
|
|
+import com.chelvc.cloud.vehicle.api.dto.GoodsDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.MerchantDetailDTO;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.GoodsQueryParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.LocationQueryParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.MerchantQueryParam;
|
|
|
-import com.chelvc.cloud.vehicle.server.copier.CategoryCopier;
|
|
|
import com.chelvc.cloud.vehicle.server.copier.MerchantCopier;
|
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantMapper;
|
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
|
-import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.GoodsService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
|
import com.chelvc.framework.base.util.ErrorUtils;
|
|
|
-import com.chelvc.framework.base.util.ObjectUtils;
|
|
|
import lombok.NonNull;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
@@ -33,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService,
|
|
|
com.chelvc.cloud.vehicle.api.service.MerchantService {
|
|
|
private final GoodsService goodsService;
|
|
|
- private final CategoryService categoryService;
|
|
|
|
|
|
@Override
|
|
|
public List<MerchantDTO> listNearbyMerchants(@NonNull LocationQueryParam param, int size) {
|
|
@@ -46,8 +44,8 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MerchantDTO> listSimpleMerchants(@NonNull MerchantQueryParam param, int size) {
|
|
|
- return this.baseMapper.listSimpleMerchants(param, size);
|
|
|
+ public List<MerchantDTO> listSimpleMerchants(@NonNull MerchantQueryParam param) {
|
|
|
+ return this.baseMapper.listSimpleMerchants(param);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -56,11 +54,13 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
|
MerchantDTO merchant = MerchantCopier.INSTANCE.copying(this.getById(id));
|
|
|
ErrorUtils.requireResource(merchant, "商家信息不存在");
|
|
|
|
|
|
- // 获取商家商品分类信息
|
|
|
- List<Long> categoryIds = this.goodsService.listMerchantGoodsCategoryIdentities(id);
|
|
|
- List<CategoryDTO> categories = CategoryCopier.INSTANCE.copying(
|
|
|
- ObjectUtils.ifEmpty(categoryIds, this.categoryService::listByIds)
|
|
|
+ // 获取商家全部商品列表
|
|
|
+ List<GoodsDTO> goods = this.goodsService.listMerchantSimpleGoods(
|
|
|
+ id, GoodsQueryParam.builder().size(10).build()
|
|
|
);
|
|
|
- return MerchantDetailDTO.builder().merchant(merchant).categories(categories).build();
|
|
|
+
|
|
|
+ // 获取商家商品分类类型列表
|
|
|
+ List<CategoryType> types = this.goodsService.listMerchantGoodsCategoryTypes(id);
|
|
|
+ return MerchantDetailDTO.builder().merchant(merchant).goods(goods).categories(types).build();
|
|
|
}
|
|
|
}
|