master:系统调优;

pull/1121/head
liujiang 2025-06-25 17:21:17 +08:00
parent 2c13cc4cad
commit 25c2f98c6b
10 changed files with 29 additions and 98 deletions

View File

@ -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<ProdCateVO> 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<List<ProdCateListResVO>> tree(@RequestBody ProdCateListVO listVO) {

View File

@ -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<List<StoreQuickFuncVO>> 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<QuickFuncVO> 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")

View File

@ -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<ShopCartPageResDTO>> 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<ShopCartEditDetailResVO> 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<List<ShopCartResVO>> 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

View File

@ -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<StoreCertResVO> 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

View File

@ -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;

View File

@ -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()

View File

@ -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<Advert>()
.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<Advert>()
.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<Advert>()
.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
*

View File

@ -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<TopProductMatchDTO>
*/
@Override

View File

@ -62,20 +62,6 @@ public class ShoppingCartServiceImpl implements IShoppingCartService {
public Integer create(ShoppingCartDTO shoppingCartDTO) {
// 判断当前登录用户角色 只有电商卖家才可操作
LoginUser loginUser = SecurityUtils.getLoginUser();
// TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错
// TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错
// TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错
// TODO 判断当前登录用户角色,只有电商卖家才可操作,其它角色不允许操作,直接报错
// 判断当前商品是否已添加过进货车
/* List<ShoppingCart> existList = this.shopCartMapper.selectList(new LambdaQueryWrapper<ShoppingCart>()
.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<ShoppingCart>()
.eq(ShoppingCart::getUserId, loginUser.getUserId()).eq(ShoppingCart::getStoreProdId, shoppingCartDTO.getStoreProdId())
.eq(ShoppingCart::getDelFlag, Constants.UNDELETED));

View File

@ -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<SysProductCategory> subCateList = this.prodCateMapper.selectList(new LambdaQueryWrapper<SysProductCategory>()
.eq(SysProductCategory::getParentId, prodCateId)
.eq(SysProductCategory::getDelFlag, Constants.UNDELETED));
List<Long> cateIdList = new ArrayList<Long>(){{
List<Long> cateIdList = new ArrayList<Long>() {{
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);
}
}
}