diff --git a/logs/gateway-server.log.2025-07-28.0.gz b/logs/gateway-server.log.2025-07-28.0.gz new file mode 100644 index 0000000..f54c22a Binary files /dev/null and b/logs/gateway-server.log.2025-07-28.0.gz differ diff --git a/logs/infra-server.log.2025-07-28.0.gz b/logs/infra-server.log.2025-07-28.0.gz new file mode 100644 index 0000000..1aa7573 Binary files /dev/null and b/logs/infra-server.log.2025-07-28.0.gz differ diff --git a/logs/system-server.log.2025-07-28.0.gz b/logs/system-server.log.2025-07-28.0.gz new file mode 100644 index 0000000..1f4fd79 Binary files /dev/null and b/logs/system-server.log.2025-07-28.0.gz differ diff --git a/tashow-feign/pom.xml b/tashow-feign/pom.xml index feb8d49..762c0de 100644 --- a/tashow-feign/pom.xml +++ b/tashow-feign/pom.xml @@ -13,6 +13,7 @@ tashow-infra-api tashow-system-api + tashow-product-api diff --git a/tashow-feign/tashow-product-api/pom.xml b/tashow-feign/tashow-product-api/pom.xml new file mode 100644 index 0000000..782cc10 --- /dev/null +++ b/tashow-feign/tashow-product-api/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.tashow.cloud + tashow-feign + ${revision} + + tashow-product-api + jar + + ${project.artifactId} + + infra 模块 API,暴露给其它模块调用 + + + + + com.tashow.cloud + tashow-common + + + + + org.springframework.boot + spring-boot-starter-validation + true + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + true + + + + diff --git a/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/api/package-info.java b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/api/package-info.java new file mode 100644 index 0000000..608b3bb --- /dev/null +++ b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/api/package-info.java @@ -0,0 +1,4 @@ +/** + * infra API 包,定义暴露给其它模块的 API + */ +package com.tashow.cloud.productapi.api; diff --git a/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ApiConstants.java b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ApiConstants.java new file mode 100644 index 0000000..0fd09af --- /dev/null +++ b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ApiConstants.java @@ -0,0 +1,24 @@ +package com.tashow.cloud.productapi.enums; + + +import com.tashow.cloud.common.enums.RpcConstants; + +/** + * API 相关的枚举 + * + * @author 芋道源码 + */ +public class ApiConstants { + + /** + * 服务名 + * + * 注意,需要保证和 spring.application.name 保持一致 + */ + public static final String NAME = "product-server"; + + public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/infra"; + + public static final String VERSION = "1.0.0"; + +} diff --git a/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/DictTypeConstants.java b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/DictTypeConstants.java new file mode 100644 index 0000000..2a68d4f --- /dev/null +++ b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/DictTypeConstants.java @@ -0,0 +1,20 @@ +package com.tashow.cloud.productapi.enums; + +/** + * Infra 字典类型的枚举类 + * + * @author 芋道源码 + */ +public interface DictTypeConstants { + + String JOB_STATUS = "product_job_status"; // 定时任务状态的枚举 + String JOB_LOG_STATUS = "product_job_log_status"; // 定时任务日志状态的枚举 + + String API_ERROR_LOG_PROCESS_STATUS = "product_api_error_log_process_status"; // API 错误日志的处理状态的枚举 + + String CONFIG_TYPE = "product_config_type"; // 参数配置类型 + String BOOLEAN_STRING = "product_boolean_string"; // Boolean 是否类型 + + String OPERATE_TYPE = "product_operate_type"; // 操作类型 + +} diff --git a/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ErrorCodeConstants.java b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ErrorCodeConstants.java new file mode 100644 index 0000000..94780f5 --- /dev/null +++ b/tashow-feign/tashow-product-api/src/main/java/com/tashow/cloud/productapi/enums/ErrorCodeConstants.java @@ -0,0 +1,17 @@ +package com.tashow.cloud.productapi.enums; + + +import com.tashow.cloud.common.exception.ErrorCode; + +/** + * Infra 错误码枚举类 + * + * infra 系统,使用 1-001-000-000 段 + */ +public interface ErrorCodeConstants { + + ErrorCode CATEGORY_NOT_EXISTS = new ErrorCode(10001, "产品类目不存在"); + ErrorCode PROD_NOT_EXISTS = new ErrorCode(10002, "商品不存在"); + ErrorCode PROD_ADDITIONAL_FEE_DATES_NOT_EXISTS = new ErrorCode(10003, "特殊日期附加费用规则不存在"); + ErrorCode PROD_ADDITIONAL_FEE_PERIODS_NOT_EXISTS = new ErrorCode(10004, "特殊时段附加费用规则不存在"); +} diff --git a/tashow-module/tashow-module-product/pom.xml b/tashow-module/tashow-module-product/pom.xml index 24b9ddb..d8255bc 100644 --- a/tashow-module/tashow-module-product/pom.xml +++ b/tashow-module/tashow-module-product/pom.xml @@ -42,11 +42,12 @@ 2.2.20 - - - - - + + + com.tashow.cloud + tashow-framework-monitor + + @@ -55,7 +56,16 @@ 4.0.3 - + + com.tashow.cloud + tashow-product-api + ${revision} + + + com.tashow.cloud + tashow-data-excel + ${revision} + com.tashow.cloud diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/CategoryController.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/CategoryController.java index 351c86d..c415850 100644 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/CategoryController.java +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/CategoryController.java @@ -1,54 +1,93 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - *//* - - package com.tashow.cloud.product.controller; -import com.tashow.cloud.product.domain.Category; -import com.tashow.cloud.product.domain.ServerResponseEntity; +import com.tashow.cloud.product.dto.CategoryDO; import com.tashow.cloud.product.service.CategoryService; -import jakarta.annotation.security.PermitAll; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import com.tashow.cloud.product.vo.category.*; +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; -import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; -*/ -/** - * 分类接口 - * @author lanhai - *//* +import com.tashow.cloud.common.pojo.PageParam; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.CommonResult; +import com.tashow.cloud.common.util.object.BeanUtils; +import static com.tashow.cloud.common.pojo.CommonResult.success; + +import com.tashow.cloud.web.apilog.core.annotation.ApiAccessLog; +import static com.tashow.cloud.web.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 产品类目") @RestController -@RequestMapping("/category") +@RequestMapping("/tz/category") +@Validated public class CategoryController { - @Autowired + @Resource private CategoryService categoryService; - */ -/** - * 分类信息列表接口 - *//* - - @PermitAll - @GetMapping("/categoryInfo") - public ServerResponseEntity> categoryInfo() { - List categories = categoryService.tableCategory(1L); - return ServerResponseEntity.success(categories); + @PostMapping("/create") + @Operation(summary = "创建产品类目") + @PreAuthorize("@ss.hasPermission('tz:category:create')") + public CommonResult createCategory(@Valid @RequestBody CategorySaveReqVO createReqVO) { + return success(categoryService.createCategory(createReqVO)); } + @PutMapping("/update") + @Operation(summary = "更新产品类目") + @PreAuthorize("@ss.hasPermission('tz:category:update')") + public CommonResult updateCategory(@Valid @RequestBody CategorySaveReqVO updateReqVO) { + categoryService.updateCategory(updateReqVO); + return success(true); + } + @DeleteMapping("/delete") + @Operation(summary = "删除产品类目") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('tz:category:delete')") + public CommonResult deleteCategory(@RequestParam("id") Long id) { + categoryService.deleteCategory(id); + return success(true); + } -} -*/ + @GetMapping("/get") + @Operation(summary = "获得产品类目") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('tz:category:query')") + public CommonResult getCategory(@RequestParam("id") Long id) { + CategoryDO category = categoryService.getCategory(id); + return success(BeanUtils.toBean(category, CategoryRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得产品类目分页") + @PreAuthorize("@ss.hasPermission('tz:category:query')") + public CommonResult> getCategoryPage(@Valid CategoryPageReqVO pageReqVO) { + PageResult pageResult = categoryService.getCategoryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, CategoryRespVO.class)); + } + +/* @GetMapping("/export-excel") + @Operation(summary = "导出产品类目 Excel") + @PreAuthorize("@ss.hasPermission('tz:category:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportCategoryExcel(@Valid CategoryPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = categoryService.getCategoryPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "产品类目.xls", "数据", CategoryRespVO.class, + BeanUtils.toBean(list, CategoryRespVO.class)); + }*/ + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/ProdAdditionalFeeDatesController.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/ProdAdditionalFeeDatesController.java new file mode 100644 index 0000000..4776e21 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/controller/ProdAdditionalFeeDatesController.java @@ -0,0 +1,97 @@ +package com.tashow.cloud.product.controller; + +import com.tashow.cloud.product.dto.ProdAdditionalFeeDatesDO; +import com.tashow.cloud.product.service.ProdAdditionalFeeDatesService; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesPageReqVO; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesRespVO; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesSaveReqVO; +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.tashow.cloud.common.pojo.PageParam; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.CommonResult; +import com.tashow.cloud.common.util.object.BeanUtils; +import static com.tashow.cloud.common.pojo.CommonResult.success; + +import com.tashow.cloud.excel.excel.core.util.ExcelUtils; + +import com.tashow.cloud.web.apilog.core.annotation.ApiAccessLog; +import static com.tashow.cloud.web.apilog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 特殊日期附加费用规则") +@RestController +@RequestMapping("/tz/prod-additional-fee-dates") +@Validated +public class ProdAdditionalFeeDatesController { + + @Resource + private ProdAdditionalFeeDatesService prodAdditionalFeeDatesService; + + @PostMapping("/create") + @Operation(summary = "创建特殊日期附加费用规则") + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:create')") + public CommonResult createProdAdditionalFeeDates(@Valid @RequestBody ProdAdditionalFeeDatesSaveReqVO createReqVO) { + return success(prodAdditionalFeeDatesService.createProdAdditionalFeeDates(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新特殊日期附加费用规则") + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:update')") + public CommonResult updateProdAdditionalFeeDates(@Valid @RequestBody ProdAdditionalFeeDatesSaveReqVO updateReqVO) { + prodAdditionalFeeDatesService.updateProdAdditionalFeeDates(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除特殊日期附加费用规则") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:delete')") + public CommonResult deleteProdAdditionalFeeDates(@RequestParam("id") Long id) { + prodAdditionalFeeDatesService.deleteProdAdditionalFeeDates(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得特殊日期附加费用规则") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:query')") + public CommonResult getProdAdditionalFeeDates(@RequestParam("id") Long id) { + ProdAdditionalFeeDatesDO prodAdditionalFeeDates = prodAdditionalFeeDatesService.getProdAdditionalFeeDates(id); + return success(BeanUtils.toBean(prodAdditionalFeeDates, ProdAdditionalFeeDatesRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得特殊日期附加费用规则分页") + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:query')") + public CommonResult> getProdAdditionalFeeDatesPage(@Valid ProdAdditionalFeeDatesPageReqVO pageReqVO) { + PageResult pageResult = prodAdditionalFeeDatesService.getProdAdditionalFeeDatesPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProdAdditionalFeeDatesRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出特殊日期附加费用规则 Excel") + @PreAuthorize("@ss.hasPermission('tz:prod-additional-fee-dates:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportProdAdditionalFeeDatesExcel(@Valid ProdAdditionalFeeDatesPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = prodAdditionalFeeDatesService.getProdAdditionalFeeDatesPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "特殊日期附加费用规则.xls", "数据", ProdAdditionalFeeDatesRespVO.class, + BeanUtils.toBean(list, ProdAdditionalFeeDatesRespVO.class)); + } + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/BaseEntity.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/BaseEntity.java deleted file mode 100644 index b39a557..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/BaseEntity.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.tashow.cloud.product.domain; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * Entity基类 - * - * @author ruoyi - */ -public class BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 搜索值 - */ - @JsonIgnore - @TableField(exist = false) - private String searchValue; - - /** - * 创建者 - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 创建时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** - * 更新者 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 更新时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** - * 备注 - */ - private String remark; - - /** - * 请求参数 - */ - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @TableField(exist = false) - private Map params; - - public String getSearchValue() { - return searchValue; - } - - public void setSearchValue(String searchValue) { - this.searchValue = searchValue; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public Map getParams() { - if (params == null) { - params = new HashMap<>(); - } - return params; - } - - public void setParams(Map params) { - this.params = params; - } -} diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Category.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Category.java deleted file mode 100644 index 3ccde10..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Category.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - *//* - - -package com.tashow.cloud.product.domain; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -*/ -/** - * @author lanhai - *//* - -@Data -@TableName("tz_category") -public class Category implements Serializable { - - */ -/** - * 类目ID - *//* - - private Long categoryId; - - */ -/** - * 店铺ID - *//* - - private Long shopId; - - */ -/** - * 父节点 - *//* - - private Long parentId; - - */ -/** - * 产品类目名称 - *//* - - private String categoryName; - - */ -/** - * 类目图标 - *//* - - private String icon; - - */ -/** - * 类目的显示图片 - *//* - - private String pic; - - */ -/** - * 类目描述 - *//* - - private String describe; - - */ -/** - * 标签 - *//* - - private String tag; - - */ -/** - * 排序 - *//* - - private Integer seq; - - */ -/** - * 默认是1,表示正常状态,0为下线状态 - *//* - - private Integer status; - - */ -/** - * 创建时间 - *//* - - private Date createTime; - - */ -/** - * 创建时间 - *//* - - private String creator; - - */ -/** - * 分类层级 - *//* - - private Integer grade; - - */ -/** - * 更新时间 - *//* - - private Date updateTime; - - */ -/** - * 修改人 - *//* - - private String updater; - - private static final long serialVersionUID = 1L; - - -} -*/ diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Prod.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Prod.java deleted file mode 100644 index 4938e2b..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/Prod.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.tashow.cloud.product.domain; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.Data; -/** - * 商品对象 prod - * - * @author ruoyi - * @date 2025-07-25 - */ - -@Data -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Prod extends BaseEntity { -private static final long serialVersionUID=1L; - - - /** - * 产品ID - */ - @ApiModelProperty(value = "产品ID", position = 0) - private Long prodId; - - - /** - * 商品名称 - */ - @ApiModelProperty(value = "商品名称", position = 1) - private String prodName; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "商品简称", position = 2) - private String abbreviation; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "seo标题", position = 3) - private String seoName; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "seo搜索", position = 4) - private String seoSearch; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "关键词", position = 5) - private String keyword; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "店铺id", position = 6) - private Long shopId; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "简要描述,卖点等", position = 7) - private String brief; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "品牌", position = 8) - private String brand; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "详细描述", position = 9) - private String content; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "商品编号", position = 10) - private String prodNumber; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "商品主图", position = 11) - private String pic; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "商品轮播图片,以,分割", position = 12) - private String imgs; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "默认是1,表示正常状态, -1表示删除, 0下架", position = 13) - private Long status; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "商品分类", position = 14) - private Long categoryId; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "销量", position = 15) - private Long soldNum; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "分享图", position = 16) - private String shareImage; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "分享话术", position = 17) - private String shareContent; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否开启区域0关1开", position = 18) - private Integer regionSwitch; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否特殊时段0关1开", position = 19) - private Integer additionalSwitch; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否特殊日期(节假日周末什么的)0关1开", position = 20) - private Integer additionalFeeSwitch; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否紧急响应服务0关1开", position = 21) - private Integer emergencySwitch; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否预约0关1开", position = 22) - private Integer reservationSwitch; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否接单上线0关1开", position = 23) - private Integer orderLimitSwitch; - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "是否开启体重配置0关1开", position = 24) - private Integer weightSwitch; - - - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "版本 乐观锁", position = 29) - private Long version; - - /** - * 展示的权重 - */ - @ApiModelProperty(value = "展示的权重", position = 30) - private Long top; - -} diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseCode.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseCode.java deleted file mode 100644 index 7252f6f..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseCode.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - */ -package com.tashow.cloud.product.domain; - -/** - * @author lanhai - */ -public interface ResponseCode { - - int SUCCESS = 1; - int FAIL = -1; -} diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseEnum.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseEnum.java deleted file mode 100644 index 0101340..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ResponseEnum.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - */ -package com.tashow.cloud.product.domain; - -/** - * @author FrozenWatermelon - * @date 2020/7/9 - */ -public enum ResponseEnum { - - /** - * ok - */ - OK("00000", "ok"), - SHOW_FAIL("A00001", "cw"), - - /** - * 用于直接显示提示用户的错误,内容由输入内容决定 - */ - - /** - * 用于直接显示提示系统的成功,内容由输入内容决定 - */ - SHOW_SUCCESS("A00002", ""), - - /** - * 未授权 - */ - UNAUTHORIZED("A00004", "Unauthorized"), - - /** - * 服务器出了点小差 - */ - EXCEPTION("A00005", "服务器出了点小差"), - /** - * 方法参数没有校验,内容由输入内容决定 - */ - METHOD_ARGUMENT_NOT_VALID("A00014", "方法参数没有校验"); - - private final String code; - - private final String msg; - - public String value() { - return code; - } - - public String getMsg() { - return msg; - } - - ResponseEnum(String code, String msg) { - this.code = code; - this.msg = msg; - } - - @Override - public String toString() { - return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + "} " + super.toString(); - } - -} diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ServerResponseEntity.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ServerResponseEntity.java deleted file mode 100644 index 0646c3f..0000000 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/domain/ServerResponseEntity.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - */ - -package com.tashow.cloud.product.domain; - -import lombok.extern.slf4j.Slf4j; - -import java.io.Serializable; -import java.util.Objects; - -/** - * @author lanhai - */ -@Slf4j -public class ServerResponseEntity implements Serializable { - - /** - * 状态码 - */ - private String code; - - /** - * 信息 - */ - private String msg; - - /** - * 数据 - */ - private T data; - - /** - * 版本 - */ - private String version; - - /** - * 时间 - */ - private Long timestamp; - - private String sign; - - public String getSign() { - return sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public T getData() { - return data; - } - - public ServerResponseEntity setData(T data) { - this.data = data; - return this; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public Long getTimestamp() { - return timestamp; - } - - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - - public boolean isSuccess() { - return Objects.equals(ResponseEnum.OK.value(), this.code); - } - public boolean isFail() { - return !Objects.equals(ResponseEnum.OK.value(), this.code); - } - - public ServerResponseEntity() { - // 版本号 - this.version = "mall4j.v230424"; - } - - public static ServerResponseEntity success(T data) { - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setData(data); - serverResponseEntity.setCode(ResponseEnum.OK.value()); - return serverResponseEntity; - } - - public static ServerResponseEntity success() { - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setCode(ResponseEnum.OK.value()); - serverResponseEntity.setMsg(ResponseEnum.OK.getMsg()); - return serverResponseEntity; - } - - public static ServerResponseEntity success(Integer code, T data) { - return success(String.valueOf(code), data); - } - - public static ServerResponseEntity success(String code, T data) { - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setCode(code); - serverResponseEntity.setData(data); - return serverResponseEntity; - } - - /** - * 前端显示失败消息 - * @param msg 失败消息 - * @return - */ - public static ServerResponseEntity showFailMsg(String msg) { - log.error(msg); - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setMsg(msg); - serverResponseEntity.setCode(ResponseEnum.SHOW_FAIL.value()); - return serverResponseEntity; - } - - public static ServerResponseEntity fail(ResponseEnum responseEnum) { - log.error(responseEnum.toString()); - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setMsg(responseEnum.getMsg()); - serverResponseEntity.setCode(responseEnum.value()); - return serverResponseEntity; - } - - public static ServerResponseEntity fail(ResponseEnum responseEnum, T data) { - log.error(responseEnum.toString()); - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setMsg(responseEnum.getMsg()); - serverResponseEntity.setCode(responseEnum.value()); - serverResponseEntity.setData(data); - return serverResponseEntity; - } - - public static ServerResponseEntity fail(String code, String msg, T data) { - log.error(msg); - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setMsg(msg); - serverResponseEntity.setCode(code); - serverResponseEntity.setData(data); - return serverResponseEntity; - } - - public static ServerResponseEntity fail(String code, String msg) { - return fail(code, msg, null); - } - - public static ServerResponseEntity fail(Integer code, T data) { - ServerResponseEntity serverResponseEntity = new ServerResponseEntity<>(); - serverResponseEntity.setCode(String.valueOf(code)); - serverResponseEntity.setData(data); - return serverResponseEntity; - } - - @Override - public String toString() { - return "ServerResponseEntity{" + - "code='" + code + '\'' + - ", msg='" + msg + '\'' + - ", data=" + data + - ", version='" + version + '\'' + - ", timestamp=" + timestamp + - ", sign='" + sign + '\'' + - '}'; - } -} diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/CategoryDO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/CategoryDO.java new file mode 100644 index 0000000..d73eeed --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/CategoryDO.java @@ -0,0 +1,71 @@ +package com.tashow.cloud.product.dto; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO; + +/** + * 产品类目 DO + * + * @author 芋道源码 + */ +@TableName("tz_category") +@KeySequence("tz_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CategoryDO extends BaseDO { + + /** + * 类目ID + */ + @TableId + private Long categoryId; + /** + * 店铺ID + */ + private Long shopId; + /** + * 父节点 + */ + private Long parentId; + /** + * 产品类目名称 + */ + private String categoryName; + /** + * 类目图标 + */ + private String icon; + /** + * 类目的显示图片 + */ + private String pic; + /** + * 类目描述 + */ + private String describe; + /** + * 标签 + */ + private String tag; + /** + * 排序 + */ + private Integer seq; + /** + * 默认是1,表示正常状态,0为下线状态 + */ + private Integer status; + /** + * 分类层级 + */ + private Integer grade; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/ProdAdditionalFeeDatesDO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/ProdAdditionalFeeDatesDO.java new file mode 100644 index 0000000..5013996 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/dto/ProdAdditionalFeeDatesDO.java @@ -0,0 +1,72 @@ +package com.tashow.cloud.product.dto; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO; + +/** + * 特殊日期附加费用规则 DO + * + * @author 芋道源码 + */ +@TableName("tz_prod_additional_fee_dates") +@KeySequence("tz_prod_additional_fee_dates_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProdAdditionalFeeDatesDO extends BaseDO { + + /** + * 特殊日期规则的唯一标识符 + */ + @TableId + private Long id; + /** + * 商品id + */ + private Long prodId; + /** + * 名称 + */ + private String name; + /** + * 日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日' + */ + private Boolean dateType; + /** + * 自定义日期时间段(JSON格式存储) + */ + private String customTimeSlots; + /** + * 指定日期(JSON格式存储) + */ + private String specificDates; + /** + * 收费方式 + */ + private String chargeMode; + /** + * 价格或上浮百分比 + */ + private BigDecimal price; + /** + * 是否启用该规则 + */ + private Boolean isEnabled; + /** + * 创建时间 + */ + private LocalDateTime createdAt; + /** + * 更新时间 + */ + private LocalDateTime updatedAt; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/CategoryMapper.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/CategoryMapper.java index 81239f8..290dda0 100644 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/CategoryMapper.java +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/CategoryMapper.java @@ -1,46 +1,21 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - *//* - - package com.tashow.cloud.product.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.tashow.cloud.product.domain.Category; +import java.util.*; -import java.util.List; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX; +import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX; +import com.tashow.cloud.product.dto.CategoryDO; +import org.apache.ibatis.annotations.Mapper; -*/ /** - * @author lanhai - *//* - -public interface CategoryMapper extends BaseMapper { - - */ -/** - * 根据父级id获取分类列表 - * - * @param parentId - * @return - *//* - - List listByParentId(Long parentId); + * 产品类目 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface CategoryMapper extends BaseMapperX { - */ -/** - * 根据店铺id获取分类列表 - * - * @param shopId - * @return - *//* - List tableCategory(Long shopId); -}*/ +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/ProdAdditionalFeeDatesMapper.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/ProdAdditionalFeeDatesMapper.java new file mode 100644 index 0000000..515e425 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/mapper/ProdAdditionalFeeDatesMapper.java @@ -0,0 +1,20 @@ +package com.tashow.cloud.product.mapper; + +import java.util.*; + +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX; +import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX; +import com.tashow.cloud.product.dto.ProdAdditionalFeeDatesDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 特殊日期附加费用规则 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProdAdditionalFeeDatesMapper extends BaseMapperX { + + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/CategoryService.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/CategoryService.java index 9d72680..d0fa5a3 100644 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/CategoryService.java +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/CategoryService.java @@ -1,71 +1,57 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - *//* - - package com.tashow.cloud.product.service; -import com.baomidou.mybatisplus.extension.service.IService; -import com.tashow.cloud.product.domain.Category; +import java.util.*; -import java.util.List; +import com.tashow.cloud.product.dto.CategoryDO; +import com.tashow.cloud.product.vo.category.CategoryPageReqVO; +import com.tashow.cloud.product.vo.category.CategorySaveReqVO; +import jakarta.validation.*; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.PageParam; -*/ /** - * @author lanhai - * 商品分类 - *//* + * 产品类目 Service 接口 + * + * @author 芋道源码 + */ +public interface CategoryService { -public interface CategoryService extends IService { + /** + * 创建产品类目 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createCategory(@Valid CategorySaveReqVO createReqVO); - */ -/** - * 根据parentId获取分类 - * @param parentId 0 一级分类 - * @return - *//* + /** + * 更新产品类目 + * + * @param updateReqVO 更新信息 + */ + void updateCategory(@Valid CategorySaveReqVO updateReqVO); - List listByParentId(Long parentId); + /** + * 删除产品类目 + * + * @param id 编号 + */ + void deleteCategory(Long id); + /** + * 获得产品类目 + * + * @param id 编号 + * @return 产品类目 + */ + CategoryDO getCategory(Long id); - */ -/** - * 获取用于页面表单展现的category列表,根据seq排序 - * @param shopId 店铺id - * @return - *//* + /** + * 获得产品类目分页 + * + * @param pageReqVO 分页查询 + * @return 产品类目分页 + */ + PageResult getCategoryPage(CategoryPageReqVO pageReqVO); - List tableCategory(Long shopId); - - */ -/** - * 保存分类、品牌、参数 - * @param category - *//* - - void saveCategory(Category category); - - */ -/** - * 修改分类、品牌、参数 - * @param category - *//* - - void updateCategory(Category category); - - */ -/** - * 删除分类、品牌、参数 以及分类对应的图片 - * @param categoryId 分类id - *//* - - void deleteCategory(Long categoryId); - -} -*/ +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/ProdAdditionalFeeDatesService.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/ProdAdditionalFeeDatesService.java new file mode 100644 index 0000000..b4f15ce --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/ProdAdditionalFeeDatesService.java @@ -0,0 +1,57 @@ +package com.tashow.cloud.product.service; + +import java.util.*; + +import com.tashow.cloud.product.dto.ProdAdditionalFeeDatesDO; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesPageReqVO; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesSaveReqVO; +import jakarta.validation.*; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.PageParam; + +/** + * 特殊日期附加费用规则 Service 接口 + * + * @author 芋道源码 + */ +public interface ProdAdditionalFeeDatesService { + + /** + * 创建特殊日期附加费用规则 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProdAdditionalFeeDates(@Valid ProdAdditionalFeeDatesSaveReqVO createReqVO); + + /** + * 更新特殊日期附加费用规则 + * + * @param updateReqVO 更新信息 + */ + void updateProdAdditionalFeeDates(@Valid ProdAdditionalFeeDatesSaveReqVO updateReqVO); + + /** + * 删除特殊日期附加费用规则 + * + * @param id 编号 + */ + void deleteProdAdditionalFeeDates(Long id); + + /** + * 获得特殊日期附加费用规则 + * + * @param id 编号 + * @return 特殊日期附加费用规则 + */ + ProdAdditionalFeeDatesDO getProdAdditionalFeeDates(Long id); + + /** + * 获得特殊日期附加费用规则分页 + * + * @param pageReqVO 分页查询 + * @return 特殊日期附加费用规则分页 + */ + PageResult getProdAdditionalFeeDatesPage(ProdAdditionalFeeDatesPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/CategoryServiceImpl.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/CategoryServiceImpl.java index 0ac5676..2214cb4 100644 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/CategoryServiceImpl.java +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/CategoryServiceImpl.java @@ -1,79 +1,78 @@ -/* - * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. - * - * https://www.mall4j.com/ - * - * 未经允许,不可做商业用途! - * - * 版权所有,侵权必究! - *//* - - package com.tashow.cloud.product.service.impl; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.google.common.collect.Lists; -import com.tashow.cloud.product.domain.Category; +import com.tashow.cloud.common.exception.ErrorCode; +import com.tashow.cloud.product.dto.CategoryDO; import com.tashow.cloud.product.mapper.CategoryMapper; import com.tashow.cloud.product.service.CategoryService; -import org.springframework.beans.factory.annotation.Autowired; +import com.tashow.cloud.product.vo.category.CategoryPageReqVO; +import com.tashow.cloud.product.vo.category.CategorySaveReqVO; +import com.tashow.cloud.productapi.enums.ErrorCodeConstants; import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import java.util.*; + +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.PageParam; +import com.tashow.cloud.common.util.object.BeanUtils; + + +import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception; -*/ /** - * @author lanhai - *//* - + * 产品类目 Service 实现类 + * + * @author 芋道源码 + */ @Service -public class CategoryServiceImpl extends ServiceImpl implements CategoryService { +@Validated +public class CategoryServiceImpl implements CategoryService { - @Autowired - private CategoryMapper categoryMapper; + @Resource + private CategoryMapper categoryMapper; - @Override - public List listByParentId(Long parentId) { - return categoryMapper.listByParentId(parentId); - } + @Override + public Long createCategory(CategorySaveReqVO createReqVO) { + // 插入 + CategoryDO category = BeanUtils.toBean(createReqVO, CategoryDO.class); + categoryMapper.insert(category); + // 返回 + return category.getCategoryId(); + } - @Override - public List tableCategory(Long shopId) { - return categoryMapper.tableCategory(shopId); - } + @Override + public void updateCategory(CategorySaveReqVO updateReqVO) { + // 校验存在 + validateCategoryExists(updateReqVO.getCategoryId()); + // 更新 + CategoryDO updateObj = BeanUtils.toBean(updateReqVO, CategoryDO.class); + categoryMapper.updateById(updateObj); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void saveCategory(Category category) { - category.setCreateTime(new Date()); - // 保存分类信息 - categoryMapper.insert(category); - } + @Override + public void deleteCategory(Long id) { + // 校验存在 + validateCategoryExists(id); + // 删除 + categoryMapper.deleteById(id); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void updateCategory(Category category) { - Category dbCategory = categoryMapper.selectById(category.getCategoryId()); - category.setUpdateTime(new Date()); - // 保存分类信息 - categoryMapper.updateById(category); - } + private void validateCategoryExists(Long id) { + if (categoryMapper.selectById(id) == null) { + throw exception(ErrorCodeConstants.CATEGORY_NOT_EXISTS); + } + } - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteCategory(Long categoryId) { - Category category = categoryMapper.selectById(categoryId); - categoryMapper.deleteById(categoryId); - } + @Override + public CategoryDO getCategory(Long id) { + return categoryMapper.selectById(id); + } + @Override + public PageResult getCategoryPage(CategoryPageReqVO pageReqVO) { + return null; + } - -} -*/ +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdAdditionalFeeDatesServiceImpl.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdAdditionalFeeDatesServiceImpl.java new file mode 100644 index 0000000..48675c4 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdAdditionalFeeDatesServiceImpl.java @@ -0,0 +1,76 @@ +package com.tashow.cloud.product.service.impl; + +import com.tashow.cloud.product.dto.ProdAdditionalFeeDatesDO; +import com.tashow.cloud.product.mapper.ProdAdditionalFeeDatesMapper; +import com.tashow.cloud.product.service.ProdAdditionalFeeDatesService; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesPageReqVO; +import com.tashow.cloud.product.vo.prodadditionalfeedates.ProdAdditionalFeeDatesSaveReqVO; +import com.tashow.cloud.productapi.enums.ErrorCodeConstants; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.tashow.cloud.common.pojo.PageResult; +import com.tashow.cloud.common.pojo.PageParam; +import com.tashow.cloud.common.util.object.BeanUtils; + + +import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 特殊日期附加费用规则 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ProdAdditionalFeeDatesServiceImpl implements ProdAdditionalFeeDatesService { + + @Resource + private ProdAdditionalFeeDatesMapper prodAdditionalFeeDatesMapper; + + @Override + public Long createProdAdditionalFeeDates(ProdAdditionalFeeDatesSaveReqVO createReqVO) { + // 插入 + ProdAdditionalFeeDatesDO prodAdditionalFeeDates = BeanUtils.toBean(createReqVO, ProdAdditionalFeeDatesDO.class); + prodAdditionalFeeDatesMapper.insert(prodAdditionalFeeDates); + // 返回 + return prodAdditionalFeeDates.getId(); + } + + @Override + public void updateProdAdditionalFeeDates(ProdAdditionalFeeDatesSaveReqVO updateReqVO) { + // 校验存在 + validateProdAdditionalFeeDatesExists(updateReqVO.getId()); + // 更新 + ProdAdditionalFeeDatesDO updateObj = BeanUtils.toBean(updateReqVO, ProdAdditionalFeeDatesDO.class); + prodAdditionalFeeDatesMapper.updateById(updateObj); + } + + @Override + public void deleteProdAdditionalFeeDates(Long id) { + // 校验存在 + validateProdAdditionalFeeDatesExists(id); + // 删除 + prodAdditionalFeeDatesMapper.deleteById(id); + } + + private void validateProdAdditionalFeeDatesExists(Long id) { + if (prodAdditionalFeeDatesMapper.selectById(id) == null) { + throw exception(ErrorCodeConstants.PROD_ADDITIONAL_FEE_DATES_NOT_EXISTS); + } + } + + @Override + public ProdAdditionalFeeDatesDO getProdAdditionalFeeDates(Long id) { + return prodAdditionalFeeDatesMapper.selectById(id); + } + + @Override + public PageResult getProdAdditionalFeeDatesPage(ProdAdditionalFeeDatesPageReqVO pageReqVO) { + return null; + } + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdServiceImpl.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdServiceImpl.java index 3bf0996..0f90d48 100644 --- a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdServiceImpl.java +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/service/impl/ProdServiceImpl.java @@ -74,7 +74,6 @@ public class ProdServiceImpl implements ProdService { @Override public PageResult getProdPage(ProdPageReqVO pageReqVO) { IPage prodPageList = prodMapper.getProdPageList(MyBatisUtils.buildPage(pageReqVO), pageReqVO); - return new PageResult<>(prodPageList.getRecords(),prodPageList.getTotal()); } diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryPageReqVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryPageReqVO.java new file mode 100644 index 0000000..77fe7d6 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryPageReqVO.java @@ -0,0 +1,52 @@ +package com.tashow.cloud.product.vo.category; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.tashow.cloud.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 产品类目分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CategoryPageReqVO extends PageParam { + + @Schema(description = "店铺ID", example = "22369") + private Long shopId; + + @Schema(description = "父节点", example = "16509") + private Long parentId; + + @Schema(description = "产品类目名称", example = "王五") + private String categoryName; + + @Schema(description = "类目图标") + private String icon; + + @Schema(description = "类目的显示图片") + private String pic; + + @Schema(description = "类目描述") + private String describe; + + @Schema(description = "标签") + private String tag; + + @Schema(description = "排序") + private Integer seq; + + @Schema(description = "默认是1,表示正常状态,0为下线状态", example = "1") + private Integer status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "分类层级") + private Integer grade; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryRespVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryRespVO.java new file mode 100644 index 0000000..57090dd --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategoryRespVO.java @@ -0,0 +1,63 @@ +package com.tashow.cloud.product.vo.category; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 产品类目 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CategoryRespVO { + + @Schema(description = "类目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15856") + @ExcelProperty("类目ID") + private Long categoryId; + + @Schema(description = "店铺ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22369") + @ExcelProperty("店铺ID") + private Long shopId; + + @Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509") + @ExcelProperty("父节点") + private Long parentId; + + @Schema(description = "产品类目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("产品类目名称") + private String categoryName; + + @Schema(description = "类目图标") + @ExcelProperty("类目图标") + private String icon; + + @Schema(description = "类目的显示图片") + @ExcelProperty("类目的显示图片") + private String pic; + + @Schema(description = "类目描述") + @ExcelProperty("类目描述") + private String describe; + + @Schema(description = "标签") + @ExcelProperty("标签") + private String tag; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("排序") + private Integer seq; + + @Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("默认是1,表示正常状态,0为下线状态") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "分类层级", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("分类层级") + private Integer grade; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategorySaveReqVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategorySaveReqVO.java new file mode 100644 index 0000000..a368797 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/category/CategorySaveReqVO.java @@ -0,0 +1,51 @@ +package com.tashow.cloud.product.vo.category; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; + +@Schema(description = "管理后台 - 产品类目新增/修改 Request VO") +@Data +public class CategorySaveReqVO { + + @Schema(description = "类目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15856") + 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") + @NotNull(message = "父节点不能为空") + private Long parentId; + + @Schema(description = "产品类目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "产品类目名称不能为空") + private String categoryName; + + @Schema(description = "类目图标") + private String icon; + + @Schema(description = "类目的显示图片") + private String pic; + + @Schema(description = "类目描述") + private String describe; + + @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) + @NotNull(message = "分类层级不能为空") + private Integer grade; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesPageReqVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesPageReqVO.java new file mode 100644 index 0000000..1d194da --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesPageReqVO.java @@ -0,0 +1,49 @@ +package com.tashow.cloud.product.vo.prodadditionalfeedates; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.tashow.cloud.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 特殊日期附加费用规则分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ProdAdditionalFeeDatesPageReqVO extends PageParam { + + @Schema(description = "商品id", example = "24324") + private Long prodId; + + @Schema(description = "名称", example = "赵六") + private String name; + + @Schema(description = "日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'", example = "2") + private Boolean dateType; + + @Schema(description = "自定义日期时间段(JSON格式存储)") + private String customTimeSlots; + + @Schema(description = "指定日期(JSON格式存储)") + private String specificDates; + + @Schema(description = "收费方式") + private String chargeMode; + + @Schema(description = "价格或上浮百分比", example = "17305") + private BigDecimal price; + + @Schema(description = "是否启用该规则") + private Boolean isEnabled; + + @Schema(description = "创建时间") + private LocalDateTime createdAt; + + @Schema(description = "更新时间") + private LocalDateTime updatedAt; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesRespVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesRespVO.java new file mode 100644 index 0000000..8618abc --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesRespVO.java @@ -0,0 +1,60 @@ +package com.tashow.cloud.product.vo.prodadditionalfeedates; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 特殊日期附加费用规则 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ProdAdditionalFeeDatesRespVO { + + @Schema(description = "特殊日期规则的唯一标识符", requiredMode = Schema.RequiredMode.REQUIRED, example = "1445") + @ExcelProperty("特殊日期规则的唯一标识符") + private Long id; + + @Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24324") + @ExcelProperty("商品id") + private Long prodId; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @ExcelProperty("名称") + private String name; + + @Schema(description = "日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'") + private Boolean dateType; + + @Schema(description = "自定义日期时间段(JSON格式存储)") + @ExcelProperty("自定义日期时间段(JSON格式存储)") + private String customTimeSlots; + + @Schema(description = "指定日期(JSON格式存储)") + @ExcelProperty("指定日期(JSON格式存储)") + private String specificDates; + + @Schema(description = "收费方式", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("收费方式") + private String chargeMode; + + @Schema(description = "价格或上浮百分比", example = "17305") + @ExcelProperty("价格或上浮百分比") + private BigDecimal price; + + @Schema(description = "是否启用该规则", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否启用该规则") + private Boolean isEnabled; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createdAt; + + @Schema(description = "更新时间") + @ExcelProperty("更新时间") + private LocalDateTime updatedAt; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesSaveReqVO.java b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesSaveReqVO.java new file mode 100644 index 0000000..98e04f6 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/java/com/tashow/cloud/product/vo/prodadditionalfeedates/ProdAdditionalFeeDatesSaveReqVO.java @@ -0,0 +1,53 @@ +package com.tashow.cloud.product.vo.prodadditionalfeedates; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 特殊日期附加费用规则新增/修改 Request VO") +@Data +public class ProdAdditionalFeeDatesSaveReqVO { + + @Schema(description = "特殊日期规则的唯一标识符", requiredMode = Schema.RequiredMode.REQUIRED, example = "1445") + private Long id; + + @Schema(description = "商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24324") + @NotNull(message = "商品id不能为空") + private Long prodId; + + @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "名称不能为空") + private String name; + + @Schema(description = "日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'不能为空") + private Boolean dateType; + + @Schema(description = "自定义日期时间段(JSON格式存储)") + private String customTimeSlots; + + @Schema(description = "指定日期(JSON格式存储)") + private String specificDates; + + @Schema(description = "收费方式", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "收费方式不能为空") + private String chargeMode; + + @Schema(description = "价格或上浮百分比", example = "17305") + private BigDecimal price; + + @Schema(description = "是否启用该规则", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否启用该规则不能为空") + private Boolean isEnabled; + + @Schema(description = "创建时间") + private LocalDateTime createdAt; + + @Schema(description = "更新时间") + private LocalDateTime updatedAt; + +} \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/resources/logback-spring.xml b/tashow-module/tashow-module-product/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..16f0c0f --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/resources/logback-spring.xml @@ -0,0 +1,76 @@ + + + + + + + + + +       + + + ${PATTERN_DEFAULT} + + + + + + + + + + ${PATTERN_DEFAULT} + + + + ${LOG_FILE} + + + ${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz} + + ${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false} + + ${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB} + + ${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0} + + ${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30} + + + + + + 0 + + 256 + + + + + + + + ${PATTERN_DEFAULT} + + + + + + + + + + + + + + + + + + + + + + diff --git a/tashow-module/tashow-module-product/src/main/resources/mapper/product/CategoryMapper.xml b/tashow-module/tashow-module-product/src/main/resources/mapper/product/CategoryMapper.xml new file mode 100644 index 0000000..8be73bc --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/resources/mapper/product/CategoryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/tashow-module/tashow-module-product/src/main/resources/mapper/product/ProdAdditionalFeeDatesMapper.xml b/tashow-module/tashow-module-product/src/main/resources/mapper/product/ProdAdditionalFeeDatesMapper.xml new file mode 100644 index 0000000..49e31a2 --- /dev/null +++ b/tashow-module/tashow-module-product/src/main/resources/mapper/product/ProdAdditionalFeeDatesMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file