From 93de1f5c2d7439e21700219b4d24235a6682d484 Mon Sep 17 00:00:00 2001 From: yuehanhan <2408148542@qq.com> Date: Sun, 24 Nov 2024 18:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/market/team/TeamOpenTypeEnum.java | 28 ++++ .../common/core/web/model/QueryModel.java | 65 +++++++++ .../muyu/common/core/web/page/PageDomain.java | 29 ++-- .../muyu-marketing/marketing-common/pom.xml | 28 ++++ .../marketing/domain/ActivityTeamInfo.java | 100 ++++++++++++++ .../domain/ActivityTeamOpenInfo.java | 71 ++++++++++ .../domain/ActivityTeamProductSkuInfo.java | 60 +++++++++ .../domain/TeamStrategyExemption.java | 57 ++++++++ .../domain/TeamStrategyExemptionHundred.java | 49 +++++++ .../domain/TeamStrategyExemptionOrdinary.java | 49 +++++++ .../model/ActivityTeamInfoListModel.java | 41 ++++++ .../model/ActivityTeamInfoListQueryModel.java | 28 ++++ .../model/ActivityTeamInfoSaveModel.java | 76 +++++++++++ .../model/TeamProductDiscountPriceModel.java | 44 ++++++ .../domain/model/TeamSkuInfoModel.java | 22 +++ .../domain/model/TeamStockModel.java | 18 +++ .../domain/req/ActivityTeamInfoSaveReq.java | 114 ++++++++++++++++ .../marketing/domain/req/TeamInfoListReq.java | 43 ++++++ .../marketing/domain/resp/TeamInfoResp.java | 81 ++++++++++++ .../muyu-marketing/marketing-remote/pom.xml | 27 ++++ .../src/main/java/com/muyu/Main.java | 7 + .../muyu-marketing/marketing-server/pom.xml | 125 ++++++++++++++++++ .../marketing/MuYuMarketIngApplication.java | 22 +++ .../controller/ActivityTeamController.java | 69 ++++++++++ .../mapper/ActivityTeamInfoMapper.java | 10 ++ .../mapper/ActivityTeamOpenInfoMapper.java | 9 ++ .../ActivityTeamProductSkuInfoMapper.java | 9 ++ .../TeamStrategyExemptionHundredMapper.java | 9 ++ .../mapper/TeamStrategyExemptionMapper.java | 9 ++ .../TeamStrategyExemptionOrdinaryMapper.java | 10 ++ .../service/ActivityTeamInfoService.java | 23 ++++ .../service/ActivityTeamOpenInfoService.java | 33 +++++ .../ActivityTeamProductSkuInfoService.java | 23 ++++ .../TeamStrategyExemptionHundredService.java | 7 + .../TeamStrategyExemptionOrdinaryService.java | 7 + .../service/TeamStrategyExemptionService.java | 7 + .../impl/ActivityTeamInfoServiceImpl.java | 96 ++++++++++++++ .../impl/ActivityTeamOpenInfoServiceImpl.java | 35 +++++ ...ActivityTeamProductSkuInfoServiceImpl.java | 53 ++++++++ ...amStrategyExemptionHundredServiceImpl.java | 13 ++ .../TeamStrategyExemptionOrdinaryImpl.java | 13 ++ .../TeamStrategyExemptionServiceImpl.java | 13 ++ .../src/main/resources/banner.txt | 2 + .../src/main/resources/bootstrap.yml | 32 +++++ .../src/main/resources/logback.xml | 74 +++++++++++ .../marketing/ActivityTeamInfoMapper.xml | 15 +++ .../src/test/java/com/forest/FoRestTest.java | 68 ++++++++++ muyu-modules/muyu-marketing/pom.xml | 24 ++++ muyu-modules/pom.xml | 2 + pom.xml | 12 ++ 营销 | 15 +++ 51 files changed, 1855 insertions(+), 21 deletions(-) create mode 100644 muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/enums/market/team/TeamOpenTypeEnum.java create mode 100644 muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/model/QueryModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/pom.xml create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamInfo.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamOpenInfo.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamProductSkuInfo.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemption.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionHundred.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionOrdinary.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListQueryModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoSaveModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductDiscountPriceModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamSkuInfoModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamStockModel.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/ActivityTeamInfoSaveReq.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/TeamInfoListReq.java create mode 100644 muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoResp.java create mode 100644 muyu-modules/muyu-marketing/marketing-remote/pom.xml create mode 100644 muyu-modules/muyu-marketing/marketing-remote/src/main/java/com/muyu/Main.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/pom.xml create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/MuYuMarketIngApplication.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/controller/ActivityTeamController.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamInfoMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamOpenInfoMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamProductSkuInfoMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionHundredMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionOrdinaryMapper.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamInfoService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamOpenInfoService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamProductSkuInfoService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionHundredService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionOrdinaryService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionService.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamInfoServiceImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamOpenInfoServiceImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamProductSkuInfoServiceImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionHundredServiceImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionOrdinaryImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionServiceImpl.java create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/resources/banner.txt create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/resources/bootstrap.yml create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/resources/logback.xml create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/main/resources/mapper/marketing/ActivityTeamInfoMapper.xml create mode 100644 muyu-modules/muyu-marketing/marketing-server/src/test/java/com/forest/FoRestTest.java create mode 100644 muyu-modules/muyu-marketing/pom.xml create mode 100644 营销 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..fe2f15d --- /dev/null +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/enums/market/team/TeamOpenTypeEnum.java @@ -0,0 +1,28 @@ +package com.muyu.common.core.enums.market.team; + +/** + * 参团类型枚举类 + */ +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..1e1addc --- /dev/null +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/web/model/QueryModel.java @@ -0,0 +1,65 @@ +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 org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class QueryModel { + /** + * 当前记录起始索引 + */ + private Integer pageNum; + + /** + * 每页显示记录数 + */ + private Integer pageSize; + + /** + * 排序列 + */ + private String orderByColumn; + + /** + * 排序的方向desc或者asc + */ + private boolean isAsc = true; + + /** + * 分页参数合理化 + */ + private Boolean reasonable = true; + + /** + * 构建模型分页对象 + */ + 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; + } + + + /** + * 构建查询分页对象 + */ + public com.baomidou.mybatisplus.extension.plugins.pagination.Page bulidPage(){ + com.baomidou.mybatisplus.extension.plugins.pagination.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..e6c0e56 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 +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder public class PageDomain { /** * 当前记录起始索引 @@ -48,25 +56,7 @@ public class PageDomain { 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 +77,4 @@ public class PageDomain { return reasonable; } - public void setReasonable (Boolean reasonable) { - this.reasonable = reasonable; - } } 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..2d18b57 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + com.muyu + muyu-marketing + 3.6.3 + ../../pom.xml + + + 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..5c09643 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamInfo.java @@ -0,0 +1,100 @@ +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 com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.sql.Date; +import java.sql.Timestamp; + +/** + * 拼团信息表 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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; + + + /** + * 构造方法 + */ + public static ActivityTeamInfo saveActivityTeamInfo(ActivityTeamInfoSaveModel activityTeamInfoSaveModel) { + return ActivityTeamInfo.builder() + .name(activityTeamInfoSaveModel.getName()) + .productId(activityTeamInfoSaveModel.getProductId()) + .productImage(activityTeamInfoSaveModel.getProductImage()) + .introduction(activityTeamInfoSaveModel.getIntroduction()) + .unit(activityTeamInfoSaveModel.getUnit()) + .imageList(activityTeamInfoSaveModel.getProductImage()) + .endTime((Date) activityTeamInfoSaveModel.getEndTime()) + .sort(activityTeamInfoSaveModel.getSort()) + .content(activityTeamInfoSaveModel.getContent()) + .status(activityTeamInfoSaveModel.getStatus()) + .strategyType(activityTeamInfoSaveModel.getStrategyType()) + .strategyId(activityTeamInfoSaveModel.getStrategyId()) + .build(); + + + } +} 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..cc8cc30 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamOpenInfo.java @@ -0,0 +1,71 @@ +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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.sql.Timestamp; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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 Timestamp 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..a524c45 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/ActivityTeamProductSkuInfo.java @@ -0,0 +1,60 @@ +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 com.muyu.marketing.domain.model.TeamSkuInfoModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; +import java.util.function.Function; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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 BigDecimal teamPrice; + + /** + * 构造函数的方法 + * TeamSkuInfoModel 商品sku模型 + */ + public static ActivityTeamProductSkuInfo TeamSkuInfoBuild(TeamSkuInfoModel teamSkuInfoModel, Function function){ + return function.apply(ActivityTeamProductSkuInfo.builder() + .teamPrice(teamSkuInfoModel.getTeamPrice()) + .teamStock(teamSkuInfoModel.getTeamStock()) + .productSku(teamSkuInfoModel.getProductSku()) + .productId(teamSkuInfoModel.getProductId())); + } +} 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..e17d2a6 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemption.java @@ -0,0 +1,57 @@ +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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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..c2a6d28 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionHundred.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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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..1d4858e --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/TeamStrategyExemptionOrdinary.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.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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..8b93212 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListModel.java @@ -0,0 +1,41 @@ +package com.muyu.marketing.domain.model; + +import com.muyu.marketing.domain.ActivityTeamInfo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.function.Function; + +@Data +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +public class ActivityTeamInfoListModel { + private Long id; + private String name; + private String productImage; + private BigDecimal productPrice; + private BigDecimal teamPrice; + private Long attendNumber; + private Long openTeamNumber; + private Long addTeamNumber; + private Long teamStock; + private Long remainStock; + private String endTime; + private String status; + + public static ActivityTeamInfoListModel domainBuild(ActivityTeamInfo activityTeamInfo, Function function){ + return function.apply( + ActivityTeamInfoListModel.builder() + .id(activityTeamInfo.getId()) + .name(activityTeamInfo.getName()) + .endTime(String.valueOf(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..adf1f9c --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoListQueryModel.java @@ -0,0 +1,28 @@ +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; + +/** + * 团购活动列表查询模型 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@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/ActivityTeamInfoSaveModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoSaveModel.java new file mode 100644 index 0000000..e159cac --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/ActivityTeamInfoSaveModel.java @@ -0,0 +1,76 @@ +package com.muyu.marketing.domain.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * @create: 2024-11-22 16:57 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class ActivityTeamInfoSaveModel { + /** + * 商品id + */ + private Long productId; + /** + * 商品图片 + */ + private String productImage; + /** + * 活动名称 + */ + private String name; + /** + * 活动简介 + */ + private String introduction; + /** + * 商品单位 + */ + private String unit; + /** + * 商品轮播图 + */ + private List imageList; + /** + * 活动结束时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + /** + * 排序 + */ + private Integer sort; + /** + * 详情 + */ + private String content; + /** + * 状态 + */ + private String status; + /** + * 拼团类型 + */ + private String strategyType; + /** + * 拼团id + */ + private Long strategyId; + /** + * 商品sku + */ + private List projectSkuInfoList; + +} 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..c24114e --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamProductDiscountPriceModel.java @@ -0,0 +1,44 @@ +package com.muyu.marketing.domain.model; + +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class TeamProductDiscountPriceModel { + + /** + * 商品价格 + */ + private BigDecimal productPrice; + + /** + * 团购优惠价格 + */ + private BigDecimal teamPrice; + + /** + * 优惠力度 + */ + private double discount; + + /** + * 通过商品价格 和团购价格 生成优惠力度 + */ + public static TeamProductDiscountPriceModel of(BigDecimal productPrice,BigDecimal teamPrice){ + return 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/TeamSkuInfoModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamSkuInfoModel.java new file mode 100644 index 0000000..bc53684 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamSkuInfoModel.java @@ -0,0 +1,22 @@ +package com.muyu.marketing.domain.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; + +/** + * @description: 商品sku模型 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class TeamSkuInfoModel { + private Long productId; + private String productSku; + private Long teamStock; + private BigDecimal teamPrice; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamStockModel.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamStockModel.java new file mode 100644 index 0000000..bb76cab --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/model/TeamStockModel.java @@ -0,0 +1,18 @@ +package com.muyu.marketing.domain.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @description: 商品库存模型 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class TeamStockModel { + private Long teamStock; + private Long remainStock; +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/ActivityTeamInfoSaveReq.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/ActivityTeamInfoSaveReq.java new file mode 100644 index 0000000..080f78b --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/ActivityTeamInfoSaveReq.java @@ -0,0 +1,114 @@ +package com.muyu.marketing.domain.req; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel; +import com.muyu.marketing.domain.model.TeamSkuInfoModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * @description: 添加拼团活动入参 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class ActivityTeamInfoSaveReq { + /** + * 商品id + */ + @NotNull(message = "商品id不能为空") + private Long productId; + /** + * 商品图片 + */ + @NotNull(message = "商品照片不能为空") + private String productImage; + /** + * 活动名称 + */ + @NotNull(message = "活动名称不能为空") + private String name; + /** + * 活动简介 + */ + @NotNull(message = "活动简介不能为空") + private String introduction; + /** + * 商品单位 + */ + @NotNull(message = "商品单位不能为空") + private String unit; + /** + * 商品轮播图 + */ + @NotNull(message = "商品轮播图不能为空") + private List imageList; + /** + * 活动结束时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @NotNull(message = "活动结束时间不能为空") + private Date endTime; + /** + * 排序 + */ + @NotNull(message = "排序不能为空") + private Integer sort; + /** + * 详情 + */ + @NotNull(message = "详情不能为空") + private String content; + /** + * 状态 + */ + @NotNull(message = "状态不能为空") + private String status; + /** + * 拼团类型 + */ + @NotNull(message = "拼团类型不能为空") + private String strategyType; + /** + * 拼团id + */ + @NotNull(message = "拼团id不能为空") + private Long strategyId; + /** + * 商品sku + */ + @NotNull(message = "商品sku不能为空") + private List projectSkuInfoList; + + /** + *构造方法 + */ + public ActivityTeamInfoSaveModel saveModel(){ + return ActivityTeamInfoSaveModel.builder() + .productId(productId) + .productImage(productImage) + .name(name) + .introduction(introduction) + .unit(unit) + .imageList(imageList) + .endTime(endTime) + .sort(sort) + .content(content) + .status(status) + .strategyType(strategyType) + .strategyId(strategyId) + .projectSkuInfoList(projectSkuInfoList) +// .content(content) +// .strategyType(strategyType) + .build(); + } +} 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..ff56d56 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/req/TeamInfoListReq.java @@ -0,0 +1,43 @@ +package com.muyu.marketing.domain.req; + +import com.muyu.common.core.web.page.PageDomain; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel; +import lombok.*; +import lombok.experimental.SuperBuilder; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +public class TeamInfoListReq extends PageDomain { + /** + * 搜索关键词 + */ + private String keyWord; + + /** + * 活动状态 + */ + private String status; + + /** + * 分页 + */ + private Integer pageNum=1; + private Integer pageSize=2; + + /** + * 通过当前对象查询构建模型 + */ + public ActivityTeamInfoListQueryModel buildModel() { + return ActivityTeamInfoListQueryModel.builder() + .keyWord(keyWord) + .status(status) + .pageNum(pageNum) + .pageSize(pageSize) + .build() + .domainbuild(this); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoResp.java b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoResp.java new file mode 100644 index 0000000..fc160c2 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-common/src/main/java/com/muyu/marketing/domain/resp/TeamInfoResp.java @@ -0,0 +1,81 @@ +package com.muyu.marketing.domain.resp; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.math.BigDecimal; +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +public class TeamInfoResp { + + /** + * 拼团活动ID + */ + private Long id; + /** + * 拼团名称 + */ + private String name; + /** + * 参团人数 + */ + private Long addTeamNumber; + /** + * 拼团人数 + */ + private Long attendNumber; + /** + * 团购结束时间 + */ + private String endTime; + /** + * 开团人数 + */ + private Long openTeamNumber; + /** + * 拼团商品图片 + */ + private String productImage; + /** + * 商品价格 + */ + private BigDecimal productPrice; + /** + * 剩余库存 + */ + private Long remainStock; + + /** + * 团购状态 + */ + private String status; + /** + * 拼团价格 + */ + private BigDecimal teamPrice; + /** + * 团购库存 + */ + private Long teamStock; + + public static TeamInfoResp respBuild(ActivityTeamInfoListModel activityTeamInfoListModel){ + return TeamInfoResp.builder() + .id(activityTeamInfoListModel.getId()) + .name(activityTeamInfoListModel.getName()) + .endTime(activityTeamInfoListModel.getEndTime()) + .productImage(activityTeamInfoListModel.getProductImage()) + .status(activityTeamInfoListModel.getStatus()) + .addTeamNumber(activityTeamInfoListModel.getAddTeamNumber()) + .attendNumber(activityTeamInfoListModel.getAttendNumber()) + .openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber()) + .productPrice(activityTeamInfoListModel.getProductPrice()) + .remainStock(activityTeamInfoListModel.getRemainStock()) + .teamPrice(activityTeamInfoListModel.getTeamPrice()) + .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..38821b0 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-remote/pom.xml @@ -0,0 +1,27 @@ + + + 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-remote/src/main/java/com/muyu/Main.java b/muyu-modules/muyu-marketing/marketing-remote/src/main/java/com/muyu/Main.java new file mode 100644 index 0000000..95690d4 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-remote/src/main/java/com/muyu/Main.java @@ -0,0 +1,7 @@ +package com.muyu; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ 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..a0905d9 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/pom.xml @@ -0,0 +1,125 @@ + + + + + com.muyu + muyu-marketing + 3.6.3 + + + marketing-server + 4.0.0 + + 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 + + + + + + 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..fbfc914 --- /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/controller/ActivityTeamController.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/controller/ActivityTeamController.java new file mode 100644 index 0000000..062f1cc --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/controller/ActivityTeamController.java @@ -0,0 +1,69 @@ +package com.muyu.marketing.controller; + +import com.github.pagehelper.Page; +import com.muyu.common.core.domain.Result; +import com.muyu.common.core.utils.PageUtils; +import com.muyu.common.core.web.page.TableDataInfo; +import com.muyu.common.security.annotation.EnableMyFeignClients; +import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; +import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq; +import com.muyu.marketing.domain.req.TeamInfoListReq; +import com.muyu.marketing.domain.resp.TeamInfoResp; +import com.muyu.marketing.service.ActivityTeamInfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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; + + +@RestController +@RequestMapping("/team") +@Slf4j +//@EnableMyFeignClients(basePackages = "com.muyu") +public class ActivityTeamController { + @Autowired + private ActivityTeamInfoService activityTeamInfoService; + + /** + * 检查404 + */ + public ActivityTeamController() { + log.info("商品拼团控制层{}",getClass().getName()); + } + /** + * 列表 + */ + @PostMapping("list") + public Result> list(@RequestBody TeamInfoListReq teamInfoListReq){ + //分页 + Page page = PageUtils.startPage(teamInfoListReq.getPageNum(), teamInfoListReq.getPageSize()); + List rows = activityTeamInfoService.list(teamInfoListReq.buildModel()).getRows(); + //将数据模型转换为响应模型 利用Stream流把数据转换为响应列表 + List activityTeamInfoResps = rows.stream().map(activityTeamInfoListModel -> { + return TeamInfoResp.respBuild(activityTeamInfoListModel); + }).toList(); + //创建分页信息对象 + TableDataInfo teamInfoRespTableDataInfo = new TableDataInfo<>(); + teamInfoRespTableDataInfo.setRows(activityTeamInfoResps); + teamInfoRespTableDataInfo.setTotal(page.getTotal()); + return Result.success(teamInfoRespTableDataInfo); + } + + /** + * 添加拼团活动 + */ + @PostMapping("addTeam") + public Result addTeam(@Validated @RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq){ + //判断是否添加成功 + boolean success = activityTeamInfoService.addTeam(activityTeamInfoSaveReq.saveModel()); + if (success){ + return Result.success("添加成功"); + } + return Result.error("添加失败"); + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamInfoMapper.java new file mode 100644 index 0000000..57e5113 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamInfoMapper.java @@ -0,0 +1,10 @@ +package com.muyu.marketing.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamInfo; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ActivityTeamInfoMapper extends BaseMapper { + void add(ActivityTeamInfo activityTeamInfo); +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamOpenInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamOpenInfoMapper.java new file mode 100644 index 0000000..2c60deb --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamOpenInfoMapper.java @@ -0,0 +1,9 @@ +package com.muyu.marketing.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/mapper/ActivityTeamProductSkuInfoMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamProductSkuInfoMapper.java new file mode 100644 index 0000000..187ba94 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/ActivityTeamProductSkuInfoMapper.java @@ -0,0 +1,9 @@ +package com.muyu.marketing.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +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/mapper/TeamStrategyExemptionHundredMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionHundredMapper.java new file mode 100644 index 0000000..92ff0cd --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionHundredMapper.java @@ -0,0 +1,9 @@ +package com.muyu.marketing.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +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/mapper/TeamStrategyExemptionMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionMapper.java new file mode 100644 index 0000000..1cd478c --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionMapper.java @@ -0,0 +1,9 @@ +package com.muyu.marketing.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +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/mapper/TeamStrategyExemptionOrdinaryMapper.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionOrdinaryMapper.java new file mode 100644 index 0000000..0153e25 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/mapper/TeamStrategyExemptionOrdinaryMapper.java @@ -0,0 +1,10 @@ +package com.muyu.marketing.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.marketing.domain.ActivityTeamInfo; +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/service/ActivityTeamInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamInfoService.java new file mode 100644 index 0000000..d10238d --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamInfoService.java @@ -0,0 +1,23 @@ +package com.muyu.marketing.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 com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel; + +import java.util.List; + +public interface ActivityTeamInfoService extends IService { + /** + * 通过查询模型查询团购活动列表 + */ + TableDataInfo list(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel); + + /** + * 添加拼团信息 + */ + boolean addTeam(ActivityTeamInfoSaveModel activityTeamInfoSaveModel); + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamOpenInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamOpenInfoService.java new file mode 100644 index 0000000..a955092 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamOpenInfoService.java @@ -0,0 +1,33 @@ +package com.muyu.marketing.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum; +import com.muyu.marketing.domain.ActivityTeamOpenInfo; + +public interface ActivityTeamOpenInfoService extends IService { + + /** + * 开团类型 + * 开团数量 + */ + public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType); + + /** + * 根据活动ID获取开团数量 + */ + public default Long getTeamOpenTypeNumberByTeamId(Long teamId){ + return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnum.OPEN_TEAM); + } + + /** + * 根据活动ID获取参团数量 + * @param teamId + * @return + */ + public default Long getTeamTypeNumberByTeamId(Long teamId){ + return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnum.IN_TEAM); + } + + + +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamProductSkuInfoService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamProductSkuInfoService.java new file mode 100644 index 0000000..7c01c17 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/ActivityTeamProductSkuInfoService.java @@ -0,0 +1,23 @@ +package com.muyu.marketing.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.model.TeamProductDiscountPriceModel; +import com.muyu.marketing.domain.model.TeamStockModel; + +import java.util.List; + +public interface ActivityTeamProductSkuInfoService extends IService { + /** + * 根据团购活动ID获取团购中最优惠的价格 + */ + public default List acivitySkuList (Long id){ + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,id); + return this.list(lambdaQueryWrapper); + } + + public TeamProductDiscountPriceModel discountPrice(Long teamId); + public TeamStockModel getStock(Long id); +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionHundredService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionHundredService.java new file mode 100644 index 0000000..4b71c0b --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionHundredService.java @@ -0,0 +1,7 @@ +package com.muyu.marketing.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; + +public interface TeamStrategyExemptionHundredService extends IService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionOrdinaryService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionOrdinaryService.java new file mode 100644 index 0000000..05a4a97 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionOrdinaryService.java @@ -0,0 +1,7 @@ +package com.muyu.marketing.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/service/TeamStrategyExemptionService.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionService.java new file mode 100644 index 0000000..8abc1fb --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/TeamStrategyExemptionService.java @@ -0,0 +1,7 @@ +package com.muyu.marketing.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.marketing.domain.TeamStrategyExemption; + +public interface TeamStrategyExemptionService extends IService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamInfoServiceImpl.java new file mode 100644 index 0000000..f805068 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamInfoServiceImpl.java @@ -0,0 +1,96 @@ +package com.muyu.marketing.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.ActivityTeamOpenInfo; +import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; +import com.muyu.marketing.domain.model.*; +import com.muyu.marketing.mapper.ActivityTeamInfoMapper; +import com.muyu.marketing.service.ActivityTeamInfoService; +import com.muyu.marketing.service.ActivityTeamOpenInfoService; +import com.muyu.marketing.service.ActivityTeamProductSkuInfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +@Slf4j +public class ActivityTeamInfoServiceImpl extends ServiceImpl +implements ActivityTeamInfoService { + @Autowired + private ActivityTeamOpenInfoService activityTeamOpenInfoService; + @Autowired + private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService; + + + @Override + public TableDataInfo list(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() + ); + Page pages = this.page(activityTeamInfoListQueryModel.bulidPage(), queryWrapper); + List records = pages.getRecords(); + List list = records.stream().map(activityTeamInfo -> ActivityTeamInfoListModel + .domainBuild(activityTeamInfo, (activityTeamInfoListModelBuilder -> { + Long teamOpenNum = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId()); + Long teamInNum = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId()); + TeamProductDiscountPriceModel discountPriceModel = activityTeamProductSkuInfoService.discountPrice(activityTeamInfo.getId()); + TeamStockModel stock = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId()); + return activityTeamInfoListModelBuilder + .addTeamNumber(teamInNum) + .openTeamNumber(teamInNum) + .attendNumber(teamOpenNum + teamInNum) + .teamPrice(discountPriceModel.getProductPrice()) + .teamStock(stock.getTeamStock()) + .remainStock(stock.getRemainStock()) + .build(); + }))).toList(); + return TableDataInfo.builder() + .total(pages.getTotal()) + .rows(list) + .build(); + } + + /** + * 添加拼团信息 + */ + @Override + public boolean addTeam(ActivityTeamInfoSaveModel activityTeamInfoSaveModel) { + //调用拼团信息表的构造方法 添加 + ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.saveActivityTeamInfo(activityTeamInfoSaveModel); + //调用添加方法 + boolean save = this.save(activityTeamInfo); + //判断添加的时候,添加规格sku列表的数据 调用集合 + if (save){ + List projectSkuInfoList = activityTeamInfoSaveModel.getProjectSkuInfoList(); + //利用steam流遍历集合,把集合中的数据进行转换,转换成对象 进行批量添加 + // 批量添加方法 + activityTeamProductSkuInfoService.saveBatch(projectSkuInfoList.stream().map(projuctSkuInfo -> ActivityTeamProductSkuInfo.TeamSkuInfoBuild(projuctSkuInfo, (activityTeamProductSkuInfoBuilder -> { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,activityTeamInfo.getId()); + long count = activityTeamOpenInfoService.count(queryWrapper); + return activityTeamProductSkuInfoBuilder + //商品表的ID + .teamId(activityTeamInfo.getId()) + //sku的剩余库存 + .teamStock(projuctSkuInfo.getTeamStock() - count) + .build(); + }))).toList()); + + } + + return save; + } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamOpenInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamOpenInfoServiceImpl.java new file mode 100644 index 0000000..b0e7ed3 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamOpenInfoServiceImpl.java @@ -0,0 +1,35 @@ +package com.muyu.marketing.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.mapper.ActivityTeamOpenInfoMapper; +import com.muyu.marketing.service.ActivityTeamOpenInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl +implements ActivityTeamOpenInfoService { + @Override + public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) { + return null; + } +// @Autowired +// private ActivityTeamOpenInfoService activityTeamOpenInfoService; +// /** +// * 通过活动ID和开团类型查询开团数量 +// */ +// @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/service/impl/ActivityTeamProductSkuInfoServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamProductSkuInfoServiceImpl.java new file mode 100644 index 0000000..edee197 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/ActivityTeamProductSkuInfoServiceImpl.java @@ -0,0 +1,53 @@ +package com.muyu.marketing.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.TeamStockModel; +import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper; +import com.muyu.marketing.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.util.List; +import java.util.Optional; + +@Service +public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl +implements ActivityTeamProductSkuInfoService { + @Autowired + private ProjectSkuCache projectSkuCache; + + @Override + public TeamProductDiscountPriceModel discountPrice(Long teamId) { + return null; + } + + @Override + public TeamStockModel getStock(Long id) { + return null; + } + +// @Override +// public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) { +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId); +// List teamProductSkuInfoList = this.list(queryWrapper); +// //优惠模型集合 +// 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(); +// } +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionHundredServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionHundredServiceImpl.java new file mode 100644 index 0000000..bcb6095 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionHundredServiceImpl.java @@ -0,0 +1,13 @@ +package com.muyu.marketing.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.TeamStrategyExemptionHundred; +import com.muyu.marketing.mapper.ActivityTeamInfoMapper; +import com.muyu.marketing.mapper.TeamStrategyExemptionHundredMapper; +import com.muyu.marketing.service.ActivityTeamInfoService; +import com.muyu.marketing.service.TeamStrategyExemptionHundredService; + +public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl +implements TeamStrategyExemptionHundredService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionOrdinaryImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionOrdinaryImpl.java new file mode 100644 index 0000000..daab607 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionOrdinaryImpl.java @@ -0,0 +1,13 @@ +package com.muyu.marketing.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary; +import com.muyu.marketing.mapper.ActivityTeamInfoMapper; +import com.muyu.marketing.mapper.TeamStrategyExemptionOrdinaryMapper; +import com.muyu.marketing.service.ActivityTeamInfoService; +import com.muyu.marketing.service.TeamStrategyExemptionOrdinaryService; + +public class TeamStrategyExemptionOrdinaryImpl extends ServiceImpl +implements TeamStrategyExemptionOrdinaryService { +} diff --git a/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionServiceImpl.java b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionServiceImpl.java new file mode 100644 index 0000000..d5e2e97 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/java/com/muyu/marketing/service/impl/TeamStrategyExemptionServiceImpl.java @@ -0,0 +1,13 @@ +package com.muyu.marketing.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.marketing.domain.ActivityTeamInfo; +import com.muyu.marketing.domain.TeamStrategyExemption; +import com.muyu.marketing.mapper.ActivityTeamInfoMapper; +import com.muyu.marketing.mapper.TeamStrategyExemptionMapper; +import com.muyu.marketing.service.ActivityTeamInfoService; +import com.muyu.marketing.service.TeamStrategyExemptionService; + +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..62a36c2 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/bootstrap.yml @@ -0,0 +1,32 @@ +# Tomcat +server: + port: 9209 + +# Spring +spring: + application: + # 应用名称 + name: muyu-marketing + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 60.204.152.212:8848 + config: + # 配置中心地址 + server-addr: 60.204.152.212:8848 + namespace: 634ec632-b03a-48b8-bc95-02b8bdc61e28 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +logging: + level: + com.muyu.marketing.mapper: DEBUG +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 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/marketing-server/src/main/resources/mapper/marketing/ActivityTeamInfoMapper.xml b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/mapper/marketing/ActivityTeamInfoMapper.xml new file mode 100644 index 0000000..7b92081 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/main/resources/mapper/marketing/ActivityTeamInfoMapper.xml @@ -0,0 +1,15 @@ + + + + + INSERT INTO `activity_team_info` (`name`, `product_id`, `product_image`, `introduction`, `unit`, `image_list`, `end_time`, `sort`, `content`, `status`, `strategy_type`, `strategy_id`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`) + VALUES (#{name}, #{productId}, #{productImage},#{introduction}, #{unit}, #{imageList}, #{endTime}, #{sort}, #{content}, #{status}, #{strategyType}, #{strategyId}, #{remark}, #{createBy}, now(), #{updateBy}, now()) + + + + + \ No newline at end of file diff --git a/muyu-modules/muyu-marketing/marketing-server/src/test/java/com/forest/FoRestTest.java b/muyu-modules/muyu-marketing/marketing-server/src/test/java/com/forest/FoRestTest.java new file mode 100644 index 0000000..ba8bc08 --- /dev/null +++ b/muyu-modules/muyu-marketing/marketing-server/src/test/java/com/forest/FoRestTest.java @@ -0,0 +1,68 @@ +package com.forest; + +import com.alibaba.fastjson2.JSONObject; +import com.muyu.common.system.domain.SysDistrict; +import com.muyu.system.MuYuSystemApplication; +import com.muyu.system.forest.gaode.api.GaoDeBaseApi; +import com.muyu.system.forest.gaode.api.resp.District; +import com.muyu.system.forest.gaode.api.resp.DistrictResult; +import com.muyu.system.service.SysDistrictService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * @author DongZl + * @description: 测试 + * @Date 2024/4/11 上午10:38 + */ +@SpringBootTest(classes = MuYuSystemApplication.class) +public class FoRestTest { + + @Resource + private GaoDeBaseApi gaoDeBaseApi; + + @Autowired + private SysDistrictService sysDistrictService; + + @Test + public void district(){ + DistrictResult districtResult = gaoDeBaseApi.district("广东省","3"); + List districtList = districtResult.getDistricts(); + if (districtList.size() == 1 && "中华人民共和国".equals(districtList.get(0).getName())){ + districtList = districtList.get(0).getDistricts(); + } + conversion(0L, districtList); + } + + + public void conversion(Long parentId, List districtList){ + if (districtList == null || districtList.isEmpty()){ + return; + } + for (District district : districtList) { + SysDistrict sysDistrict = SysDistrict.builder() + .parentId(parentId) + .level(district.getLevel()) + .code("[]".equals(district.getCode()) ? "-" : district.getCode()) + .name(district.getName()) + .center(district.getCenter()) + .areaCode(district.getAreaCode()) + .build(); + sysDistrictService.save(sysDistrict); + conversion(sysDistrict.getId(), district.getDistricts()); + } + } + + + @Test + public void weather(){ + String test = gaoDeBaseApi.weather("310120"); + System.out.println(test); + } + +} diff --git a/muyu-modules/muyu-marketing/pom.xml b/muyu-modules/muyu-marketing/pom.xml new file mode 100644 index 0000000..16aec42 --- /dev/null +++ b/muyu-modules/muyu-marketing/pom.xml @@ -0,0 +1,24 @@ + + + + com.muyu + muyu-modules + 3.6.3 + + + muyu-marketing + pom + + marketing-common + marketing-remote + marketing-server + + 4.0.0 + + muyu-marketing营销模块 + + + + diff --git a/muyu-modules/pom.xml b/muyu-modules/pom.xml index 24447f2..3f27759 100644 --- a/muyu-modules/pom.xml +++ b/muyu-modules/pom.xml @@ -15,6 +15,8 @@ muyu-file muyu-product muyu-shop-cart + muyu-marketing + muyu-modules diff --git a/pom.xml b/pom.xml index e256d02..3c1dcf5 100644 --- a/pom.xml +++ b/pom.xml @@ -262,7 +262,19 @@ muyu-shop-cart-cache ${muyu.version} + + + com.muyu + marketing-common + ${muyu.version} + + + + com.muyu + marketing-remote + ${muyu.version} + diff --git a/营销 b/营销 new file mode 100644 index 0000000..6f6f000 --- /dev/null +++ b/营销 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +