Forráskód Böngészése

商家审核以及一级分类

liude 1 éve
szülő
commit
678a27575f

+ 1 - 1
vehicle-api/src/main/java/com/chelvc/cloud/vehicle/api/dto/MerchantDTO.java

@@ -139,7 +139,7 @@ public class MerchantDTO implements Serializable {
     /**
      * 商家主营业务
      */
-    private List<Long> mainBusiness;
+    private Long mainBusiness;
     /**
      * 商家副营业务
      */

+ 1 - 1
vehicle-api/src/main/java/com/chelvc/cloud/vehicle/api/param/MerchantModifyParam.java

@@ -120,7 +120,7 @@ public class MerchantModifyParam implements Serializable {
     /**
      * 商家主营业务
      */
-    private List<Long> mainBusiness;
+    private Long mainBusiness;
     /**
      * 商家副营业务
      */

+ 7 - 1
vehicle-api/src/main/java/com/chelvc/cloud/vehicle/api/service/CategoryService.java

@@ -72,8 +72,14 @@ public interface CategoryService {
     void deleteCategory(Long id);
 
     /**
-     * 获取一级分类
+     * 获取分类列表
      * @return 分类信息
      */
     List<CategoryDTO> getRootCategories(CategoryListParam param);
+
+    /**
+     * 获取一级分类
+     * @return 分类信息
+     */
+    List<CategoryDTO> getParentCategories(CategoryListParam param);
 }

+ 8 - 0
vehicle-api/src/main/java/com/chelvc/cloud/vehicle/api/service/MerchantService.java

@@ -1,5 +1,6 @@
 package com.chelvc.cloud.vehicle.api.service;
 
+import com.chelvc.cloud.vehicle.api.constant.MerchantStatus;
 import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
 import com.chelvc.cloud.vehicle.api.dto.MerchantDetailDTO;
 import com.chelvc.cloud.vehicle.api.dto.MerchantRankDTO;
@@ -138,6 +139,13 @@ public interface MerchantService {
      */
     List<Map<String,Object>> operatReport(ReportModifyParam param);
 
+    /**
+     * 商家审核
+     * @param id
+     * @param status
+     */
+    void merchantAudit(Long id, MerchantStatus status);
+
 }
 
 

+ 1 - 1
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/entity/Merchant.java

@@ -145,7 +145,7 @@ public class Merchant extends ModifyEntity<Long> {
     /**
      * 商家主营业务
      */
-    private List<Long> mainBusiness;
+    private Long mainBusiness;
     /**
      * 商家副营业务
      */

+ 11 - 0
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/CategoryServiceImpl.java

@@ -198,4 +198,15 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
         categories.sort(Comparator.comparing(Category::getType).thenComparing(Category::getSort));
         return CategoryCopier.INSTANCE.copying(categories);
     }
+
+    @Override
+    public List<CategoryDTO> getParentCategories(CategoryListParam param){
+        List<Category> categories = this.lambdaQuery()
+                .eq(Category::getEnabled, true)
+                .eq(Category::getType,0)
+                .eq(Category::getParentId,0)
+                .orderByAsc(Category::getSort).list();
+        categories.sort(Comparator.comparing(Category::getType).thenComparing(Category::getSort));
+        return CategoryCopier.INSTANCE.copying(categories);
+    }
 }

+ 13 - 1
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/MerchantAuthServiceImpl.java

@@ -1,9 +1,11 @@
 package com.chelvc.cloud.vehicle.server.service.impl;
 
 import java.util.Date;
+import java.util.List;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.chelvc.cloud.uc.api.model.Scope;
 import com.chelvc.cloud.uc.api.service.UserService;
 import com.chelvc.cloud.vehicle.api.dto.MerchantAuthDTO;
 import com.chelvc.cloud.vehicle.api.param.MerchantAuthModifyParam;
@@ -16,6 +18,7 @@ import com.chelvc.cloud.vehicle.server.service.MerchantService;
 import com.chelvc.framework.base.context.SessionContextHolder;
 import com.chelvc.framework.common.model.Pagination;
 import com.chelvc.framework.common.util.AssertUtils;
+import com.chelvc.framework.common.util.ObjectUtils;
 import com.chelvc.framework.common.util.StringUtils;
 import com.chelvc.framework.database.context.DatabaseContextHolder;
 import lombok.NonNull;
@@ -57,8 +60,15 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
 
     @Override
     public Pagination<MerchantAuthDTO> getMerchantAuthPaging(@NonNull MerchantAuthPagingParam param) {
+        Long userId = null;
+        Scope scope = com.chelvc.framework.common.util.StringUtils.ifEmpty(SessionContextHolder.getScope(), Scope::parse);
+        if (scope == Scope.ADMIN) {
+        }else {
+            userId = SessionContextHolder.getId();
+        }
         Page<MerchantAuth> page = this.lambdaQuery()
                 .like(StringUtils.notEmpty(param.getStoreName()), MerchantAuth::getStoreName, param.getStoreName())
+                .eq(StringUtils.notEmpty(userId),MerchantAuth::getApplicant,userId)
                 .orderByAsc(MerchantAuth::getReviewTime).page(DatabaseContextHolder.page(param.getPaging()));
         return DatabaseContextHolder.pagination(page, MerchantAuthCopier.INSTANCE::copying);
     }
@@ -85,6 +95,8 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
         merchantAuth.setReviewer(userId.toString());
         merchantAuth.setMessage(message);
         this.updateById(merchantAuth);
-        this.userService.updateUserRole(merchantAuth.getApplicant());
+        if (StringUtils.notEmpty(state) && "1".equals(state)){
+            this.userService.updateUserRole(merchantAuth.getApplicant());
+        }
     }
 }

+ 7 - 0
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/MerchantServiceImpl.java

@@ -407,4 +407,11 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
         }
     }
 
+    @Override
+    public void merchantAudit(Long id, MerchantStatus status){
+        Merchant merchant = AssertUtils.available(this.getById(id), "商家不存在");
+        merchant.setStatus(status);
+        this.updateById(merchant);
+    }
+
 }