From 25c2f98c6be8246238db29562b5a6539f76757f6 Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Wed, 25 Jun 2025 17:21:17 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9A=E7=B3=BB=E7=BB=9F=E8=B0=83?= =?UTF-8?q?=E4=BC=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysProductCategoryController.java | 7 ++- .../xkt/QuickFunctionController.java | 4 ++ .../xkt/ShoppingCartController.java | 7 +++ .../xkt/StoreCertificateController.java | 4 ++ .../advertRound/AdRoundStoreBoughtResVO.java | 2 + .../framework/config/SecurityConfig.java | 9 ++-- .../xkt/service/impl/AdvertServiceImpl.java | 44 +------------------ .../impl/PictureSearchServiceImpl.java | 11 +---- .../service/impl/ShoppingCartServiceImpl.java | 14 ------ .../impl/SysProductCategoryServiceImpl.java | 25 +---------- 10 files changed, 29 insertions(+), 98 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java index f5f5e3511..60588162b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProductCategoryController.java @@ -15,6 +15,7 @@ import com.ruoyi.xkt.service.ISysProductCategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -33,6 +34,7 @@ public class SysProductCategoryController extends XktBaseController { final ISysProductCategoryService prodCateService; + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin')") @ApiOperation(value = "新增商品分类", httpMethod = "POST", response = R.class) @Log(title = "新增商品分类", businessType = BusinessType.INSERT) @PostMapping @@ -40,6 +42,7 @@ public class SysProductCategoryController extends XktBaseController { return R.ok(prodCateService.create(BeanUtil.toBean(prodCateVO, ProdCateDTO.class))); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin')") @ApiOperation(value = "修改商品分类", httpMethod = "PUT", response = R.class) @Log(title = "修改商品分类", businessType = BusinessType.UPDATE) @PutMapping @@ -47,6 +50,7 @@ public class SysProductCategoryController extends XktBaseController { return R.ok(prodCateService.update(BeanUtil.toBean(prodCateVO, ProdCateDTO.class))); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin')") @ApiOperation(value = "删除商品分类", httpMethod = "DELETE", response = R.class) @Log(title = "删除商品分类", businessType = BusinessType.DELETE) @DeleteMapping("/{prodCateId}") @@ -54,13 +58,14 @@ public class SysProductCategoryController extends XktBaseController { return R.ok(prodCateService.delete(prodCateId)); } - + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin')") @ApiOperation(value = "查询商品分类详细", httpMethod = "GET", response = R.class) @GetMapping(value = "/{prodCateId}") public R getInfo(@PathVariable Long prodCateId) { return R.ok(BeanUtil.toBean(prodCateService.selectById(prodCateId), ProdCateVO.class)); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin')") @ApiOperation(value = "管理员菜单获取商品分类树", httpMethod = "POST", response = R.class) @PostMapping("/tree") public R> tree(@RequestBody ProdCateListVO listVO) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/QuickFunctionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/QuickFunctionController.java index 2ee7ad94a..2b53a1407 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/QuickFunctionController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/QuickFunctionController.java @@ -14,6 +14,7 @@ import com.ruoyi.xkt.service.IQuickFunctionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -36,6 +37,7 @@ public class QuickFunctionController extends XktBaseController { private static final String MENU_TYPE_C = "C"; + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,store')") @ApiOperation(value = "档口首页 档口或电商卖家选择的快捷功能", httpMethod = "GET", response = R.class) @GetMapping("/selected/{roleId}/{bizId}") public R> getSelectedList(@PathVariable("roleId") Long roleId, @PathVariable("bizId") Long bizId) { @@ -44,6 +46,7 @@ public class QuickFunctionController extends XktBaseController { return R.ok(BeanUtil.copyToList(checkedList, StoreQuickFuncVO.class)); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,store')") @ApiOperation(value = "档口常用功能 点击 设置", httpMethod = "GET", response = R.class) @GetMapping("/menus/{roleId}/{bizId}") public R getMenuList(@PathVariable("roleId") Long roleId, @PathVariable("bizId") Long bizId) { @@ -57,6 +60,7 @@ public class QuickFunctionController extends XktBaseController { .build()); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,store')") @ApiOperation(value = "修改快捷功能", httpMethod = "PUT", response = R.class) @Log(title = "修改快捷功能", businessType = BusinessType.UPDATE) @PutMapping("/checked") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ShoppingCartController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ShoppingCartController.java index 8c90003a7..825dab21e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ShoppingCartController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ShoppingCartController.java @@ -12,6 +12,7 @@ import com.ruoyi.xkt.service.IShoppingCartService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -31,6 +32,7 @@ public class ShoppingCartController extends XktBaseController { final IShoppingCartService shopCartService; + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "电商卖家添加商品到进货车", httpMethod = "POST", response = R.class) @Log(title = "电商卖家添加商品到进货车", businessType = BusinessType.INSERT) @PostMapping @@ -38,6 +40,7 @@ public class ShoppingCartController extends XktBaseController { return R.ok(shopCartService.create(BeanUtil.toBean(shopCartVO, ShoppingCartDTO.class))); } + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "电商卖家编辑进货车商品", httpMethod = "PUT", response = R.class) @Log(title = "电商卖家编辑进货车商品", businessType = BusinessType.UPDATE) @PutMapping @@ -45,24 +48,28 @@ public class ShoppingCartController extends XktBaseController { return R.ok(shopCartService.update(BeanUtil.toBean(editVO, ShoppingCartEditDTO.class))); } + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "获取用户进货车列表", httpMethod = "POST", response = R.class) @PostMapping("/page") public R> page(@Validated @RequestBody ShopCartPageVO pageVO) { return R.ok(shopCartService.page(BeanUtil.toBean(pageVO, ShopCartPageDTO.class))); } + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "用户进货车列表点击编辑获取数据", httpMethod = "GET", response = R.class) @GetMapping("/edit/{shoppingCartId}") public R getEditInfo(@PathVariable Long shoppingCartId) { return R.ok(BeanUtil.toBean(shopCartService.getEditInfo(shoppingCartId), ShopCartEditDetailResVO.class)); } + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "进货车下单时及商品下单时获取商品列表", httpMethod = "POST", response = R.class) @PostMapping("/list") public R> getList(@Validated @RequestBody ShopCartListVO listVO) { return R.ok(BeanUtil.copyToList(shopCartService.getList(BeanUtil.toBean(listVO, ShopCartListDTO.class)), ShopCartResVO.class)); } + @PreAuthorize("@ss.hasRole('seller')") @ApiOperation(value = "用户删除进货车商品", httpMethod = "DELETE", response = R.class) @Log(title = "用户删除进货车商品", businessType = BusinessType.DELETE) @DeleteMapping diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java index 2e12e8a94..b3e2cad6e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCertificateController.java @@ -12,6 +12,7 @@ import com.ruoyi.xkt.service.IStoreCertificateService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -29,6 +30,7 @@ public class StoreCertificateController extends XktBaseController { final IStoreCertificateService storeCertService; + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')") @ApiOperation(value = "新增档口认证", httpMethod = "POST", response = R.class) @Log(title = "新增档口认证", businessType = BusinessType.INSERT) @PostMapping @@ -36,12 +38,14 @@ public class StoreCertificateController extends XktBaseController { return R.ok(storeCertService.create(BeanUtil.toBean(storeCertVO, StoreCertDTO.class))); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')") @ApiOperation(value = "获取档口认证详细信息", httpMethod = "GET", response = R.class) @GetMapping(value = "/{storeId}") public R getInfo(@PathVariable("storeId") Long storeId) { return R.ok(BeanUtil.toBean(storeCertService.getInfo(storeId), StoreCertResVO.class)); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')") @ApiOperation(value = "修改档口认证", httpMethod = "PUT", response = R.class) @Log(title = "修改档口认证", businessType = BusinessType.UPDATE) @PutMapping diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/advertRound/AdRoundStoreBoughtResVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/advertRound/AdRoundStoreBoughtResVO.java index f56d517a6..bc747b0d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/advertRound/AdRoundStoreBoughtResVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/advertRound/AdRoundStoreBoughtResVO.java @@ -29,6 +29,8 @@ public class AdRoundStoreBoughtResVO { private String typeName; @ApiModelProperty(value = "推广档口ID") private Long storeId; + @ApiModelProperty(value = "推广展示类型 时间范围 位置枚举") + private Integer showType; @ApiModelProperty(value = "投放开始时间") @JsonFormat(pattern = "MM月dd日", timezone = "GMT+8") private Date startTime; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 9f824e13a..802c91265 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -132,14 +132,11 @@ public class SecurityConfig .antMatchers("/rest/v1/store-home/template/**").permitAll() // 档口推荐 .antMatchers("/rest/v1/store-home/recommend/**").permitAll() - - - // TODO 临时放开 临时放开 - .antMatchers("/rest/v1/pic-search/hot").permitAll() - .antMatchers("/rest/v1/pic-search").permitAll() + // 档口简易返回信息 .antMatchers("/rest/v1/stores/simple/**").permitAll() + // 商品状态数量 .antMatchers("/rest/v1/prods/status/num/**").permitAll() - .antMatchers("/rest/v1/prods/status/num/**").permitAll() + // PC 商品详情 .antMatchers("/rest/v1/prods/pc/detail/**").permitAll() diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/AdvertServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/AdvertServiceImpl.java index 4506892f6..c82db94bd 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/AdvertServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/AdvertServiceImpl.java @@ -6,11 +6,9 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.Page; import com.ruoyi.common.enums.AdType; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.xkt.domain.Advert; import com.ruoyi.xkt.domain.SysFile; import com.ruoyi.xkt.dto.advert.*; @@ -54,16 +52,9 @@ public class AdvertServiceImpl implements IAdvertService { @Override @Transactional public Integer create(AdvertCreateDTO createDTO) { - - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - this.isSuperAdmin(); - Advert advert = BeanUtil.toBean(createDTO, Advert.class); advert.setBasicSymbol(random10Str()); advert.setOnlineStatus(AdOnlineStatus.ONLINE.getValue()); - // 推广类型为 推广图 或者 图及商品 则新增系统文件 if ((Objects.equals(createDTO.getDisplayType(), AdDisplayType.PICTURE.getValue()) || Objects.equals(createDTO.getDisplayType(), AdDisplayType.PIC_AND_PROD.getValue())) && ObjectUtils.isNotEmpty(createDTO.getExample())) { @@ -85,12 +76,6 @@ public class AdvertServiceImpl implements IAdvertService { @Override @Transactional(readOnly = true) public AdvertResDTO getInfo(Long advertId) { - - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - this.isSuperAdmin(); - Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper() .eq(Advert::getId, advertId).eq(Advert::getDelFlag, Constants.UNDELETED))) .orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR)); @@ -150,12 +135,6 @@ public class AdvertServiceImpl implements IAdvertService { @Override @Transactional public Integer updateAdvert(AdvertUpdateDTO updateDTO) { - - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - this.isSuperAdmin(); - Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper() .eq(Advert::getId, updateDTO.getAdvertId()).eq(Advert::getDelFlag, Constants.UNDELETED))) .orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR)); @@ -180,12 +159,6 @@ public class AdvertServiceImpl implements IAdvertService { public Integer changeAdvertStatus(AdvertChangeStatusDTO changeStatusDTO) { // 判断状态是否合法 AdOnlineStatus.of(changeStatusDTO.getStatus()); - - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - // TODO 判断当前是否超级管理员在操作 - this.isSuperAdmin(); - Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper() .eq(Advert::getId, changeStatusDTO.getAdvertId()).eq(Advert::getDelFlag, Constants.UNDELETED))) .orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR)); @@ -217,7 +190,7 @@ public class AdvertServiceImpl implements IAdvertService { .setTabId(tabId).setTabName(AdTab.of(tabId).getLabel()) // tab下所有的推广类型 .setTypeList(typeList.stream().map(type -> new AdvertPlatformResDTO.APTypeDTO() - .setAdvertId(type.getAdvertId()).setTypeId(type.getTypeId()).setTypeName(AdType.of(type.getTypeId()).getLabel()) + .setAdvertId(type.getAdvertId()).setTypeId(type.getTypeId()).setTypeName(AdType.of(type.getTypeId()).getLabel()) // .setDemoUrl(AdType.of(type.getTypeId()).getDemoUrl()) ) .collect(Collectors.toList())))); @@ -245,21 +218,6 @@ public class AdvertServiceImpl implements IAdvertService { return file.getFileUrl(); } - /** - * 校验当前是否是超级管理员操作 - */ - private void isSuperAdmin() { - // 获取当前登录用户 - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (ObjectUtils.isEmpty(loginUser)) { - throw new ServiceException("当前用户不存在!", HttpStatus.ERROR); - } - if (!SecurityUtils.isSuperAdmin()) { - throw new ServiceException("当前用户不是超级管理员,不可操作!", HttpStatus.ERROR); - } - } - - /** * 随机生成10位,包含大小写字母、数字的字符串 * diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/PictureSearchServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/PictureSearchServiceImpl.java index ae0dc54c0..10e3ce40e 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/PictureSearchServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/PictureSearchServiceImpl.java @@ -68,16 +68,6 @@ public class PictureSearchServiceImpl implements IPictureSearchService { ObjectUtils.isEmpty(requestDTO.getPicSize()) || requestDTO.getNum() <= 0) { return BeanUtil.copyToList(picSearchAdverts, StoreProdViewDTO.class); } - - - - // TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作 - // TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作 - // TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作 - // TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作 - - - Assert.notEmpty(requestDTO.getPicKey()); SysFile sysFile = new SysFile().setFileUrl(requestDTO.getPicKey()).setFileName(requestDTO.getPicName()).setFileSize(requestDTO.getPicSize()); sysFile.setVersion(0); @@ -112,6 +102,7 @@ public class PictureSearchServiceImpl implements IPictureSearchService { /** * 图搜热款列表 + * * @return List */ @Override diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/ShoppingCartServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/ShoppingCartServiceImpl.java index 6e092eb2d..ddb261ba2 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/ShoppingCartServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/ShoppingCartServiceImpl.java @@ -62,20 +62,6 @@ public class ShoppingCartServiceImpl implements IShoppingCartService { public Integer create(ShoppingCartDTO shoppingCartDTO) { // 判断当前登录用户角色 只有电商卖家才可操作 LoginUser loginUser = SecurityUtils.getLoginUser(); - - // TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错 - // TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错 - // TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错 - // TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错 - - - // 判断当前商品是否已添加过进货车 - /* List existList = this.shopCartMapper.selectList(new LambdaQueryWrapper() - .eq(ShoppingCart::getUserId, loginUser.getUserId()).eq(ShoppingCart::getStoreProdId, shoppingCartDTO.getStoreProdId()) - .eq(ShoppingCart::getDelFlag, Constants.UNDELETED)); - if (CollectionUtils.isNotEmpty(existList)) { - throw new ServiceException("商品已经添加到进货单了,不可重复添加喔!", HttpStatus.ERROR); - }*/ ShoppingCart exist = this.shopCartMapper.selectOne(new LambdaQueryWrapper() .eq(ShoppingCart::getUserId, loginUser.getUserId()).eq(ShoppingCart::getStoreProdId, shoppingCartDTO.getStoreProdId()) .eq(ShoppingCart::getDelFlag, Constants.UNDELETED)); diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java index a9d32015f..d5340e93c 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/SysProductCategoryServiceImpl.java @@ -4,9 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.domain.dto.productCategory.AppHomeProdCateListResDTO; import com.ruoyi.system.domain.dto.productCategory.ProdCateDTO; import com.ruoyi.system.domain.dto.productCategory.ProdCateListDTO; @@ -82,17 +80,11 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService @Override @Transactional public Integer delete(Long prodCateId) { - - // TODO 是否为超级管理员 - // TODO 是否为超级管理员 - // TODO 是否为超级管理员 - this.isSuperAdmin(); - // 是否有子分类 List subCateList = this.prodCateMapper.selectList(new LambdaQueryWrapper() .eq(SysProductCategory::getParentId, prodCateId) .eq(SysProductCategory::getDelFlag, Constants.UNDELETED)); - List cateIdList = new ArrayList(){{ + List cateIdList = new ArrayList() {{ add(prodCateId); }}; CollectionUtils.addAll(cateIdList, subCateList.stream().map(SysProductCategory::getId).collect(Collectors.toList())); @@ -313,19 +305,4 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService } - /** - * 校验当前是否是超级管理员操作 - */ - private void isSuperAdmin() { - // 获取当前登录用户 - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (ObjectUtils.isEmpty(loginUser)) { - throw new ServiceException("当前用户不存在!", HttpStatus.ERROR); - } - if (!SecurityUtils.isSuperAdmin()) { - throw new ServiceException("当前用户不是超级管理员,不可操作!", HttpStatus.ERROR); - } - } - - }