创建商品服务
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
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.ProdPropDO;
|
||||
import com.tashow.cloud.product.service.CategoryService;
|
||||
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 jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -29,28 +34,41 @@ import static com.tashow.cloud.web.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 产品类目")
|
||||
@RestController
|
||||
@RequestMapping("/tz/category")
|
||||
@RequestMapping("/category")
|
||||
@Validated
|
||||
public class CategoryController {
|
||||
|
||||
@Resource
|
||||
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")
|
||||
@Operation(summary = "创建产品类目")
|
||||
@PreAuthorize("@ss.hasPermission('tz:category:create')")
|
||||
@PermitAll
|
||||
public CommonResult<Long> createCategory(@Valid @RequestBody CategorySaveReqVO createReqVO) {
|
||||
return success(categoryService.createCategory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品类目")
|
||||
@PreAuthorize("@ss.hasPermission('tz:category:update')")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateCategory(@Valid @RequestBody CategorySaveReqVO updateReqVO) {
|
||||
categoryService.updateCategory(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产品类目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@@ -75,7 +93,7 @@ public class CategoryController {
|
||||
public CommonResult<PageResult<CategoryRespVO>> getCategoryPage(@Valid CategoryPageReqVO pageReqVO) {
|
||||
PageResult<CategoryDO> pageResult = categoryService.getCategoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CategoryRespVO.class));
|
||||
}
|
||||
}*/
|
||||
|
||||
/* @GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产品类目 Excel")
|
||||
|
||||
@@ -40,6 +40,25 @@ public class ProdController {
|
||||
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")
|
||||
@Operation(summary = "更新商品")
|
||||
@PreAuthorize("@ss.hasPermission('tashow-module-product:prod:update')")
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
* 分类层级
|
||||
* 分类层级 1、2、3级
|
||||
*/
|
||||
private Integer grade;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ProdDO extends BaseDO {
|
||||
*/
|
||||
private String imgs;
|
||||
/**
|
||||
* 默认是1,表示正常状态, -1表示删除, 0下架
|
||||
* 默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
@@ -98,31 +98,31 @@ public class ProdDO extends BaseDO {
|
||||
/**
|
||||
* 是否开启区域0关1开
|
||||
*/
|
||||
private Boolean regionSwitch;
|
||||
private Integer regionSwitch;
|
||||
/**
|
||||
* 是否特殊时段0关1开
|
||||
*/
|
||||
private Boolean additionalSwitch;
|
||||
private Integer additionalSwitch;
|
||||
/**
|
||||
* 是否特殊日期(节假日周末什么的)0关1开
|
||||
*/
|
||||
private Boolean additionalFeeSwitch;
|
||||
private Integer additionalFeeSwitch;
|
||||
/**
|
||||
* 是否紧急响应服务0关1开
|
||||
*/
|
||||
private Boolean emergencySwitch;
|
||||
private Integer emergencySwitch;
|
||||
/**
|
||||
* 是否预约0关1开
|
||||
*/
|
||||
private Boolean reservationSwitch;
|
||||
private Integer reservationSwitch;
|
||||
/**
|
||||
* 是否接单上线0关1开
|
||||
*/
|
||||
private Boolean orderLimitSwitch;
|
||||
private Integer orderLimitSwitch;
|
||||
/**
|
||||
* 是否开启体重配置0关1开
|
||||
*/
|
||||
private Boolean weightSwitch;
|
||||
private Integer weightSwitch;
|
||||
/**
|
||||
* 版本 乐观锁
|
||||
*/
|
||||
|
||||
@@ -51,13 +51,5 @@ public class ProdEmergencyResponseDO extends BaseDO {
|
||||
* 固定休息日周末是否开启0关闭1开启
|
||||
*/
|
||||
private Boolean blackWeekend;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@@ -53,13 +53,5 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
|
||||
* 价格或上浮百分比
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class ProdReservationConfigDO extends BaseDO {
|
||||
/**
|
||||
* 是否允许更改预约时间 1可以 0不可以
|
||||
*/
|
||||
private Boolean allowChange;
|
||||
private Integer allowChange;
|
||||
/**
|
||||
* 更改预约时间的时间规则(如服务开始前1小时可更改)
|
||||
*/
|
||||
@@ -59,6 +59,17 @@ public class ProdReservationConfigDO extends BaseDO {
|
||||
* 黑名自定义日期(JSON格式存储)
|
||||
*/
|
||||
private String blacklistedDates;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单自定义0关1开'
|
||||
*/
|
||||
private Integer isBlacklisted;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单指定日期0关1开'
|
||||
*/
|
||||
private Integer isBlackAppoint;
|
||||
|
||||
/**
|
||||
* 黑名单指定日期(JSON格式存储)
|
||||
*/
|
||||
@@ -66,18 +77,10 @@ public class ProdReservationConfigDO extends BaseDO {
|
||||
/**
|
||||
* 法定节假日是否开启0:关闭1开启
|
||||
*/
|
||||
private Boolean blackHappy;
|
||||
private Integer blackHappy;
|
||||
/**
|
||||
* 固定休息日周末是否开启0关闭1开启
|
||||
*/
|
||||
private Boolean blackWeekend;
|
||||
/**
|
||||
* 配置创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 配置最后更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
private Integer blackWeekend;
|
||||
|
||||
}
|
||||
@@ -13,12 +13,11 @@ import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
@TableName("tz_prod_service_area_relevance")
|
||||
@KeySequence("tz_prod_service_area_relevance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProdServiceAreaRelevanceDO extends BaseDO {
|
||||
public class ProdServiceAreaRelevanceDO{
|
||||
|
||||
/**
|
||||
* 关联的商品ID
|
||||
|
||||
@@ -40,13 +40,5 @@ public class ProdServiceOverAreaRulesDO extends BaseDO {
|
||||
* 超区费用(仅在rule_type为accept_with_fee时有效)
|
||||
*/
|
||||
private BigDecimal fee;
|
||||
/**
|
||||
* 规则创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 规则最后更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@@ -39,13 +39,5 @@ public class ProductOrderLimitDO extends BaseDO {
|
||||
* 上限阈值
|
||||
*/
|
||||
private Integer maxOrders;
|
||||
/**
|
||||
* 配置创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 配置最后更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
}
|
||||
@@ -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.product.dto.ProdServiceAreaRelevanceDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 商品与服务区域关联 Mapper
|
||||
@@ -16,4 +17,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface ProdServiceAreaRelevanceMapper extends BaseMapperX<ProdServiceAreaRelevanceDO> {
|
||||
|
||||
/**
|
||||
* 删除关联
|
||||
*/
|
||||
public int deleteRelevance(@Param("prodId")Long prodId);
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.tashow.cloud.product.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
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.CategorySaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
@@ -14,7 +16,7 @@ import com.tashow.cloud.common.pojo.PageParam;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface CategoryService {
|
||||
public interface CategoryService extends IService<CategoryDO> {
|
||||
|
||||
/**
|
||||
* 创建产品类目
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.*;
|
||||
import com.tashow.cloud.product.dto.ProdDO;
|
||||
import com.tashow.cloud.product.vo.prod.ProdPageReqVO;
|
||||
import com.tashow.cloud.product.vo.prod.ProdSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.prod.ProdServiceVO;
|
||||
import jakarta.validation.*;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
@@ -24,6 +25,25 @@ public interface ProdService {
|
||||
*/
|
||||
Long createProd(@Valid ProdSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 创建商品服务配置
|
||||
*
|
||||
* @param prodServiceVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
void createProdService(@Valid ProdServiceVO prodServiceVO);
|
||||
|
||||
|
||||
/**
|
||||
* 修改商品服务配置
|
||||
*
|
||||
* @param prodServiceVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
void uptateProdService(@Valid ProdServiceVO prodServiceVO);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
*
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.tashow.cloud.product.service;
|
||||
|
||||
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.vo.prodserviceareas.ProdServiceAreasPageReqVO;
|
||||
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasSaveReqVO;
|
||||
@@ -14,7 +16,7 @@ import com.tashow.cloud.common.pojo.PageParam;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface ProdServiceAreasService {
|
||||
public interface ProdServiceAreasService extends IService<ProdServiceAreasDO> {
|
||||
|
||||
/**
|
||||
* 创建服务区域
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
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.product.dto.CategoryDO;
|
||||
import com.tashow.cloud.product.dto.ProdPropValueDO;
|
||||
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.vo.category.CategoryPageReqVO;
|
||||
import com.tashow.cloud.product.vo.category.CategorySaveReqVO;
|
||||
@@ -28,7 +31,7 @@ import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.except
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CategoryServiceImpl implements CategoryService {
|
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> implements CategoryService {
|
||||
|
||||
@Resource
|
||||
private CategoryMapper categoryMapper;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
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.mapper.ProdPropMapper;
|
||||
import com.tashow.cloud.product.mapper.ProdServiceAreasMapper;
|
||||
import com.tashow.cloud.product.service.ProdServiceAreasService;
|
||||
import com.tashow.cloud.product.vo.prodserviceareas.ProdServiceAreasPageReqVO;
|
||||
@@ -26,7 +29,7 @@ import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.except
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProdServiceAreasServiceImpl implements ProdServiceAreasService {
|
||||
public class ProdServiceAreasServiceImpl extends ServiceImpl<ProdServiceAreasMapper, ProdServiceAreasDO> implements ProdServiceAreasService {
|
||||
|
||||
@Resource
|
||||
private ProdServiceAreasMapper prodServiceAreasMapper;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.tashow.cloud.product.service.impl;
|
||||
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.util.MyBatisUtils;
|
||||
import com.tashow.cloud.product.dto.ProdDO;
|
||||
import com.tashow.cloud.product.dto.SkuDO;
|
||||
import com.tashow.cloud.product.mapper.ProdMapper;
|
||||
import com.tashow.cloud.product.mapper.SkuMapper;
|
||||
import com.tashow.cloud.product.dto.*;
|
||||
import com.tashow.cloud.product.mapper.*;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.service.ProdService;
|
||||
import com.tashow.cloud.product.vo.prod.ProdPageReqVO;
|
||||
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 org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -41,6 +42,26 @@ public class ProdServiceImpl implements ProdService {
|
||||
private SkuMapper skuMapper;
|
||||
@Resource
|
||||
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
|
||||
public Long createProd(ProdSaveReqVO createReqVO) {
|
||||
@@ -62,6 +83,152 @@ public class ProdServiceImpl implements ProdService {
|
||||
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
|
||||
public void updateProd(ProdSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CategoryPageReqVO extends PageParam {
|
||||
private String pic;
|
||||
|
||||
@Schema(description = "类目描述")
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tag;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CategoryRespVO {
|
||||
|
||||
@Schema(description = "类目描述")
|
||||
@ExcelProperty("类目描述")
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
@Schema(description = "标签")
|
||||
@ExcelProperty("标签")
|
||||
|
||||
@@ -13,7 +13,6 @@ public class CategorySaveReqVO {
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "店铺ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22369")
|
||||
@NotNull(message = "店铺ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
@Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509")
|
||||
@@ -31,20 +30,18 @@ public class CategorySaveReqVO {
|
||||
private String pic;
|
||||
|
||||
@Schema(description = "类目描述")
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tag;
|
||||
|
||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer seq;
|
||||
|
||||
@Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "默认是1,表示正常状态,0为下线状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分类层级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "分类层级 1级 2级 3级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "分类层级不能为空")
|
||||
private Integer grade;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ProdPageReqVO extends PageParam {
|
||||
@Schema(description = "商品轮播图片,以,分割")
|
||||
private String imgs;
|
||||
|
||||
@Schema(description = "默认是1,表示正常状态, -1表示删除, 0下架", example = "2")
|
||||
@Schema(description = "默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品分类", example = "14895")
|
||||
|
||||
@@ -64,8 +64,8 @@ public class ProdRespVO {
|
||||
@ExcelProperty("商品轮播图片,以,分割")
|
||||
private String imgs;
|
||||
|
||||
@Schema(description = "默认是1,表示正常状态, -1表示删除, 0下架", example = "2")
|
||||
@ExcelProperty("默认是1,表示正常状态, -1表示删除, 0下架")
|
||||
@Schema(description = "默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核", example = "2")
|
||||
@ExcelProperty("默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品分类", example = "14895")
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ProdSaveReqVO {
|
||||
@Schema(description = "商品轮播图片,以,分割")
|
||||
private String imgs;
|
||||
|
||||
@Schema(description = "默认是1,表示正常状态, -1表示删除, 0下架", example = "2")
|
||||
@Schema(description = "默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "商品分类", example = "14895")
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -39,6 +39,16 @@ public class ProdReservationConfigPageReqVO extends PageParam {
|
||||
@Schema(description = "黑名自定义日期(JSON格式存储)")
|
||||
private String blacklistedDates;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单自定义0关1开'
|
||||
*/
|
||||
private Integer isBlacklisted;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单指定日期0关1开'
|
||||
*/
|
||||
private Integer isBlackAppoint;
|
||||
|
||||
@Schema(description = "黑名单指定日期(JSON格式存储)")
|
||||
private String blackAppointDates;
|
||||
|
||||
|
||||
@@ -48,6 +48,16 @@ public class ProdReservationConfigRespVO {
|
||||
@ExcelProperty("黑名自定义日期(JSON格式存储)")
|
||||
private String blacklistedDates;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单自定义0关1开'
|
||||
*/
|
||||
private Integer isBlacklisted;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单指定日期0关1开'
|
||||
*/
|
||||
private Integer isBlackAppoint;
|
||||
|
||||
@Schema(description = "黑名单指定日期(JSON格式存储)")
|
||||
@ExcelProperty("黑名单指定日期(JSON格式存储)")
|
||||
private String blackAppointDates;
|
||||
|
||||
@@ -43,6 +43,16 @@ public class ProdReservationConfigSaveReqVO {
|
||||
@Schema(description = "黑名自定义日期(JSON格式存储)")
|
||||
private String blacklistedDates;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单自定义0关1开'
|
||||
*/
|
||||
private Integer isBlacklisted;
|
||||
|
||||
/**
|
||||
* '是否开启黑名单指定日期0关1开'
|
||||
*/
|
||||
private Integer isBlackAppoint;
|
||||
|
||||
@Schema(description = "黑名单指定日期(JSON格式存储)")
|
||||
private String blackAppointDates;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -9,4 +9,7 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteRelevance">
|
||||
delete from tz_prod_service_area_relevance where prod_id = #{prodId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user