控制平台导入权限
This commit is contained in:
parent
7793e8c88d
commit
0bb857f53f
@ -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<BrandModelExcel> 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<SxCategoryModelExcel> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user