From 0bb857f53f68190ebea8c4af4dd2d3b7fc453d84 Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Mon, 29 Dec 2025 09:38:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=B9=B3=E5=8F=B0=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ShopSyncImportServiceImpl.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/ShopSyncImportServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/ShopSyncImportServiceImpl.java index 5f0e04e1..77c173ce 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/ShopSyncImportServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/ShopSyncImportServiceImpl.java @@ -6,11 +6,13 @@ import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.gson.Gson; import com.suisung.mall.common.api.CommonResult; +import com.suisung.mall.common.domain.UserDto; import com.suisung.mall.common.enums.DicEnum; import com.suisung.mall.common.exception.ApiException; import com.suisung.mall.common.modules.base.ShopBaseProductBrand; import com.suisung.mall.common.modules.base.ShopBaseProductCategory; import com.suisung.mall.common.modules.sync.StoreDbConfig; +import com.suisung.mall.common.utils.ContextUtil; import com.suisung.mall.shop.base.service.ShopBaseProductBrandService; import com.suisung.mall.shop.base.service.ShopBaseProductCategoryService; import com.suisung.mall.shop.number.service.ShopNumberSeqService; @@ -110,6 +112,9 @@ public class ShopSyncImportServiceImpl implements ShopSyncImportService { @Override public CommonResult importBrandData(MultipartFile file,String storeId) { + if(!checkIsPlate()){ + throw new ApiException("用户无权限"); + } String fileName = storeUploadedFile(file); try { List excelList = readBrandExcelData(fileName); @@ -133,6 +138,9 @@ public class ShopSyncImportServiceImpl implements ShopSyncImportService { @Override public CommonResult importCategoryData(MultipartFile file,String storeId) { + if(!checkIsPlate()){ + throw new ApiException("用户无权限"); + } String fileName = storeUploadedFile(file); try { List excelList = readCategoryExcelData(fileName); @@ -157,6 +165,9 @@ public class ShopSyncImportServiceImpl implements ShopSyncImportService { @Override @Async public void importShopsData(MultipartFile file,String storeId) { + if(!checkIsPlate()){ + throw new ApiException("用户无权限"); + } String fileName = storeUploadedFile(file); readAndImportShopsExcelData(fileName,storeId); } @@ -244,6 +255,16 @@ public class ShopSyncImportServiceImpl implements ShopSyncImportService { private void initData(String storeId){ shopBaseProductCategoryService.getCategoryListByStoreId(storeId); } + + /** + * 判断是否平台 + * @return + */ + private boolean checkIsPlate(){ + UserDto userDto= ContextUtil.getCurrentUser(); + assert userDto != null; + return 9 == userDto.getRole_id(); + } }