|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.chelvc.cloud.user.client.UserClient;
|
|
import com.chelvc.cloud.user.client.UserClient;
|
|
import com.chelvc.cloud.user.client.model.Scope;
|
|
import com.chelvc.cloud.user.client.model.Scope;
|
|
|
|
+import com.chelvc.cloud.vehicle.client.dto.CategoryDTO;
|
|
import com.chelvc.cloud.vehicle.client.dto.MerchantAuthDTO;
|
|
import com.chelvc.cloud.vehicle.client.dto.MerchantAuthDTO;
|
|
import com.chelvc.cloud.vehicle.client.dto.MerchantDTO;
|
|
import com.chelvc.cloud.vehicle.client.dto.MerchantDTO;
|
|
import com.chelvc.cloud.vehicle.client.param.MerchantAuthModifyParam;
|
|
import com.chelvc.cloud.vehicle.client.param.MerchantAuthModifyParam;
|
|
@@ -13,6 +14,7 @@ import com.chelvc.cloud.vehicle.server.copier.MerchantAuthCopier;
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantAuthMapper;
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantAuthMapper;
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
import com.chelvc.cloud.vehicle.server.entity.MerchantAuth;
|
|
import com.chelvc.cloud.vehicle.server.entity.MerchantAuth;
|
|
|
|
+import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantAuthService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantAuthService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
import com.chelvc.framework.base.context.SessionContextHolder;
|
|
import com.chelvc.framework.base.context.SessionContextHolder;
|
|
@@ -27,8 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商家认证业务操作实现
|
|
* 商家认证业务操作实现
|
|
@@ -42,6 +46,8 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
|
|
private final MerchantService merchantService;
|
|
private final MerchantService merchantService;
|
|
|
|
|
|
private final UserClient userClient;
|
|
private final UserClient userClient;
|
|
|
|
+
|
|
|
|
+ private final CategoryService categoryService;
|
|
@Override
|
|
@Override
|
|
public Long addMerchantAuth(@NonNull MerchantAuthModifyParam param) {
|
|
public Long addMerchantAuth(@NonNull MerchantAuthModifyParam param) {
|
|
Long userId = SessionContextHolder.getId();
|
|
Long userId = SessionContextHolder.getId();
|
|
@@ -149,7 +155,18 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
|
|
if (merchantAuthDTO == null){
|
|
if (merchantAuthDTO == null){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- merchantAuthDTO.setMerchant(this.merchantService.getMerchantByUserId(userId));
|
|
|
|
|
|
+ MerchantDTO merchantDTO = this.merchantService.getMerchantByUserId(userId);
|
|
|
|
+ List<Long> categories = new ArrayList<>();
|
|
|
|
+ categories.add(merchantDTO.getMainBusiness());
|
|
|
|
+ List<CategoryDTO> list = this.categoryService.listCategories(categories);
|
|
|
|
+ if (!CollectionUtils.isEmpty(list)){
|
|
|
|
+ merchantDTO.setMainBusinessName(list.get(0).getName());
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(merchantDTO.getAncillaryBusiness())){
|
|
|
|
+ List<CategoryDTO> list2 = this.categoryService.listCategories(merchantDTO.getAncillaryBusiness());
|
|
|
|
+ merchantDTO.setAncillaryBusinessName(list2.stream().map(CategoryDTO::getName).collect(Collectors.toList()));
|
|
|
|
+ }
|
|
|
|
+ merchantAuthDTO.setMerchant(merchantDTO);
|
|
return merchantAuthDTO;
|
|
return merchantAuthDTO;
|
|
}
|
|
}
|
|
|
|
|