master:档口店铺装修功能完善;

pull/1121/head
liujiang 2025-07-31 15:11:10 +08:00
parent 8b11cc2ad3
commit 3f47665148
5 changed files with 19 additions and 17 deletions

View File

@ -34,10 +34,9 @@ public class StoreHomepageController extends XktBaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@ApiOperation(value = "新增档口装修数据", httpMethod = "POST", response = R.class)
@Log(title = "新增档口装修数据", businessType = BusinessType.INSERT)
@PostMapping("/decoration/{storeId}/{templateNum}")
public R<Integer> addDecoration(@PathVariable("storeId") Long storeId, @PathVariable("templateNum") Integer templateNum,
@Validated @RequestBody StoreHomeDecorationVO decorationVO) {
return R.ok(storeHomeService.insert(storeId, templateNum, BeanUtil.toBean(decorationVO, StoreHomeDecorationDTO.class)));
@PostMapping("/decoration/{storeId}")
public R<Integer> addDecoration(@PathVariable("storeId") Long storeId, @Validated @RequestBody StoreHomeDecorationVO decorationVO) {
return R.ok(storeHomeService.insert(storeId, BeanUtil.toBean(decorationVO, StoreHomeDecorationDTO.class)));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@ -50,10 +49,9 @@ public class StoreHomepageController extends XktBaseController {
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@ApiOperation(value = "修改档口装修数据", httpMethod = "PUT", response = R.class)
@Log(title = "修改档口装修数据", businessType = BusinessType.UPDATE)
@PutMapping("/decoration/{storeId}/{templateNum}")
public R<Integer> editDecoration(@PathVariable("storeId") Long storeId, @PathVariable("templateNum") Integer templateNum,
@Validated @RequestBody StoreHomeDecorationVO homepageVO) {
return R.ok(storeHomeService.updateStoreHomepage(storeId, templateNum, BeanUtil.toBean(homepageVO, StoreHomeDecorationDTO.class)));
@PutMapping("/decoration/{storeId}")
public R<Integer> editDecoration(@PathVariable("storeId") Long storeId, @Validated @RequestBody StoreHomeDecorationVO homepageVO) {
return R.ok(storeHomeService.updateStoreHomepage(storeId, BeanUtil.toBean(homepageVO, StoreHomeDecorationDTO.class)));
}
@ApiOperation(value = "获取档口推荐商品列表", httpMethod = "GET", response = R.class)

View File

@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.bind.annotation.PathVariable;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
@ -18,6 +20,9 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StoreHomeDecorationVO {
@NotNull(message = "模板编号不能为空!")
@ApiModelProperty(value = "模板编号", required = true)
private Integer templateNum;
@ApiModelProperty(value = "档口首页装修大轮播图")
private List<BigBannerVO> bigBannerList;
@ApiModelProperty(value = "档口首页装修其它图部分")

View File

@ -18,6 +18,8 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StoreHomeDecorationDTO {
@ApiModelProperty(value = "模板编号")
private Integer templateNum;
@ApiModelProperty(value = "档口首页装修大轮播图")
private List<BigBannerDTO> bannerList;
@ApiModelProperty(value = "档口首页装修其它图部分")

View File

@ -16,11 +16,10 @@ public interface IStoreHomepageService {
*
*
* @param storeId ID
* @param templateNum No
* @param homepageDTO
* @return Integer
*/
Integer insert(Long storeId, Integer templateNum, StoreHomeDecorationDTO homepageDTO);
Integer insert(Long storeId, StoreHomeDecorationDTO homepageDTO);
/**
*
@ -34,11 +33,10 @@ public interface IStoreHomepageService {
*
*
* @param storeId ID
* @param templateNum Num
* @param homeDTO dto
* @return Integer
*/
Integer updateStoreHomepage(Long storeId, Integer templateNum, StoreHomeDecorationDTO homeDTO);
Integer updateStoreHomepage(Long storeId, StoreHomeDecorationDTO homeDTO);
/**
*

View File

@ -61,7 +61,7 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
*/
@Override
@Transactional
public Integer insert(Long storeId, Integer templateNum, StoreHomeDecorationDTO homepageDTO) {
public Integer insert(Long storeId, StoreHomeDecorationDTO homepageDTO) {
// 用户是否为档口管理者或子账户
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(storeId)) {
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
@ -71,7 +71,7 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
BigDecimal totalSize = homepageDTO.getBannerList().stream().map(x -> ObjectUtils.defaultIfNull(x.getFileSize(), BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add);
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>().eq(Store::getId, storeId).eq(Store::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
store.setTemplateNum(templateNum);
store.setTemplateNum(homepageDTO.getTemplateNum());
// 更新档口首页使用的总的文件容量
store.setStorageUsage(ObjectUtils.defaultIfNull(store.getStorageUsage(), BigDecimal.ZERO).add(totalSize));
this.storeMapper.updateById(store);
@ -145,13 +145,12 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
*
*
* @param storeId ID
* @param templateNum Num
* @param homepageDTO dto
* @return Integer
*/
@Override
@Transactional
public Integer updateStoreHomepage(Long storeId, Integer templateNum, StoreHomeDecorationDTO homepageDTO) {
public Integer updateStoreHomepage(Long storeId, StoreHomeDecorationDTO homepageDTO) {
// 用户是否为档口管理者或子账户
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(storeId)) {
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
@ -168,7 +167,7 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, storeId).eq(Store::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
store.setTemplateNum(templateNum);
store.setTemplateNum(homepageDTO.getTemplateNum());
this.storeMapper.updateById(store);
return homepageList.size();
}