diff --git a/doc/团购添加数据结构.json b/doc/团购添加数据结构.json new file mode 100644 index 0000000..548928d --- /dev/null +++ b/doc/团购添加数据结构.json @@ -0,0 +1,22 @@ +{ + "商品ID": "Long", + "商品图片": "String", + "活动名称": "String", + "活动简介": "String", + "商品单位": "String", + "商品的轮播图": [ + "String", "String" + ], + "活动时间": "date", + "策略类型": "String", + "策略ID": "Long", + "商品规格List": [ + { + "规格SKU": "String", + "拼团价格": "BigDecimal", + "拼团库存": "Long" + } + ], + "排序": "Integer", + "详情": "String" +} \ No newline at end of file diff --git a/muyu-auth/src/main/resources/bootstrap.yml b/muyu-auth/src/main/resources/bootstrap.yml index 5b8ee27..b309a3d 100644 --- a/muyu-auth/src/main/resources/bootstrap.yml +++ b/muyu-auth/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/enums/market/team/TeamOpenTypeEnum.java b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/enums/market/team/TeamOpenTypeEnum.java new file mode 100644 index 0000000..c0e55e4 --- /dev/null +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/enums/market/team/TeamOpenTypeEnum.java @@ -0,0 +1,33 @@ +package com.muyu.common.core.enums.market.team; + + +/** + * 参团类型枚举类 + * + * @author DongZeLiang + * @date 2024-11-21 11:20 + */ +public enum TeamOpenTypeEnum { + // 开团 + OPEN_TEAM("open_team", "开团"), + // 参团 + IN_TEAM("in_team", "参团") + ; + + private final String code; + + private final String label; + + TeamOpenTypeEnum(String code, String label) { + this.code = code; + this.label = label; + } + + public String code() { + return code; + } + + public String label() { + return label; + } +} diff --git a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/model/QueryModel.java b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/model/QueryModel.java new file mode 100644 index 0000000..0b5588f --- /dev/null +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/model/QueryModel.java @@ -0,0 +1,69 @@ +package com.muyu.common.core.web.model; + + +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.muyu.common.core.web.page.PageDomain; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.util.List; + +/** + * 列表查询模型 + * + * @author DongZeLiang + * @date 2024-11-20 14:18 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +public class QueryModel { + + /** + * 当前记录起始索引 + */ + private Integer pageNum; + + /** + * 每页显示记录数 + */ + private Integer pageSize; + + /** + * 排序列 + */ + private String orderByColumn; + + /** + * 排序的方向desc或者asc + */ + private boolean isAsc = true; + + /** + * 构建模型分页对象 + * @param pageDomain 分页参数 + * @return 模型分页对象 + */ + public T domainBuild(PageDomain pageDomain) { + this.pageNum = pageDomain.getPageNum(); + this.pageSize = pageDomain.getPageSize(); + this.orderByColumn = pageDomain.getOrderByColumn(); + this.isAsc = "asc".equals(pageDomain.getIsAsc()); + return (T) this; + } + + /** + * 构建查询分页对象 + * @return 查询分页对象 + */ + public Page buildPage(){ + Page page = Page.of(this.getPageNum(), this.getPageSize()); + page.setOrders(List.of(this.isAsc() + ? OrderItem.asc(this.getOrderByColumn()) : OrderItem.desc(this.getOrderByColumn()))); + return page; + } +} diff --git a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/page/PageDomain.java b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/page/PageDomain.java index b9c5e45..e9fb4c0 100644 --- a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/page/PageDomain.java +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/page/PageDomain.java @@ -1,12 +1,20 @@ package com.muyu.common.core.web.page; import com.muyu.common.core.utils.StringUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; /** * 分页数据 * * @author muyu */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor public class PageDomain { /** * 当前记录起始索引 @@ -40,33 +48,6 @@ public class PageDomain { return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; } - public Integer getPageNum () { - return pageNum; - } - - public void setPageNum (Integer pageNum) { - this.pageNum = pageNum; - } - - public Integer getPageSize () { - return pageSize; - } - - public void setPageSize (Integer pageSize) { - this.pageSize = pageSize; - } - - public String getOrderByColumn () { - return orderByColumn; - } - - public void setOrderByColumn (String orderByColumn) { - this.orderByColumn = orderByColumn; - } - - public String getIsAsc () { - return isAsc; - } public void setIsAsc (String isAsc) { if (StringUtils.isNotEmpty(isAsc)) { @@ -87,7 +68,4 @@ public class PageDomain { return reasonable; } - public void setReasonable (Boolean reasonable) { - this.reasonable = reasonable; - } } diff --git a/muyu-common/muyu-common-security/src/main/java/com/muyu/common/security/config/mybatisplus/MybatisPlusConfig.java b/muyu-common/muyu-common-security/src/main/java/com/muyu/common/security/config/mybatisplus/MybatisPlusConfig.java new file mode 100644 index 0000000..a3f2e7e --- /dev/null +++ b/muyu-common/muyu-common-security/src/main/java/com/muyu/common/security/config/mybatisplus/MybatisPlusConfig.java @@ -0,0 +1,22 @@ +package com.muyu.common.security.config.mybatisplus; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class MybatisPlusConfig { + + /** + * 添加分页插件 + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加 + // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType + return interceptor; + } +} \ No newline at end of file diff --git a/muyu-gateway/src/main/resources/bootstrap.yml b/muyu-gateway/src/main/resources/bootstrap.yml index 69d9562..d7367b4 100644 --- a/muyu-gateway/src/main/resources/bootstrap.yml +++ b/muyu-gateway/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-file/src/main/resources/bootstrap.yml b/muyu-modules/muyu-file/src/main/resources/bootstrap.yml index 2d4a565..0cb85bd 100644 --- a/muyu-modules/muyu-file/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-file/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-gen/src/main/resources/bootstrap.yml b/muyu-modules/muyu-gen/src/main/resources/bootstrap.yml index 3e43194..b628931 100644 --- a/muyu-modules/muyu-gen/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-gen/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-job/src/main/resources/bootstrap.yml b/muyu-modules/muyu-job/src/main/resources/bootstrap.yml index 0e97536..618f3e8 100644 --- a/muyu-modules/muyu-job/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-job/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-marketing/marketing-common/pom.xml b/muyu-modules/muyu-marketing/marketing-common/pom.xml new file mode 100644 index 0000000..01af246 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + com.muyu + muyu-marketing + 3.6.3 + + + marketing-common + + + 17 + 17 + UTF-8 + + + + + + + com.muyu + muyu-common-core + + + + \ No newline at end of file diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamInfo.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamInfo.java new file mode 100644 index 0000000..8b4eaf5 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamInfo.java @@ -0,0 +1,73 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.util.Date; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "activity_team_info", autoResultMap = true) +public class ActivityTeamInfo extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 拼团名称 + */ + private String name; + /** + * 商品ID + */ + private long productId; + /** + * 商品活动图 + */ + private String productImage; + /** + * 活动简介 + */ + private String introduction; + /** + * 单位 + */ + private String unit; + /** + * 轮播图 + */ + private String imageList; + /** + * 活动结束时间 + */ + private Date endTime; + /** + * 活动排序 + */ + private long sort; + /** + * 活动详情 + */ + private String content; + /** + * 活动状态 + */ + private String status; + /** + * 策略类型 + */ + private String strategyType; + /** + * 策略ID + */ + private long strategyId; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamOpenInfo.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamOpenInfo.java new file mode 100644 index 0000000..572299e --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamOpenInfo.java @@ -0,0 +1,69 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.util.Date; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "activity_team_open_info", autoResultMap = true) +public class ActivityTeamOpenInfo extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 团购活动ID + */ + private long teamId; + /** + * 团购类型 + */ + private String teamType; + /** + * 团购策略 + */ + private String teamStrategyId; + /** + * 参团类型 + */ + private String executiveType; + /** + * 结束团购时间 + */ + private Date endTime; + /** + * 商品ID + */ + private String productId; + /** + * 商品名称 + */ + private String productName; + /** + * 商品规格 + */ + private String productSku; + /** + * 开团标识 + */ + private String key; + /** + * 订单ID + */ + private String orderId; + /** + * 开团状态 + */ + private String status; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamProductSkuInfo.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamProductSkuInfo.java new file mode 100644 index 0000000..59605f2 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamProductSkuInfo.java @@ -0,0 +1,49 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "activity_team_product_sku_info", autoResultMap = true) +public class ActivityTeamProductSkuInfo extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 活动ID + */ + private long teamId; + /** + * 商品ID + */ + private Long productId; + /** + * 商品SKU + */ + private String productSku; + /** + * 拼团库存 + */ + private Long teamStock; + /** + * 剩余库存 + */ + private Long remainStock; + /** + * 拼团价格 + */ + private BigDecimal teamPrice; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemption.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemption.java new file mode 100644 index 0000000..4c4190f --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemption.java @@ -0,0 +1,55 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "team_strategy_exemption", autoResultMap = true) +public class TeamStrategyExemption extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 持续时间 + */ + private long duration; + /** + * 免单人数 + */ + private long exemptionNumber; + /** + * 最大购买量 + */ + private long maxBuy; + /** + * 单次购买量 + */ + private long oneBuy; + /** + * 虚拟人数 + */ + private long virtualNumber; + /** + * 面单类型 + */ + private String type; + /** + * 返款阶梯 + */ + private String ruleInfo; + /** + * 策略状态 + */ + private String status; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionHundred.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionHundred.java new file mode 100644 index 0000000..0225603 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionHundred.java @@ -0,0 +1,47 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true) +public class TeamStrategyExemptionHundred extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 持续时间 + */ + private long duration; + /** + * 最大购买量 + */ + private long maxBuy; + /** + * 单次购买量 + */ + private long oneBuy; + /** + * 虚拟人数 + */ + private long virtualNumber; + /** + * 策略状态 + */ + private String status; + /** + * 规则信息 + */ + private String ruleInfo; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionOrdinary.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionOrdinary.java new file mode 100644 index 0000000..796af1c --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionOrdinary.java @@ -0,0 +1,47 @@ +package com.muyu.marketing.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true) +public class TeamStrategyExemptionOrdinary extends BaseEntity { + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private long id; + /** + * 持续时间 + */ + private long duration; + /** + * 成团人数 + */ + private long teamNumber; + /** + * 最大购买量 + */ + private long maxBuy; + /** + * 单次购买量 + */ + private long oneBuy; + /** + * 虚拟人数 + */ + private long virtualNumber; + /** + * 策略状态 + */ + private String status; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListModel.java new file mode 100644 index 0000000..e38fadf --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListModel.java @@ -0,0 +1,99 @@ +package com.muyu.marketing.domain.model; + +import com.muyu.common.core.web.model.QueryModel; +import com.muyu.marketing.domain.ActivityTeamInfo; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.function.Consumer; +import java.util.function.Function; + +/** + * 团购活动雷彪查询结果模型 + * @author DongZeLiang + * @date 2024-11-20 14:18:10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ActivityTeamInfoListModel { + + /** + * 拼团活动ID + */ + private Long id; + /** + * 拼团名称 + */ + private String name; + /** + * 参团人数 + */ + private Long addTeamNumber; + /** + * 拼团人数 + */ + private Long attendNumber; + /** + * 团购结束时间 + */ + private Date endTime; + /** + * 开团人数 + */ + private Long openTeamNumber; + /** + * 拼团商品图片 + */ + private String productImage; + /** + * 商品价格 + */ + private BigDecimal productPrice; + /** + * 剩余库存 + */ + private Long remainStock; + /** + * 团购状态 + */ + private String status; + /** + * 拼团价格 + */ + private BigDecimal teamPrice; + /** + * 团购库存 + */ + private Long teamStock; + + + public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function function) { + ActivityTeamInfoListModel activityTeamInfoListModel = ActivityTeamInfoListModel.builder() + .id(activityTeamInfo.getId()) + .name(activityTeamInfo.getName()) +// .openTeamNumber(teamOpenTypeNumber) +// .addTeamNumber(teamInTypeNumber) +// .attendNumber(teamOpenTypeNumber + teamInTypeNumber) + .endTime(activityTeamInfo.getEndTime()) + .productImage(activityTeamInfo.getProductImage()) +// .teamPrice(discountPrice.getTeamPrice()) +// .productPrice(discountPrice.getProductPrice()) +// .teamStock(teamProductStockModel.getTeamStock()) +// .remainStock(teamProductStockModel.getRemainStock()) + .status(activityTeamInfo.getStatus()) + .build(); + return function.apply( + ActivityTeamInfoListModel.builder() + .id(activityTeamInfo.getId()) + .name(activityTeamInfo.getName()) + .endTime(activityTeamInfo.getEndTime()) + .productImage(activityTeamInfo.getProductImage()) + .status(activityTeamInfo.getStatus()) + ); + } + +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListQueryModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListQueryModel.java new file mode 100644 index 0000000..d1d0129 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListQueryModel.java @@ -0,0 +1,32 @@ +package com.muyu.marketing.domain.model; + +import com.muyu.common.core.web.model.QueryModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * 团购活动雷彪查询模型 + * @author DongZeLiang + * @date 2024-11-20 14:18:10 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class ActivityTeamInfoListQueryModel extends QueryModel { + + /** + * 搜索关键词 + */ + private String keyWord; + + /** + * 活动状态 + */ + private String status; + +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductDiscountPriceModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductDiscountPriceModel.java new file mode 100644 index 0000000..61f9d08 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductDiscountPriceModel.java @@ -0,0 +1,55 @@ +package com.muyu.marketing.domain.model; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 团购商品优惠力度模型 + * + * @author DongZeLiang + * @date 2024-11-21 11:57 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TeamProductDiscountPriceModel { + + /** + * 商品价格 + */ + private BigDecimal productPrice; + + /** + * 团购优惠价格 + */ + private BigDecimal teamPrice; + + + /** + * 优惠力度 (商品价格 - 团购优惠价格) / 商品价格 + */ + private double discount; + + /** + * 通过 商品价格和团购价格 生成优惠力度 + * @param productPrice 商品价格 + * @param teamPrice 团购加 + * @return 优惠力度 + */ + public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) { + TeamProductDiscountPriceModel.builder() + .productPrice(productPrice) + .teamPrice(teamPrice) + .discount( + productPrice.subtract(teamPrice).divide(productPrice, 2, RoundingMode.HALF_UP).doubleValue() + ) + .build(); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductStockModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductStockModel.java new file mode 100644 index 0000000..b8c9422 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductStockModel.java @@ -0,0 +1,31 @@ +package com.muyu.marketing.domain.model; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 团购商品库存模型 + * + * @author DongZeLiang + * @date 2024-11-21 14:04 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TeamProductStockModel { + + /** + * 拼团总库存 + */ + private Long teamStock; + + /** + * 拼团剩余库存 + */ + private Long remainStock; + +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/TeamInfoListReq.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/TeamInfoListReq.java new file mode 100644 index 0000000..fcfc308 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/TeamInfoListReq.java @@ -0,0 +1,36 @@ +package com.muyu.marketing.domain.req; + +import com.muyu.common.core.web.page.PageDomain; +import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel; +import lombok.*; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class TeamInfoListReq extends PageDomain { + + /** + * 搜索关键词 + */ + private String keyWord; + + /** + * 活动状态 + */ + private String status; + + + /** + * 通过当前对象构建业务查询模型 + * @return 业务查询模型 + */ + public ActivityTeamInfoListQueryModel buildQueryModel() { + return ActivityTeamInfoListQueryModel.builder() + .keyWord(this.keyWord) + .status(this.status) + .build() + .domainBuild(this); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoListResp.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoListResp.java new file mode 100644 index 0000000..f3e2219 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoListResp.java @@ -0,0 +1,90 @@ +package com.muyu.marketing.domain.resp; + +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.req.TeamInfoListReq; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TeamInfoListResp { + + /** + * 拼团活动ID + */ + private Long id; + /** + * 拼团名称 + */ + private String name; + /** + * 参团人数 + */ + private Long addTeamNumber; + /** + * 拼团人数 + */ + private Long attendNumber; + /** + * 团购结束时间 + */ + private Date endTime; + /** + * 开团人数 + */ + private Long openTeamNumber; + /** + * 拼团商品图片 + */ + private String productImage; + /** + * 商品价格 + */ + private BigDecimal productPrice; + /** + * 剩余库存 + */ + private Long remainStock; + /** + * 团购状态 + */ + private String status; + /** + * 拼团价格 + */ + private BigDecimal teamPrice; + /** + * 团购库存 + */ + private Long teamStock; + + /** + * 列表查询结果,构建为响应对象 + * @param activityTeamInfoListModel 列表数据查询结果 + * @return 响应对象 + */ + public static TeamInfoListResp listModelBuild(ActivityTeamInfoListModel activityTeamInfoListModel) { + return TeamInfoListResp.builder() + .id(activityTeamInfoListModel.getId()) + .name(activityTeamInfoListModel.getName()) + .openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber()) + .addTeamNumber(activityTeamInfoListModel.getAddTeamNumber()) + .addTeamNumber(activityTeamInfoListModel.getAddTeamNumber()) + .attendNumber(activityTeamInfoListModel.getAttendNumber()) + .endTime(activityTeamInfoListModel.getEndTime()) + .teamPrice(activityTeamInfoListModel.getTeamPrice()) + .productImage(activityTeamInfoListModel.getProductImage()) + .productPrice(activityTeamInfoListModel.getProductPrice()) + .remainStock(activityTeamInfoListModel.getRemainStock()) + .status(activityTeamInfoListModel.getStatus()) + .teamStock(activityTeamInfoListModel.getTeamStock()) + .build(); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-remote/pom.xml b/muyu-modules/muyu-marketing/marketing-remote/pom.xml new file mode 100644 index 0000000..df41e11 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-remote/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.muyu + muyu-marketing + 3.6.3 + + + marketing-remote + + + 17 + 17 + UTF-8 + + + + + com.muyu + marketing-common + + + \ No newline at end of file diff --git a/muyu-modules/muyu-marketing/marketing-server/pom.xml b/muyu-modules/muyu-marketing/marketing-server/pom.xml new file mode 100644 index 0000000..c886cbf --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + + com.muyu + muyu-marketing + 3.6.3 + + + marketing-server + + + 17 + 17 + UTF-8 + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + com.mysql + mysql-connector-j + + + + + com.muyu + muyu-common-datasource + + + + + com.muyu + muyu-common-datascope + + + + + com.muyu + muyu-common-log + + + + + com.muyu + muyu-common-swagger + + + + com.dtflys.forest + forest-spring-boot-starter + + + + + com.muyu + marketing-remote + + + + + com.muyu + muyu-product-cache + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + \ No newline at end of file diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/MuYuMarketIngApplication.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/MuYuMarketIngApplication.java new file mode 100644 index 0000000..de0a3db --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/MuYuMarketIngApplication.java @@ -0,0 +1,22 @@ +package com.muyu.marketing; + +import com.muyu.common.security.annotation.EnableCustomConfig; +import com.muyu.common.security.annotation.EnableMyFeignClients; +import com.muyu.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 系统模块 + * + * @author muyu + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableMyFeignClients +@SpringBootApplication +public class MuYuMarketIngApplication { + public static void main (String[] args) { + SpringApplication.run(MuYuMarketIngApplication.class, args); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/controller/ActivityTeamController.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/controller/ActivityTeamController.java new file mode 100644 index 0000000..4694815 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/controller/ActivityTeamController.java @@ -0,0 +1,47 @@ +package com.muyu.marketing.team.controller; + + +import com.muyu.common.core.domain.Result; +import com.muyu.common.core.web.page.TableDataInfo; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.req.TeamInfoListReq; +import com.muyu.marketing.domain.resp.TeamInfoListResp; +import com.muyu.marketing.team.service.ActivityTeamInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 营销团购活动控制层 + * + * @author DongZeLiang + * @date 2024-11-20 14:25 + */ +@RestController +@RequestMapping("/team") +public class ActivityTeamController { + + @Autowired + private ActivityTeamInfoService activityTeamInfoService;; + + /** + * 查询营销团购活动列表 + * @param teamInfoListReq 活动查询入参 + * @return 活动响应结果 + */ + @PostMapping("/list") + public Result> list(@RequestBody TeamInfoListReq teamInfoListReq) { + TableDataInfo tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel()); + List respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList(); + return Result.success( + new TableDataInfo<>(){{ + setRows(respList); + setTotal(tableDataInfo.getTotal()); + }} + ); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamInfoMapper.java new file mode 100644 index 0000000..0d3baa9 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamInfoMapper.java @@ -0,0 +1,12 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ActivityTeamInfoMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamOpenInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamOpenInfoMapper.java new file mode 100644 index 0000000..70311b1 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamOpenInfoMapper.java @@ -0,0 +1,10 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamOpenInfo; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ActivityTeamOpenInfoMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamProductSkuInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamProductSkuInfoMapper.java new file mode 100644 index 0000000..d83106e --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/ActivityTeamProductSkuInfoMapper.java @@ -0,0 +1,11 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamOpenInfo; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ActivityTeamProductSkuInfoMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionHundredMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionHundredMapper.java new file mode 100644 index 0000000..10c7b87 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionHundredMapper.java @@ -0,0 +1,11 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.TeamStrategyExemption; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TeamStrategyExemptionHundredMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionMapper.java new file mode 100644 index 0000000..66993b5 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionMapper.java @@ -0,0 +1,11 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import com.muyu.marketing.domain.TeamStrategyExemption; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TeamStrategyExemptionMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionOrdinaryMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionOrdinaryMapper.java new file mode 100644 index 0000000..b66e04b --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/mapper/TeamStrategyExemptionOrdinaryMapper.java @@ -0,0 +1,11 @@ +package com.muyu.marketing.team.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamInfoService.java new file mode 100644 index 0000000..5b717b8 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamInfoService.java @@ -0,0 +1,20 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.common.core.web.page.TableDataInfo; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel; + +import java.util.List; + +public interface ActivityTeamInfoService extends IService { + + + /** + * 通过查询模型查询团购活动列表 + * @param activityTeamInfoListQueryModel 团购活动查询模型 + * @return 团购活动列表 + */ + public TableDataInfo query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel); +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamOpenInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamOpenInfoService.java new file mode 100644 index 0000000..dcd70eb --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamOpenInfoService.java @@ -0,0 +1,35 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum; +import com.muyu.marketing.domain.ActivityTeamOpenInfo; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; + +public interface ActivityTeamOpenInfoService extends IService { + + /** + * 通过活动ID和开团类型查询开团数量 + * @param teamId 活动ID + * @param teamOpenType 开团类型 + * @return 开团数量 + */ + public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType); + + /** + * 根据活动ID获取开团数量 + * @param teamId 团购活动ID + * @return 开团数量 + */ + public default Long getTeamOpenTypeNumberByTeamId(Long teamId){ + return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM); + } + + /** + * 根据活动ID获取参团数量 + * @param teamId 团购活动ID + * @return 参团数量 + */ + public default Long getTeamInTypeNumberByTeamId(Long teamId){ + return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamProductSkuInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamProductSkuInfoService.java new file mode 100644 index 0000000..2ee5cf7 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/ActivityTeamProductSkuInfoService.java @@ -0,0 +1,36 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel; +import com.muyu.marketing.domain.model.TeamProductStockModel; + +import java.util.List; + +public interface ActivityTeamProductSkuInfoService extends IService { + + public default List getActivityTeamProductSkuInfoByTeamId(Long teamId){ + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId); + return this.list(lambdaQueryWrapper); + } + + + /** + * 通过团购活动ID获取团购中最优惠的价格 + * @param teamId 团购ID + * @return 优惠价格 + */ + public TeamProductDiscountPriceModel getDiscountPrice(Long teamId); + + + /** + * 通过活动ID获取 剩余库存 + * @param teamId 活动ID + * @return 库存 + */ + public TeamProductStockModel getStock(Long teamId); + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionHundredService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionHundredService.java new file mode 100644 index 0000000..e8f4444 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionHundredService.java @@ -0,0 +1,8 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary; + +public interface TeamStrategyExemptionHundredService extends IService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionOrdinaryService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionOrdinaryService.java new file mode 100644 index 0000000..307cf36 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionOrdinaryService.java @@ -0,0 +1,7 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary; + +public interface TeamStrategyExemptionOrdinaryService extends IService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionService.java new file mode 100644 index 0000000..2176bc8 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/TeamStrategyExemptionService.java @@ -0,0 +1,8 @@ +package com.muyu.marketing.team.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.TeamStrategyExemption; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; + +public interface TeamStrategyExemptionService extends IService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamInfoServiceImpl.java new file mode 100644 index 0000000..43b9e64 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamInfoServiceImpl.java @@ -0,0 +1,72 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.common.core.utils.StringUtils; +import com.muyu.common.core.web.page.TableDataInfo; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel; +import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel; +import com.muyu.marketing.domain.model.TeamProductStockModel; +import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper; +import com.muyu.marketing.team.service.ActivityTeamInfoService; +import com.muyu.marketing.team.service.ActivityTeamOpenInfoService; +import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + + +@Service +public class ActivityTeamInfoServiceImpl extends ServiceImpl + implements ActivityTeamInfoService { + + @Autowired + private ActivityTeamOpenInfoService activityTeamOpenInfoService; + + @Autowired + private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService; + + @Override + public TableDataInfo query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) { + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord()); + queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStatus()); + + /** + * Object -> 创建对象的时候进行的占用 + * Result 以方法返回值为占用 + */ + Page activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(), queryWrapper); + List activityTeamInfoList = activityTeamInfoPage.getRecords(); + List activityTeamInfoListModels = activityTeamInfoList.stream() + .map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo, + (activityTeamInfoListModelBuilder) -> { + TeamProductDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId()); + TeamProductStockModel teamProductStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId()); + Long teamOpenTypeNumber = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId()); + Long teamInTypeNumber = activityTeamOpenInfoService.getTeamInTypeNumberByTeamId(activityTeamInfo.getId()); + + return activityTeamInfoListModelBuilder + .openTeamNumber(teamOpenTypeNumber) + .addTeamNumber(teamInTypeNumber) + .attendNumber(teamOpenTypeNumber + teamInTypeNumber) + .teamPrice(discountPrice.getTeamPrice()) + .productPrice(discountPrice.getProductPrice()) + .teamStock(teamProductStockModel.getTeamStock()) + .remainStock(teamProductStockModel.getRemainStock()) + .build(); + })).toList(); + TableDataInfo tableDataInfo = new TableDataInfo<>(); + tableDataInfo.setTotal(activityTeamInfoPage.getTotal()); + tableDataInfo.setRows(activityTeamInfoListModels); + return tableDataInfo; + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamOpenInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamOpenInfoServiceImpl.java new file mode 100644 index 0000000..3117b74 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamOpenInfoServiceImpl.java @@ -0,0 +1,29 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum; +import com.muyu.marketing.domain.ActivityTeamOpenInfo; +import com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper; +import com.muyu.marketing.team.service.ActivityTeamOpenInfoService; +import org.springframework.stereotype.Service; + +@Service +public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl + implements ActivityTeamOpenInfoService { + + /** + * 通过活动ID和开团类型查询开团数量 + * + * @param teamId 活动ID + * @param teamOpenType 开团类型 + * @return 开团数量 + */ + @Override + public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActivityTeamOpenInfo::getTeamId, teamId); + queryWrapper.eq(ActivityTeamOpenInfo::getTeamType, teamOpenType.code()); + return this.count(queryWrapper); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamProductSkuInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamProductSkuInfoServiceImpl.java new file mode 100644 index 0000000..eee79de --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/ActivityTeamProductSkuInfoServiceImpl.java @@ -0,0 +1,67 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.common.core.exception.ServiceException; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel; +import com.muyu.marketing.domain.model.TeamProductStockModel; +import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper; +import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService; +import com.muyu.product.cache.ProjectSkuCache; +import com.muyu.product.domain.ProjectSkuInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Optional; + +@Service +public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl + implements ActivityTeamProductSkuInfoService { + + @Autowired + private ProjectSkuCache projectSkuCache; + + /** + * 通过团购活动ID获取团购中最优惠的价格 + * + * @param teamId 团购ID + * @return 优惠价格 + */ + @Override + public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) { + List teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId); + + // 优惠模型集合 + Optional discountPriceModelOptional = teamProductSkuInfoList.stream() + .map(activityTeamProductSkuInfo -> { + ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku()); + return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice()); + }).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue()); + + if (discountPriceModelOptional.isEmpty()){ + throw new ServiceException("团购活动下没有商品绑定"); + } + return discountPriceModelOptional.get(); + } + + /** + * 通过活动ID获取 剩余库存 + * + * @param teamId 活动ID + * @return 库存 + */ + @Override + public TeamProductStockModel getStock(Long teamId) { + List teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId); + return TeamProductStockModel.builder() + .teamStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L, Long::sum)) + .remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L, Long::sum)) + .build(); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionHundredServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionHundredServiceImpl.java new file mode 100644 index 0000000..0091d59 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionHundredServiceImpl.java @@ -0,0 +1,16 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.TeamStrategyExemption; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import com.muyu.marketing.team.mapper.TeamStrategyExemptionHundredMapper; +import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper; +import com.muyu.marketing.team.service.TeamStrategyExemptionHundredService; +import com.muyu.marketing.team.service.TeamStrategyExemptionService; +import org.springframework.stereotype.Service; + +@Service +public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl + implements TeamStrategyExemptionHundredService { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionOrdinaryServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionOrdinaryServiceImpl.java new file mode 100644 index 0000000..5125ec4 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionOrdinaryServiceImpl.java @@ -0,0 +1,13 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary; +import com.muyu.marketing.team.mapper.TeamStrategyExemptionOrdinaryMapper; +import com.muyu.marketing.team.service.TeamStrategyExemptionOrdinaryService; +import org.springframework.stereotype.Service; + +@Service +public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl + implements TeamStrategyExemptionOrdinaryService { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionServiceImpl.java new file mode 100644 index 0000000..829f618 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/team/service/impl/TeamStrategyExemptionServiceImpl.java @@ -0,0 +1,13 @@ +package com.muyu.marketing.team.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.TeamStrategyExemption; +import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper; +import com.muyu.marketing.team.service.TeamStrategyExemptionService; +import org.springframework.stereotype.Service; + +@Service +public class TeamStrategyExemptionServiceImpl extends ServiceImpl + implements TeamStrategyExemptionService { + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/resources/banner.txt b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/resources/bootstrap.yml b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..78b5a7b --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/bootstrap.yml @@ -0,0 +1,28 @@ +# Tomcat +server: + port: 9209 + +# Spring +spring: + application: + # 应用名称 + name: muyu-marketing + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +logging: + level: + com.muyu.marketing.mapper: DEBUG diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/resources/logback.xml b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/logback.xml new file mode 100644 index 0000000..aa340cd --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/logback.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/muyu-modules/muyu-marketing/pom.xml b/muyu-modules/muyu-marketing/pom.xml new file mode 100644 index 0000000..db2d3ea --- /dev/null +++ b/muyu-modules/muyu-marketing/pom.xml @@ -0,0 +1,23 @@ + + + + com.muyu + muyu-modules + 3.6.3 + + pom + + marketing-common + marketing-remote + marketing-server + + 4.0.0 + + muyu-marketing + + + muyu-marketing营销模块 + + diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/RuleInfo.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/RuleInfo.java index 345cdbc..c4d61ca 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/RuleInfo.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/RuleInfo.java @@ -50,6 +50,8 @@ public class RuleInfo extends BaseEntity { @Excel(name = "规格状态") @ApiModelProperty(name = "规格状态", value = "规格状态") private String status; + + /** 规格状态 */ @Excel(name = "规格描述") @ApiModelProperty(name = "规格描述", value = "规格描述") private String remark; diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/AttributeGroupEditReq.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/AttributeGroupEditReq.java index 7ae2fff..35a1b47 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/AttributeGroupEditReq.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/AttributeGroupEditReq.java @@ -1,10 +1,7 @@ package com.muyu.product.domain.req; import java.util.Date; -import java.util.List; - import com.fasterxml.jackson.annotation.JsonFormat; -import com.muyu.product.domain.model.RuleAttrAddModel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -35,6 +32,6 @@ public class AttributeGroupEditReq extends BaseEntity { /** 状态 */ @ApiModelProperty(name = "状态", value = "状态", required = true) private String states; - private List attributeList; + } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java index f65452b..21f92fb 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java @@ -8,6 +8,7 @@ import lombok.experimental.SuperBuilder; import io.swagger.annotations.*; import com.muyu.common.core.web.domain.TreeEntity; +import javax.validation.constraints.NotNull; import java.util.List; /** @@ -43,6 +44,7 @@ public class CategoryInfoSaveReq extends TreeEntity { /** 是否启用 */ @ApiModelProperty(name = "是否启用", value = "是否启用", required = true) + @NotNull() private String start; /** 介绍 */ diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/RuleInfoEditReq.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/RuleInfoEditReq.java index 1a83081..6832722 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/RuleInfoEditReq.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/RuleInfoEditReq.java @@ -1,5 +1,6 @@ package com.muyu.product.domain.req; +import com.muyu.common.core.annotation.Excel; import com.muyu.product.domain.model.RuleAttrAddModel; import lombok.Data; import lombok.EqualsAndHashCode; @@ -33,9 +34,15 @@ public class RuleInfoEditReq extends BaseEntity { /** 规格状态 */ @ApiModelProperty(name = "规格状态", value = "规格状态") private String status; - @ApiModelProperty(name = "规格状态", value = "规格状态") + + /** 规格状态 */ + @Excel(name = "规格描述") + @ApiModelProperty(name = "规格描述", value = "规格描述") private String remark; + /** + * 规格属性集合 + */ private List ruleAttrList; } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupPageResp.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupPageResp.java index 7936caf..3fa6abf 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupPageResp.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupPageResp.java @@ -48,6 +48,7 @@ public class AttributeGroupPageResp extends BaseEntity { .attributeInfoList(attributeInfos) .build(); } + public static AttributeGroupPageResp groupFunBuild (AttributeGroup attributeGroup, Function > function) { return AttributeGroupPageResp.builder() .id(attributeGroup.getId()) diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupUpdResp.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupUpdResp.java index 547929c..3585e3b 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupUpdResp.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/AttributeGroupUpdResp.java @@ -7,16 +7,27 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; + +/** + * 修改回显的详细信息 + */ @Data -@AllArgsConstructor -@NoArgsConstructor @Builder +@NoArgsConstructor +@AllArgsConstructor public class AttributeGroupUpdResp { + + /** 属性组编号 */ private Long id; /** 组名称 */ private String name; + /** 状态 */ private String states; + + /** + * 属性ID集合 + */ private List attributeList; } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/RuleInfoUpdResp.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/RuleInfoUpdResp.java index 0e87045..b9e352d 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/RuleInfoUpdResp.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/RuleInfoUpdResp.java @@ -3,7 +3,6 @@ package com.muyu.product.domain.resp; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.muyu.common.core.annotation.Excel; -import com.muyu.product.domain.AttributeInfo; import com.muyu.product.domain.model.RuleAttrAddModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -13,11 +12,16 @@ import lombok.NoArgsConstructor; import java.util.List; +/** + * 规格修改响应对象 + */ @Data @Builder -@AllArgsConstructor @NoArgsConstructor +@AllArgsConstructor public class RuleInfoUpdResp { + + /** 主键 */ @TableId(value = "id",type = IdType.AUTO) @ApiModelProperty(name = "主键", value = "主键") private Long id; @@ -32,11 +36,13 @@ public class RuleInfoUpdResp { @ApiModelProperty(name = "规格状态", value = "规格状态") private String status; + /** 规格状态 */ @Excel(name = "规格描述") @ApiModelProperty(name = "规格描述", value = "规格描述") private String remark; - - + /** + * 规格属性集合 + */ private List ruleAttrList; } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java index 7b6dfb0..71e0b2b 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java @@ -76,7 +76,7 @@ public class AttributeGroupController extends BaseController { @GetMapping(value = "/{id}") @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class) public Result getInfo(@PathVariable("id") Long id) { - return Result.success(attributeGroupService.getUpdateById(id)); + return Result.success(attributeGroupService.getUpdById(id)); } /** @@ -100,8 +100,7 @@ public class AttributeGroupController extends BaseController { @PutMapping("/{id}") @ApiOperation("修改属性组") public Result edit(@PathVariable Long id, @RequestBody AttributeGroupEditReq attributeGroupEditReq) { - //return toAjax(attributeGroupService.updateById(AttributeGroup.editBuild(id,attributeGroupEditReq))); - return toAjax(attributeGroupService.updateById(id,attributeGroupEditReq)); + return toAjax(attributeGroupService.updateById(AttributeGroup.editBuild(id,attributeGroupEditReq))); } /** diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java index 8755f18..55dbaef 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java @@ -125,15 +125,7 @@ public class CategoryInfoController extends BaseController { @ApiOperation("删除品类信息") @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4") public Result remove(@PathVariable List ids) { - List categoryInfos = categoryInfoService.listByIds(ids); - String a=""; - for (CategoryInfo categoryInfo : categoryInfos) { - a+=categoryInfo.getId(); - } - if(a!=null && a!=""){ - return toAjax(categoryInfoService.removeBatchByIds(ids)); - } - return Result.error("子节点存在不能删除"); + return toAjax(categoryInfoService.removeBatchByIds(ids)); } /** diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleAttrInfoController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleAttrInfoController.java index 7331794..422428b 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleAttrInfoController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleAttrInfoController.java @@ -3,7 +3,6 @@ package com.muyu.product.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.muyu.product.domain.resp.RuleInfoUpdResp; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleInfoController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleInfoController.java index c7d934a..9fec49d 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleInfoController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/RuleInfoController.java @@ -101,8 +101,8 @@ public class RuleInfoController extends BaseController { @PutMapping("/{id}") @ApiOperation("修改商品规格") public Result edit(@PathVariable Long id, @RequestBody RuleInfoEditReq ruleInfoEditReq) { - //return toAjax(ruleInfoService.updateById(RuleInfo.editBuild(id,ruleInfoEditReq))); - return toAjax(ruleInfoService.updateById(id,ruleInfoEditReq)); +// return toAjax(ruleInfoService.updateById(RuleInfo.editBuild(id,ruleInfoEditReq))); + return toAjax(ruleInfoService.updateById(id, ruleInfoEditReq)); } /** diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/AddAsAttributeGroupMapper.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/AddAsAttributeGroupMapper.java deleted file mode 100644 index 9dced5e..0000000 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/mapper/AddAsAttributeGroupMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.muyu.product.mapper; - -import com.muyu.product.domain.AsAttributeGroup; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -@Mapper -public interface AddAsAttributeGroupMapper { - void deleteGroup(@Param("id") Long id); - void addGroup(AsAttributeGroup asAttributeGroup); -} diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AddAsAttributeGroupService.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AddAsAttributeGroupService.java deleted file mode 100644 index 6f8b5f5..0000000 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AddAsAttributeGroupService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.muyu.product.service; - -import com.muyu.product.domain.AsAttributeGroup; - -public interface AddAsAttributeGroupService { - void deleteGroup(Long id); - void addGroup(AsAttributeGroup asAttributeGroup); -} diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AttributeGroupService.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AttributeGroupService.java index 1566755..5e50f89 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AttributeGroupService.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/AttributeGroupService.java @@ -7,7 +7,6 @@ import com.muyu.product.domain.AttributeGroup; import com.baomidou.mybatisplus.extension.service.IService; import com.muyu.product.domain.AttributeInfo; import com.muyu.product.domain.model.AttributeGroupSaveModel; -import com.muyu.product.domain.req.AttributeGroupEditReq; import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupUpdResp; @@ -42,13 +41,9 @@ public interface AttributeGroupService extends IService { public Boolean save(AttributeGroupSaveModel attributeGroupSaveModel); /** - * + * 根据ID查询属性组的修改 * @param id * @return */ - - AttributeGroupUpdResp getUpdateById(Long id); - - boolean updateById(Long id, AttributeGroupEditReq attributeGroupEditReq); - + AttributeGroupUpdResp getUpdById(Long id); } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleAttrInfoService.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleAttrInfoService.java index 56b7183..2623202 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleAttrInfoService.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleAttrInfoService.java @@ -3,7 +3,6 @@ package com.muyu.product.service; import java.util.List; import com.muyu.product.domain.RuleAttrInfo; import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.product.domain.resp.RuleInfoUpdResp; /** * 规格详情Service接口 @@ -26,5 +25,4 @@ public interface RuleAttrInfoService extends IService { * @return 规格详情集合 */ List getInfoByRuleId (Long ruleId); - } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleInfoService.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleInfoService.java index 1afe8af..6c5933d 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleInfoService.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/RuleInfoService.java @@ -35,8 +35,18 @@ public interface RuleInfoService extends IService { TableDataInfo queryList (RuleInfoQueryReq ruleInfoQueryReq); + /** + * 通过规格ID获取规格修改详细信息 + * @param id 规格ID + * @return + */ RuleInfoUpdResp getUpdById(Long id); + /** + * 通过ID修改规格属性 + * @param id ID + * @param ruleInfoEditReq 请求对象 + * @return + */ boolean updateById(Long id, RuleInfoEditReq ruleInfoEditReq); - } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AddAsAttributeGroupServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AddAsAttributeGroupServiceImpl.java deleted file mode 100644 index c29e12d..0000000 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AddAsAttributeGroupServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.muyu.product.service.impl; - -import com.muyu.product.domain.AsAttributeGroup; -import com.muyu.product.mapper.AddAsAttributeGroupMapper; -import com.muyu.product.service.AddAsAttributeGroupService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class AddAsAttributeGroupServiceImpl implements AddAsAttributeGroupService { - @Autowired - AddAsAttributeGroupMapper addAsAttributeGroupMapper; - - @Override - public void deleteGroup(Long id) { - addAsAttributeGroupMapper.deleteGroup(id); - } - - @Override - public void addGroup(AsAttributeGroup asAttributeGroup) { - addAsAttributeGroupMapper.addGroup(asAttributeGroup); - } -} diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeGroupServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeGroupServiceImpl.java index 96567ca..cbb3a6a 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeGroupServiceImpl.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeGroupServiceImpl.java @@ -5,15 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageInfo; import com.muyu.common.core.utils.ObjUtils; import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.common.security.utils.SecurityUtils; import com.muyu.product.domain.AsAttributeGroup; import com.muyu.product.domain.AttributeGroup; import com.muyu.product.domain.AttributeInfo; -import com.muyu.product.domain.RuleAttrInfo; import com.muyu.product.domain.model.AttributeGroupSaveModel; -import com.muyu.product.domain.model.RuleAttrAddModel; -import com.muyu.product.domain.req.AttributeGroupEditReq; -import com.muyu.product.domain.req.AttributeInfoSaveReq; import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupUpdResp; import com.muyu.product.mapper.AttributeGroupMapper; @@ -25,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.management.AttributeNotFoundException; import java.util.List; -import java.util.function.Function; -import java.util.stream.Stream; /** * 属性组Service业务层处理 @@ -116,45 +108,22 @@ public class AttributeGroupServiceImpl extends ServiceImpl asAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(); - asAttributeGroupLambdaQueryWrapper.eq(AsAttributeGroup::getGroupId,id); - List list = asAttributeGroupService.list(asAttributeGroupLambdaQueryWrapper).stream() + public AttributeGroupUpdResp getUpdById(Long id) { + AttributeGroup attributeGroup = this.getById(id); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AsAttributeGroup::getGroupId, id); + List asAttributeGroupList = asAttributeGroupService.list(queryWrapper); + List attributeIdList = asAttributeGroupList.stream() .map(AsAttributeGroup::getAttributeId) .toList(); - List attributeInfos = attributeInfoService.listByIds(list); + List attributeInfoList = attributeInfoService.listByIds(attributeIdList); + return AttributeGroupUpdResp.builder() - .id(byId.getId()) - .name(byId.getName()) - .states(byId.getStates()) - .attributeList(attributeInfos) + .id(attributeGroup.getId()) + .name(attributeGroup.getName()) + .states(attributeGroup.getStates()) + .attributeList(attributeInfoList) .build(); } - - /** - * LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - * queryWrapper.eq(RuleAttrInfo::getRuleId,id); - * this.ruleAttrInfoService.remove(queryWrapper); - * ruleAttrInfoService.saveBatch( - * ruleInfoEditReq.getRuleAttrList().stream() - * .map(ruleAttrAddModel -> RuleAttrInfo.addModelBuild(ruleAttrAddModel,() ->{return id;},SecurityUtils::getUsername)).toList() - * ); - * @param id - * @param attributeGroupEditReq - * @return - */ - @Override - public boolean updateById(Long id, AttributeGroupEditReq attributeGroupEditReq) { - boolean b = this.updateById(id, attributeGroupEditReq); - if(b){ - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(AttributeInfoSaveReq::getId,id); - this.asAttributeGroupService.removeById(queryWrapper); - - - } - return b; - - } } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/BrandInfoServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/BrandInfoServiceImpl.java index a9e62a7..3c2f6c9 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/BrandInfoServiceImpl.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/BrandInfoServiceImpl.java @@ -5,9 +5,7 @@ import java.util.List; import com.muyu.common.core.utils.ObjUtils; import com.muyu.common.security.utils.SecurityUtils; -import com.muyu.product.service.AddAsAttributeGroupService; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.muyu.product.mapper.BrandInfoMapper; import com.muyu.product.domain.BrandInfo; @@ -24,8 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @Slf4j @Service public class BrandInfoServiceImpl extends ServiceImpl implements BrandInfoService { - @Autowired - AddAsAttributeGroupService addAsAttributeGroupService; + /** * 查询品牌信息列表 * @@ -65,7 +62,6 @@ public class BrandInfoServiceImpl extends ServiceImpl public RuleInfoUpdResp getUpdById(Long id) { RuleInfo ruleInfo = this.getById(id); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleAttrInfo::getRuleId,id); + queryWrapper.eq(RuleAttrInfo::getRuleId, id); List ruleAttrInfoList = this.ruleAttrInfoService.list(queryWrapper); return RuleInfoUpdResp.builder() .id(ruleInfo.getId()) @@ -128,13 +129,14 @@ public class RuleInfoServiceImpl extends ServiceImpl @Override public boolean updateById(Long id, RuleInfoEditReq ruleInfoEditReq) { boolean update = this.updateById(RuleInfo.editBuild(id, ruleInfoEditReq)); - if(update){ + if (update) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleAttrInfo::getRuleId,id); + queryWrapper.eq(RuleAttrInfo::getRuleId, id); this.ruleAttrInfoService.remove(queryWrapper); ruleAttrInfoService.saveBatch( ruleInfoEditReq.getRuleAttrList().stream() - .map(ruleAttrAddModel -> RuleAttrInfo.addModelBuild(ruleAttrAddModel,() ->{return id;},SecurityUtils::getUsername)).toList() + .map(ruleAttrAddModel -> RuleAttrInfo.addModelBuild(ruleAttrAddModel, () -> id, SecurityUtils::getUsername)) + .toList() ); } return update; diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/bootstrap.yml b/muyu-modules/muyu-product/muyu-product-server/src/main/resources/bootstrap.yml index 6f0e008..e8bd02d 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/AddAsAttributeGroupMapper.xml b/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/AddAsAttributeGroupMapper.xml deleted file mode 100644 index 12f7df5..0000000 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/resources/mapper/product/AddAsAttributeGroupMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - INSERT INTO - as_attribute_group - ( group_id, - attribute_id, - remark) - VALUES - (#{groupId}, - #{attributeId}, - #{remark}) - - - delete from as_attribute_group where id=#{id} - - diff --git a/muyu-modules/muyu-shop-cart/muyu-shop-cart-server/src/main/resources/bootstrap.yml b/muyu-modules/muyu-shop-cart/muyu-shop-cart-server/src/main/resources/bootstrap.yml index af0f777..8e54ec5 100644 --- a/muyu-modules/muyu-shop-cart/muyu-shop-cart-server/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-shop-cart/muyu-shop-cart-server/src/main/resources/bootstrap.yml @@ -16,10 +16,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/muyu-system/src/main/resources/bootstrap.yml b/muyu-modules/muyu-system/src/main/resources/bootstrap.yml index d25ed1e..a66fd4c 100644 --- a/muyu-modules/muyu-system/src/main/resources/bootstrap.yml +++ b/muyu-modules/muyu-system/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/muyu-modules/pom.xml b/muyu-modules/pom.xml index 24447f2..ff15472 100644 --- a/muyu-modules/pom.xml +++ b/muyu-modules/pom.xml @@ -15,6 +15,7 @@ muyu-file muyu-product muyu-shop-cart + muyu-marketing muyu-modules diff --git a/muyu-visual/muyu-monitor/src/main/resources/bootstrap.yml b/muyu-visual/muyu-monitor/src/main/resources/bootstrap.yml index 1b0d9c3..1276c8e 100644 --- a/muyu-visual/muyu-monitor/src/main/resources/bootstrap.yml +++ b/muyu-visual/muyu-monitor/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 config: # 配置中心地址 - server-addr: 124.223.70.108:8848 + server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/pom.xml b/pom.xml index e2038d3..7c6971b 100644 --- a/pom.xml +++ b/pom.xml @@ -263,6 +263,22 @@ ${muyu.version} + + + + com.muyu + marketing-common + ${muyu.version} + + + + + + com.muyu + marketing-remote + ${muyu.version} + + @@ -314,7 +330,7 @@ org.apache.maven.plugins maven-source-plugin 3.0.1 - 1 + true diff --git a/sql/ry-cloud.sql b/sql/ry-cloud.sql index 21006fb..357eaeb 100644 --- a/sql/ry-cloud.sql +++ b/sql/ry-cloud.sql @@ -490,7 +490,7 @@ CREATE TABLE `qrtz_triggers` ( -- Records of qrtz_triggers -- ---------------------------- --- --------------------------- +-- ---------------------------- -- Table structure for sys_config -- ---------------------------- DROP TABLE IF EXISTS `sys_config`;