创建商品服务

This commit is contained in:
xuelijun
2025-07-30 18:29:26 +08:00
parent 083b4e0bf1
commit d80bea35c6
31 changed files with 475 additions and 79 deletions

View File

@@ -0,0 +1,42 @@
package com.tashow.cloud.productapi.enums;
import lombok.Getter;
/**
* @Author LGF
* @create 2020/10/26 16:36
*/
public enum BaseEnum {
/**
* 基础 枚举
*/
YES_ONE(1, ""),
NO_ZERO(0, ""),
ENABLE_ZERO(0, "启用"),
FORBIDDEN_ONE(1, "禁用"),
YES_BINDING(1, "已绑定"),
NO_BINDING(0, "未绑定"),
NO(1, "删除"),
YES(0, "正常"),
HIDE(3, "隐藏"),
NO_TWO(2, ""),
;
@Getter
Integer key;
@Getter
String value;
;
BaseEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
}

View File

@@ -1,8 +1,13 @@
package com.tashow.cloud.product.controller; package com.tashow.cloud.product.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tashow.cloud.product.dto.CategoryDO; import com.tashow.cloud.product.dto.CategoryDO;
import com.tashow.cloud.product.dto.ProdPropDO;
import com.tashow.cloud.product.service.CategoryService; import com.tashow.cloud.product.service.CategoryService;
import com.tashow.cloud.product.vo.category.*; import com.tashow.cloud.product.vo.category.*;
import com.tashow.cloud.productapi.enums.ProdPropRule;
import jakarta.annotation.security.PermitAll;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -29,28 +34,41 @@ import static com.tashow.cloud.web.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 产品类目") @Tag(name = "管理后台 - 产品类目")
@RestController @RestController
@RequestMapping("/tz/category") @RequestMapping("/category")
@Validated @Validated
public class CategoryController { public class CategoryController {
@Resource @Resource
private CategoryService categoryService; private CategoryService categoryService;
/**
* 获取菜单页面的表
* @return
*/
@PermitAll
@GetMapping("/categoryList")
public CommonResult<List<CategoryDO>> categoryList() {
LambdaQueryWrapper<CategoryDO> wrapper = new LambdaQueryWrapper<>();
//TODO 获取当前登录用户
wrapper.eq(CategoryDO::getShopId, 1L);
List<CategoryDO> categoryMenuList = categoryService.list(wrapper);
return success(categoryMenuList);
}
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建产品类目") @Operation(summary = "创建产品类目")
@PreAuthorize("@ss.hasPermission('tz:category:create')") @PermitAll
public CommonResult<Long> createCategory(@Valid @RequestBody CategorySaveReqVO createReqVO) { public CommonResult<Long> createCategory(@Valid @RequestBody CategorySaveReqVO createReqVO) {
return success(categoryService.createCategory(createReqVO)); return success(categoryService.createCategory(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新产品类目") @Operation(summary = "更新产品类目")
@PreAuthorize("@ss.hasPermission('tz:category:update')") @PermitAll
public CommonResult<Boolean> updateCategory(@Valid @RequestBody CategorySaveReqVO updateReqVO) { public CommonResult<Boolean> updateCategory(@Valid @RequestBody CategorySaveReqVO updateReqVO) {
categoryService.updateCategory(updateReqVO); categoryService.updateCategory(updateReqVO);
return success(true); return success(true);
} }
/*
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除产品类目") @Operation(summary = "删除产品类目")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@@ -75,7 +93,7 @@ public class CategoryController {
public CommonResult<PageResult<CategoryRespVO>> getCategoryPage(@Valid CategoryPageReqVO pageReqVO) { public CommonResult<PageResult<CategoryRespVO>> getCategoryPage(@Valid CategoryPageReqVO pageReqVO) {
PageResult<CategoryDO> pageResult = categoryService.getCategoryPage(pageReqVO); PageResult<CategoryDO> pageResult = categoryService.getCategoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CategoryRespVO.class)); return success(BeanUtils.toBean(pageResult, CategoryRespVO.class));
} }*/
/* @GetMapping("/export-excel") /* @GetMapping("/export-excel")
@Operation(summary = "导出产品类目 Excel") @Operation(summary = "导出产品类目 Excel")

View File

@@ -40,6 +40,25 @@ public class ProdController {
return success(prodService.createProd(createReqVO)); return success(prodService.createProd(createReqVO));
} }
@PostMapping("/createProdService")
@Operation(summary = "创建商品服务配置")
@PermitAll
public CommonResult<Boolean> createProdService(@Valid @RequestBody ProdServiceVO prodServiceVO) {
prodService.createProdService(prodServiceVO);
return success(true);
}
@PostMapping("/uptateProdService")
@Operation(summary = "修改商品服务配置")
@PermitAll
public CommonResult<Boolean> uptateProdService(@Valid @RequestBody ProdServiceVO prodServiceVO) {
prodService.uptateProdService(prodServiceVO);
return success(true);
}
/* @PutMapping("/update") /* @PutMapping("/update")
@Operation(summary = "更新商品") @Operation(summary = "更新商品")
@PreAuthorize("@ss.hasPermission('tashow-module-product:prod:update')") @PreAuthorize("@ss.hasPermission('tashow-module-product:prod:update')")

View File

@@ -50,7 +50,7 @@ public class CategoryDO extends BaseDO {
/** /**
* 类目描述 * 类目描述
*/ */
private String describe; private String description;
/** /**
* 标签 * 标签
*/ */
@@ -64,7 +64,7 @@ public class CategoryDO extends BaseDO {
*/ */
private Integer status; private Integer status;
/** /**
* 分类层级 * 分类层级 1、2、3级
*/ */
private Integer grade; private Integer grade;

View File

@@ -76,7 +76,7 @@ public class ProdDO extends BaseDO {
*/ */
private String imgs; private String imgs;
/** /**
* 默认是1表示正常状态, -1表示删除, 0下架 * 默认是1正常状态(出售中), 0下架(仓库中) 2待审核
*/ */
private Integer status; private Integer status;
/** /**
@@ -98,31 +98,31 @@ public class ProdDO extends BaseDO {
/** /**
* 是否开启区域0关1开 * 是否开启区域0关1开
*/ */
private Boolean regionSwitch; private Integer regionSwitch;
/** /**
* 是否特殊时段0关1开 * 是否特殊时段0关1开
*/ */
private Boolean additionalSwitch; private Integer additionalSwitch;
/** /**
* 是否特殊日期节假日周末什么的0关1开 * 是否特殊日期节假日周末什么的0关1开
*/ */
private Boolean additionalFeeSwitch; private Integer additionalFeeSwitch;
/** /**
* 是否紧急响应服务0关1开 * 是否紧急响应服务0关1开
*/ */
private Boolean emergencySwitch; private Integer emergencySwitch;
/** /**
* 是否预约0关1开 * 是否预约0关1开
*/ */
private Boolean reservationSwitch; private Integer reservationSwitch;
/** /**
* 是否接单上线0关1开 * 是否接单上线0关1开
*/ */
private Boolean orderLimitSwitch; private Integer orderLimitSwitch;
/** /**
* 是否开启体重配置0关1开 * 是否开启体重配置0关1开
*/ */
private Boolean weightSwitch; private Integer weightSwitch;
/** /**
* 版本 乐观锁 * 版本 乐观锁
*/ */

View File

@@ -51,13 +51,5 @@ public class ProdEmergencyResponseDO extends BaseDO {
* 固定休息日周末是否开启0关闭1开启 * 固定休息日周末是否开启0关闭1开启
*/ */
private Boolean blackWeekend; private Boolean blackWeekend;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
} }

View File

@@ -53,13 +53,5 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
* 价格或上浮百分比 * 价格或上浮百分比
*/ */
private BigDecimal price; private BigDecimal price;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 最后更新时间
*/
private LocalDateTime updatedAt;
} }

View File

@@ -46,7 +46,7 @@ public class ProdReservationConfigDO extends BaseDO {
/** /**
* 是否允许更改预约时间 1可以 0不可以 * 是否允许更改预约时间 1可以 0不可以
*/ */
private Boolean allowChange; private Integer allowChange;
/** /**
* 更改预约时间的时间规则如服务开始前1小时可更改 * 更改预约时间的时间规则如服务开始前1小时可更改
*/ */
@@ -59,6 +59,17 @@ public class ProdReservationConfigDO extends BaseDO {
* 黑名自定义日期JSON格式存储 * 黑名自定义日期JSON格式存储
*/ */
private String blacklistedDates; private String blacklistedDates;
/**
* '是否开启黑名单自定义0关1开'
*/
private Integer isBlacklisted;
/**
* '是否开启黑名单指定日期0关1开'
*/
private Integer isBlackAppoint;
/** /**
* 黑名单指定日期JSON格式存储 * 黑名单指定日期JSON格式存储
*/ */
@@ -66,18 +77,10 @@ public class ProdReservationConfigDO extends BaseDO {
/** /**
* 法定节假日是否开启0:关闭1开启 * 法定节假日是否开启0:关闭1开启
*/ */
private Boolean blackHappy; private Integer blackHappy;
/** /**
* 固定休息日周末是否开启0关闭1开启 * 固定休息日周末是否开启0关闭1开启
*/ */
private Boolean blackWeekend; private Integer blackWeekend;
/**
* 配置创建时间
*/
private LocalDateTime createdAt;
/**
* 配置最后更新时间
*/
private LocalDateTime updatedAt;
} }

View File

@@ -13,12 +13,11 @@ import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
@TableName("tz_prod_service_area_relevance") @TableName("tz_prod_service_area_relevance")
@KeySequence("tz_prod_service_area_relevance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("tz_prod_service_area_relevance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ProdServiceAreaRelevanceDO extends BaseDO { public class ProdServiceAreaRelevanceDO{
/** /**
* 关联的商品ID * 关联的商品ID

View File

@@ -40,13 +40,5 @@ public class ProdServiceOverAreaRulesDO extends BaseDO {
* 超区费用仅在rule_type为accept_with_fee时有效 * 超区费用仅在rule_type为accept_with_fee时有效
*/ */
private BigDecimal fee; private BigDecimal fee;
/**
* 规则创建时间
*/
private LocalDateTime createdAt;
/**
* 规则最后更新时间
*/
private LocalDateTime updatedAt;
} }

View File

@@ -39,13 +39,5 @@ public class ProductOrderLimitDO extends BaseDO {
* 上限阈值 * 上限阈值
*/ */
private Integer maxOrders; private Integer maxOrders;
/**
* 配置创建时间
*/
private LocalDateTime createdAt;
/**
* 配置最后更新时间
*/
private LocalDateTime updatedAt;
} }

View File

@@ -7,6 +7,7 @@ import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX; import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
import com.tashow.cloud.product.dto.ProdServiceAreaRelevanceDO; import com.tashow.cloud.product.dto.ProdServiceAreaRelevanceDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 商品与服务区域关联 Mapper * 商品与服务区域关联 Mapper
@@ -16,4 +17,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ProdServiceAreaRelevanceMapper extends BaseMapperX<ProdServiceAreaRelevanceDO> { public interface ProdServiceAreaRelevanceMapper extends BaseMapperX<ProdServiceAreaRelevanceDO> {
/**
* 删除关联
*/
public int deleteRelevance(@Param("prodId")Long prodId);
} }

View File

@@ -2,7 +2,9 @@ package com.tashow.cloud.product.service;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tashow.cloud.product.dto.CategoryDO; import com.tashow.cloud.product.dto.CategoryDO;
import com.tashow.cloud.product.dto.ProdPropValueDO;
import com.tashow.cloud.product.vo.category.CategoryPageReqVO; import com.tashow.cloud.product.vo.category.CategoryPageReqVO;
import com.tashow.cloud.product.vo.category.CategorySaveReqVO; import com.tashow.cloud.product.vo.category.CategorySaveReqVO;
import jakarta.validation.*; import jakarta.validation.*;
@@ -14,7 +16,7 @@ import com.tashow.cloud.common.pojo.PageParam;
* *
* @author 芋道源码 * @author 芋道源码
*/ */
public interface CategoryService { public interface CategoryService extends IService<CategoryDO> {
/** /**
* 创建产品类目 * 创建产品类目

View File

@@ -5,6 +5,7 @@ import java.util.*;
import com.tashow.cloud.product.dto.ProdDO; import com.tashow.cloud.product.dto.ProdDO;
import com.tashow.cloud.product.vo.prod.ProdPageReqVO; import com.tashow.cloud.product.vo.prod.ProdPageReqVO;
import com.tashow.cloud.product.vo.prod.ProdSaveReqVO; import com.tashow.cloud.product.vo.prod.ProdSaveReqVO;
import com.tashow.cloud.product.vo.prod.ProdServiceVO;
import jakarta.validation.*; import jakarta.validation.*;
import com.tashow.cloud.common.pojo.PageResult; import com.tashow.cloud.common.pojo.PageResult;
import com.tashow.cloud.common.pojo.PageParam; import com.tashow.cloud.common.pojo.PageParam;
@@ -24,6 +25,25 @@ public interface ProdService {
*/ */
Long createProd(@Valid ProdSaveReqVO createReqVO); Long createProd(@Valid ProdSaveReqVO createReqVO);
/**
* 创建商品服务配置
*
* @param prodServiceVO 创建信息
* @return 编号
*/
void createProdService(@Valid ProdServiceVO prodServiceVO);
/**
* 修改商品服务配置
*
* @param prodServiceVO 创建信息
* @return 编号
*/
void uptateProdService(@Valid ProdServiceVO prodServiceVO);
/** /**
* 更新商品 * 更新商品
* *

View File

@@ -2,6 +2,8 @@ package com.tashow.cloud.product.service;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tashow.cloud.product.dto.ProdPropDO;
import com.tashow.cloud.product.dto.ProdServiceAreasDO; import com.tashow.cloud.product.dto.ProdServiceAreasDO;
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasPageReqVO; import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasPageReqVO;
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasSaveReqVO; import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasSaveReqVO;
@@ -14,7 +16,7 @@ import com.tashow.cloud.common.pojo.PageParam;
* *
* @author 芋道源码 * @author 芋道源码
*/ */
public interface ProdServiceAreasService { public interface ProdServiceAreasService extends IService<ProdServiceAreasDO> {
/** /**
* 创建服务区域 * 创建服务区域

View File

@@ -1,8 +1,11 @@
package com.tashow.cloud.product.service.impl; package com.tashow.cloud.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tashow.cloud.common.exception.ErrorCode; import com.tashow.cloud.common.exception.ErrorCode;
import com.tashow.cloud.product.dto.CategoryDO; import com.tashow.cloud.product.dto.CategoryDO;
import com.tashow.cloud.product.dto.ProdPropValueDO;
import com.tashow.cloud.product.mapper.CategoryMapper; import com.tashow.cloud.product.mapper.CategoryMapper;
import com.tashow.cloud.product.mapper.ProdPropValueMapper;
import com.tashow.cloud.product.service.CategoryService; import com.tashow.cloud.product.service.CategoryService;
import com.tashow.cloud.product.vo.category.CategoryPageReqVO; import com.tashow.cloud.product.vo.category.CategoryPageReqVO;
import com.tashow.cloud.product.vo.category.CategorySaveReqVO; import com.tashow.cloud.product.vo.category.CategorySaveReqVO;
@@ -28,7 +31,7 @@ import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.except
*/ */
@Service @Service
@Validated @Validated
public class CategoryServiceImpl implements CategoryService { public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> implements CategoryService {
@Resource @Resource
private CategoryMapper categoryMapper; private CategoryMapper categoryMapper;

View File

@@ -1,6 +1,9 @@
package com.tashow.cloud.product.service.impl; package com.tashow.cloud.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tashow.cloud.product.dto.ProdPropDO;
import com.tashow.cloud.product.dto.ProdServiceAreasDO; import com.tashow.cloud.product.dto.ProdServiceAreasDO;
import com.tashow.cloud.product.mapper.ProdPropMapper;
import com.tashow.cloud.product.mapper.ProdServiceAreasMapper; import com.tashow.cloud.product.mapper.ProdServiceAreasMapper;
import com.tashow.cloud.product.service.ProdServiceAreasService; import com.tashow.cloud.product.service.ProdServiceAreasService;
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasPageReqVO; import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasPageReqVO;
@@ -26,7 +29,7 @@ import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.except
*/ */
@Service @Service
@Validated @Validated
public class ProdServiceAreasServiceImpl implements ProdServiceAreasService { public class ProdServiceAreasServiceImpl extends ServiceImpl<ProdServiceAreasMapper, ProdServiceAreasDO> implements ProdServiceAreasService {
@Resource @Resource
private ProdServiceAreasMapper prodServiceAreasMapper; private ProdServiceAreasMapper prodServiceAreasMapper;

View File

@@ -1,17 +1,18 @@
package com.tashow.cloud.product.service.impl; package com.tashow.cloud.product.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tashow.cloud.mybatis.mybatis.core.util.MyBatisUtils; import com.tashow.cloud.mybatis.mybatis.core.util.MyBatisUtils;
import com.tashow.cloud.product.dto.ProdDO; import com.tashow.cloud.product.dto.*;
import com.tashow.cloud.product.dto.SkuDO; import com.tashow.cloud.product.mapper.*;
import com.tashow.cloud.product.mapper.ProdMapper;
import com.tashow.cloud.product.mapper.SkuMapper;
import com.tashow.cloud.product.service.ProdPropService; import com.tashow.cloud.product.service.ProdPropService;
import com.tashow.cloud.product.service.ProdService; import com.tashow.cloud.product.service.ProdService;
import com.tashow.cloud.product.vo.prod.ProdPageReqVO; import com.tashow.cloud.product.vo.prod.ProdPageReqVO;
import com.tashow.cloud.product.vo.prod.ProdSaveReqVO; import com.tashow.cloud.product.vo.prod.ProdSaveReqVO;
import com.tashow.cloud.product.vo.prod.ProdServiceVO;
import com.tashow.cloud.productapi.enums.BaseEnum;
import lombok.val; import lombok.val;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@@ -41,6 +42,26 @@ public class ProdServiceImpl implements ProdService {
private SkuMapper skuMapper; private SkuMapper skuMapper;
@Resource @Resource
private ProdPropService prodPropService; private ProdPropService prodPropService;
@Resource
private ProdServiceAreasMapper prodServiceAreasMapper;
@Resource
private ProdServiceAreaRelevanceMapper prodServiceAreaRelevanceMapper;
@Resource
private ProdServiceOverAreaRulesMapper prodServiceOverAreaRulesMapper;
@Resource
private ProdReservationConfigMapper prodReservationConfigMapper;
@Resource
private ProdEmergencyResponseIntervalsMapper prodEmergencyResponseIntervalsMapper;
@Resource
private ProdEmergencyResponseMapper prodEmergencyResponseMapper;
@Resource
private ProductOrderLimitMapper productOrderLimitMapper;
@Resource
private ProdAdditionalFeeDatesMapper prodAdditionalFeeDatesMapper;
@Resource
private ProdAdditionalFeePeriodsMapper prodAdditionalFeePeriodsMapper;
@Resource
private ProdWeightRangePricesMapper prodWeightRangePricesMapper;
@Override @Override
public Long createProd(ProdSaveReqVO createReqVO) { public Long createProd(ProdSaveReqVO createReqVO) {
@@ -62,6 +83,152 @@ public class ProdServiceImpl implements ProdService {
return prod.getProdId(); return prod.getProdId();
} }
@Override
public void createProdService(ProdServiceVO prodServiceVO) {
ProdDO prodDO = new ProdDO();
prodDO.setProdId(prodServiceVO.getProdId());
//服务区域设置
if(Objects.equals(prodServiceVO.getRegionSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setRegionSwitch(BaseEnum.YES_ONE.getKey());
//保存区域设置信息
ProdServiceOverAreaRulesDO prodServiceOverAreaRules =prodServiceVO.getProdServiceAreasInfo().getOverAreaRules();
prodServiceOverAreaRules.setProdId(prodDO.getProdId());
prodServiceOverAreaRulesMapper.insert(prodServiceOverAreaRules);
//保存区域
List<String> areaNameList =prodServiceVO.getProdServiceAreasInfo().getAreaNameList();
for(String areaName : areaNameList){
//查询区域信息
ProdServiceAreasDO prodServiceAreas = prodServiceAreasMapper.selectOne(new LambdaQueryWrapper<ProdServiceAreasDO>()
.eq(ProdServiceAreasDO::getAreaName, areaName)
);
if(prodServiceAreas == null){
//插入关联表
prodServiceAreaRelevanceMapper.insert(new ProdServiceAreaRelevanceDO()
.setProdId(prodDO.getProdId())
.setAreaId(prodServiceAreas.getId())
);
}
}
}
//预约设置设置
if(Objects.equals(prodServiceVO.getReservationSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setReservationSwitch(BaseEnum.YES_ONE.getKey());
ProdReservationConfigDO prodReservationConfigDO = prodServiceVO.prodReservationConfig;
prodReservationConfigDO.setProdId(prodDO.getProdId());
prodReservationConfigMapper.insert(prodReservationConfigDO);
}
//紧急响应设置
if(Objects.equals(prodServiceVO.getEmergencySwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setEmergencySwitch(BaseEnum.YES_ONE.getKey());
ProdEmergencyResponseDO prodEmergencyResponse = prodServiceVO.prodEmergencyInfoVO.getProdEmergencyResponse();
prodEmergencyResponse.setProdId(prodDO.getProdId());
prodEmergencyResponseMapper.insert(prodEmergencyResponse);
for (ProdEmergencyResponseIntervalsDO prodEmergencyResponseIntervals : prodServiceVO.prodEmergencyInfoVO.getProdEmergencyResponseIntervalsList()){
prodEmergencyResponseIntervals.setConfigId(prodEmergencyResponse.getId());
prodEmergencyResponseIntervalsMapper.insert(prodEmergencyResponseIntervals);
}
}
//接单上线设置
if(Objects.equals(prodServiceVO.getOrderLimitSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setOrderLimitSwitch(BaseEnum.YES_ONE.getKey());
ProductOrderLimitDO productOrderLimit = prodServiceVO.ProductOrderLimitVO;
productOrderLimit.setProdId(prodDO.getProdId());
productOrderLimitMapper.insert(productOrderLimit);
}
//特殊时段设置
if(Objects.equals(prodServiceVO.getAdditionalSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setAdditionalSwitch(BaseEnum.YES_ONE.getKey());
for (ProdAdditionalFeeDatesDO prodAdditionalFeeDates : prodServiceVO.getProdAdditionalFeeDatesList()){
prodAdditionalFeeDates.setProdId(prodServiceVO.getProdId());
prodAdditionalFeeDatesMapper.insert(prodAdditionalFeeDates);
}
}
//特殊日期设置
if(Objects.equals(prodServiceVO.getAdditionalFeeSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setAdditionalFeeSwitch(BaseEnum.YES_ONE.getKey());
for (ProdAdditionalFeePeriodsDO prodAdditionalFeePeriods : prodServiceVO.getProdAdditionalFeePeriodsList()){
prodAdditionalFeePeriods.setProdId(prodServiceVO.getProdId());
prodAdditionalFeePeriodsMapper.insert(prodAdditionalFeePeriods);
}
}
//体重设置
if(Objects.equals(prodServiceVO.getWeightSwitch(),BaseEnum.YES_ONE.getKey())){
prodDO.setWeightSwitch(BaseEnum.YES_ONE.getKey());
ProdWeightRangePricesDO prodWeightRangePrices = prodServiceVO.prodWeightConfig;
prodWeightRangePrices.setProdId(prodDO.getProdId());
prodWeightRangePricesMapper.insert(prodWeightRangePrices);
}
prodMapper.updateById(prodDO);
}
@Override
@Transactional
public void uptateProdService(ProdServiceVO prodServiceVO) {
ProdDO prod = BeanUtils.toBean(prodServiceVO, ProdDO.class);
//服务区域设置
if(Objects.equals(prodServiceVO.getRegionSwitch(),BaseEnum.YES_ONE.getKey())){
//保存区域设置信息
ProdServiceOverAreaRulesDO prodServiceOverAreaRules =prodServiceVO.getProdServiceAreasInfo().getOverAreaRules();
prodServiceOverAreaRules.setProdId(prodServiceVO.getProdId());
prodServiceOverAreaRulesMapper.updateById(prodServiceOverAreaRules);
//先批量删除区域关联表
prodServiceAreaRelevanceMapper.deleteRelevance(prodServiceVO.getProdId());
//保存区域
List<String> areaNameList =prodServiceVO.getProdServiceAreasInfo().getAreaNameList();
for(String areaName : areaNameList){
//查询区域信息
ProdServiceAreasDO prodServiceAreas = prodServiceAreasMapper.selectOne(new LambdaQueryWrapper<ProdServiceAreasDO>()
.eq(ProdServiceAreasDO::getAreaName, areaName)
);
if(prodServiceAreas == null){
//插入关联表
prodServiceAreaRelevanceMapper.insert(new ProdServiceAreaRelevanceDO()
.setProdId(prodServiceVO.getProdId())
.setAreaId(prodServiceAreas.getId())
);
}
}
}
//预约设置设置
if(Objects.equals(prodServiceVO.getReservationSwitch(),BaseEnum.YES_ONE.getKey())){
prodReservationConfigMapper.updateById(prodServiceVO.prodReservationConfig);
}
//紧急响应设置
if(Objects.equals(prodServiceVO.getEmergencySwitch(),BaseEnum.YES_ONE.getKey())){
ProdEmergencyResponseDO prodEmergencyResponse = prodServiceVO.prodEmergencyInfoVO.getProdEmergencyResponse();
prodEmergencyResponseMapper.insert(prodEmergencyResponse);
for (ProdEmergencyResponseIntervalsDO prodEmergencyResponseIntervals : prodServiceVO.prodEmergencyInfoVO.getProdEmergencyResponseIntervalsList()){
prodEmergencyResponseIntervals.setConfigId(prodEmergencyResponse.getId());
prodEmergencyResponseIntervalsMapper.insert(prodEmergencyResponseIntervals);
}
}
//接单上线设置
if(Objects.equals(prodServiceVO.getOrderLimitSwitch(),BaseEnum.YES_ONE.getKey())){
productOrderLimitMapper.insert(prodServiceVO.ProductOrderLimitVO);
}
//特殊时段设置
if(Objects.equals(prodServiceVO.getAdditionalSwitch(),BaseEnum.YES_ONE.getKey())){
for (ProdAdditionalFeeDatesDO prodAdditionalFeeDates : prodServiceVO.getProdAdditionalFeeDatesList()){
prodAdditionalFeeDates.setProdId(prodServiceVO.getProdId());
prodAdditionalFeeDatesMapper.insert(prodAdditionalFeeDates);
}
}
//特殊日期设置
if(Objects.equals(prodServiceVO.getAdditionalFeeSwitch(),BaseEnum.YES_ONE.getKey())){
for (ProdAdditionalFeePeriodsDO prodAdditionalFeePeriods : prodServiceVO.getProdAdditionalFeePeriodsList()){
prodAdditionalFeePeriods.setProdId(prodServiceVO.getProdId());
prodAdditionalFeePeriodsMapper.insert(prodAdditionalFeePeriods);
}
}
//体重设置
if(Objects.equals(prodServiceVO.getWeightSwitch(),BaseEnum.YES_ONE.getKey())){
prodWeightRangePricesMapper.insert(prodServiceVO.prodWeightConfig);
}
prodMapper.updateById(prod);
}
@Override @Override
public void updateProd(ProdSaveReqVO updateReqVO) { public void updateProd(ProdSaveReqVO updateReqVO) {
// 校验存在 // 校验存在

View File

@@ -31,7 +31,7 @@ public class CategoryPageReqVO extends PageParam {
private String pic; private String pic;
@Schema(description = "类目描述") @Schema(description = "类目描述")
private String describe; private String description;
@Schema(description = "标签") @Schema(description = "标签")
private String tag; private String tag;

View File

@@ -38,7 +38,7 @@ public class CategoryRespVO {
@Schema(description = "类目描述") @Schema(description = "类目描述")
@ExcelProperty("类目描述") @ExcelProperty("类目描述")
private String describe; private String description;
@Schema(description = "标签") @Schema(description = "标签")
@ExcelProperty("标签") @ExcelProperty("标签")

View File

@@ -13,7 +13,6 @@ public class CategorySaveReqVO {
private Long categoryId; private Long categoryId;
@Schema(description = "店铺ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22369") @Schema(description = "店铺ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22369")
@NotNull(message = "店铺ID不能为空")
private Long shopId; private Long shopId;
@Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509") @Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509")
@@ -31,20 +30,18 @@ public class CategorySaveReqVO {
private String pic; private String pic;
@Schema(description = "类目描述") @Schema(description = "类目描述")
private String describe; private String description;
@Schema(description = "标签") @Schema(description = "标签")
private String tag; private String tag;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "排序不能为空")
private Integer seq; private Integer seq;
@Schema(description = "默认是1表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "默认是1表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "默认是1表示正常状态,0为下线状态不能为空")
private Integer status; private Integer status;
@Schema(description = "分类层级", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "分类层级 1级 2级 3级", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "分类层级不能为空") @NotNull(message = "分类层级不能为空")
private Integer grade; private Integer grade;

View File

@@ -53,7 +53,7 @@ public class ProdPageReqVO extends PageParam {
@Schema(description = "商品轮播图片,以,分割") @Schema(description = "商品轮播图片,以,分割")
private String imgs; private String imgs;
@Schema(description = "默认是1表示正常状态, -1表示删除, 0下架", example = "2") @Schema(description = "默认是1正常状态(出售中), 0下架(仓库中) 2待审核", example = "2")
private Integer status; private Integer status;
@Schema(description = "商品分类", example = "14895") @Schema(description = "商品分类", example = "14895")

View File

@@ -64,8 +64,8 @@ public class ProdRespVO {
@ExcelProperty("商品轮播图片,以,分割") @ExcelProperty("商品轮播图片,以,分割")
private String imgs; private String imgs;
@Schema(description = "默认是1表示正常状态, -1表示删除, 0下架", example = "2") @Schema(description = "默认是1正常状态(出售中), 0下架(仓库中) 2待审核", example = "2")
@ExcelProperty("默认是1表示正常状态, -1表示删除, 0下架") @ExcelProperty("默认是1正常状态(出售中), 0下架(仓库中) 2待审核")
private Integer status; private Integer status;
@Schema(description = "商品分类", example = "14895") @Schema(description = "商品分类", example = "14895")

View File

@@ -52,7 +52,7 @@ public class ProdSaveReqVO {
@Schema(description = "商品轮播图片,以,分割") @Schema(description = "商品轮播图片,以,分割")
private String imgs; private String imgs;
@Schema(description = "默认是1表示正常状态, -1表示删除, 0下架", example = "2") @Schema(description = "默认是1正常状态(出售中), 0下架(仓库中) 2待审核", example = "2")
private Integer status; private Integer status;
@Schema(description = "商品分类", example = "14895") @Schema(description = "商品分类", example = "14895")

View File

@@ -0,0 +1,68 @@
package com.tashow.cloud.product.vo.prod;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.tashow.cloud.product.dto.*;
import com.tashow.cloud.product.vo.prodemergencyresponse.ProdEmergencyInfoVO;
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasInfoVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "商品服务配置 VO")
@Data
@ExcelIgnoreUnannotated
public class ProdServiceVO {
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6943")
private Long prodId;
@Schema(description = "是否开启服务区域配置0关1开")
@ExcelProperty("是否开启区域0关1开")
private Integer regionSwitch;
@Schema(description = "服务区域配置")
public ProdServiceAreasInfoVO prodServiceAreasInfo;
@Schema(description = "是否预约0关1开")
@ExcelProperty("是否预约0关1开")
private Integer reservationSwitch;
@Schema(description = "预约配置")
public ProdReservationConfigDO prodReservationConfig;
@Schema(description = "是否紧急响应服务0关1开")
@ExcelProperty("是否紧急响应服务0关1开")
private Integer emergencySwitch;
@Schema(description = "急响应服务配置")
public ProdEmergencyInfoVO prodEmergencyInfoVO;
@Schema(description = "是否接单上线0关1开")
@ExcelProperty("是否接单上线0关1开")
private Integer orderLimitSwitch;
@Schema(description = "接单上线配置")
public ProductOrderLimitDO ProductOrderLimitVO;
@Schema(description = "是否特殊时段0关1开")
@ExcelProperty("是否特殊时段0关1开")
private Integer additionalSwitch;
@Schema(description = "特殊时段规则配置")
public List<ProdAdditionalFeeDatesDO> ProdAdditionalFeeDatesList;
@Schema(description = "是否特殊日期节假日周末什么的0关1开")
@ExcelProperty("是否特殊日期节假日周末什么的0关1开")
private Integer additionalFeeSwitch;
@Schema(description = "特殊日期规则配置")
public List<ProdAdditionalFeePeriodsDO> prodAdditionalFeePeriodsList;
@Schema(description = "是否开启体重配置0关1开")
@ExcelProperty("是否开启体重配置0关1开")
private Integer weightSwitch;
@Schema(description = "体重配置")
public ProdWeightRangePricesDO prodWeightConfig;
}

View File

@@ -0,0 +1,24 @@
package com.tashow.cloud.product.vo.prodemergencyresponse;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.tashow.cloud.product.dto.ProdEmergencyResponseDO;
import com.tashow.cloud.product.dto.ProdEmergencyResponseIntervalsDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 商品紧急响应服务设置 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProdEmergencyInfoVO {
@Schema(description = "紧急响应服务配置")
private ProdEmergencyResponseDO prodEmergencyResponse;
@Schema(description = "紧急响应时间区间设置")
private List<ProdEmergencyResponseIntervalsDO> ProdEmergencyResponseIntervalsList;
}

View File

@@ -39,6 +39,16 @@ public class ProdReservationConfigPageReqVO extends PageParam {
@Schema(description = "黑名自定义日期JSON格式存储") @Schema(description = "黑名自定义日期JSON格式存储")
private String blacklistedDates; private String blacklistedDates;
/**
* '是否开启黑名单自定义0关1开'
*/
private Integer isBlacklisted;
/**
* '是否开启黑名单指定日期0关1开'
*/
private Integer isBlackAppoint;
@Schema(description = "黑名单指定日期JSON格式存储") @Schema(description = "黑名单指定日期JSON格式存储")
private String blackAppointDates; private String blackAppointDates;

View File

@@ -48,6 +48,16 @@ public class ProdReservationConfigRespVO {
@ExcelProperty("黑名自定义日期JSON格式存储") @ExcelProperty("黑名自定义日期JSON格式存储")
private String blacklistedDates; private String blacklistedDates;
/**
* '是否开启黑名单自定义0关1开'
*/
private Integer isBlacklisted;
/**
* '是否开启黑名单指定日期0关1开'
*/
private Integer isBlackAppoint;
@Schema(description = "黑名单指定日期JSON格式存储") @Schema(description = "黑名单指定日期JSON格式存储")
@ExcelProperty("黑名单指定日期JSON格式存储") @ExcelProperty("黑名单指定日期JSON格式存储")
private String blackAppointDates; private String blackAppointDates;

View File

@@ -43,6 +43,16 @@ public class ProdReservationConfigSaveReqVO {
@Schema(description = "黑名自定义日期JSON格式存储") @Schema(description = "黑名自定义日期JSON格式存储")
private String blacklistedDates; private String blacklistedDates;
/**
* '是否开启黑名单自定义0关1开'
*/
private Integer isBlacklisted;
/**
* '是否开启黑名单指定日期0关1开'
*/
private Integer isBlackAppoint;
@Schema(description = "黑名单指定日期JSON格式存储") @Schema(description = "黑名单指定日期JSON格式存储")
private String blackAppointDates; private String blackAppointDates;

View File

@@ -0,0 +1,23 @@
package com.tashow.cloud.product.vo.prodserviceareas;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.tashow.cloud.product.dto.ProdServiceOverAreaRulesDO;
import com.tashow.cloud.product.vo.prodserviceoverarearules.ProdServiceOverAreaRulesRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 服务区域 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProdServiceAreasInfoVO {
@Schema(description = "服务区域地址名称")
private List<String> areaNameList;
public ProdServiceOverAreaRulesDO overAreaRules;
}

View File

@@ -9,4 +9,7 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/ 文档可见https://www.iocoder.cn/MyBatis/x-plugins/
--> -->
<delete id="deleteRelevance">
delete from tz_prod_service_area_relevance where prod_id = #{prodId}
</delete>
</mapper> </mapper>