Compare commits
4 Commits
06ec124790
...
5fed8d7869
Author | SHA1 | Date |
---|---|---|
|
5fed8d7869 | |
|
a04925eab4 | |
|
b75c102e2c | |
|
49ea16c908 |
|
@ -0,0 +1,47 @@
|
|||
$.{
|
||||
"商品ID": "Long", //activity_team_info.product_id
|
||||
"商品图片": "String",
|
||||
"活动名称": "String",
|
||||
"活动简介": "String",
|
||||
"商品单位": "String",
|
||||
"商品的轮播图": [
|
||||
"String", "String"
|
||||
],
|
||||
"活动时间": "date",
|
||||
"策略类型": "String",
|
||||
"策略ID": "Long",
|
||||
"商品规格List": [ // activity_team_product_sku_info
|
||||
{
|
||||
"规格SKU": "String", // activity_team_product_sku_info.product_sku
|
||||
"拼团价格": "BigDecimal",
|
||||
"拼团库存": "Long"
|
||||
}
|
||||
],
|
||||
"排序": "Integer",
|
||||
"详情": "String"
|
||||
}
|
||||
|
||||
activity_team_info 团购活动表 -> ActivityTeamInfo(实体类)
|
||||
activity_team_info.id(主键) -> 自增 -> 回填 -> ActivityTeamInfo.id
|
||||
activity_team_info.name(拼团名称) <- ActivityTeamInfo.name <- $.活动名称
|
||||
activity_team_info.product_id(商品ID) <- ActivityTeamInfo.productId <- $.商品ID
|
||||
activity_team_info.product_image(商品活动图) <- ActivityTeamInfo.productImage <- $.商品图片
|
||||
activity_team_info.introduction(活动简介) <- ActivityTeamInfo.introduction <- $.活动简介
|
||||
activity_team_info.unit(单位) <- ActivityTeamInfo.unit <- $.商品单位
|
||||
activity_team_info.image_list(轮播图) <- ActivityTeamInfo.imageList <- 商品的轮播图.toString(","拼接) <- $.商品的轮播图
|
||||
activity_team_info.end_time(活动结束时间) <- ActivityTeamInfo.endTime <- $.活动时间
|
||||
activity_team_info.sort(活动排序) <- ActivityTeamInfo.sort <- $.排序
|
||||
activity_team_info.content(活动详情) <- ActivityTeamInfo.content <- $.详情
|
||||
activity_team_info.status(活动状态) <- _sys_normal_disable.1(停用)
|
||||
activity_team_info.strategy_type(策略类型) <- ActivityTeamInfo.strategy_type <- $.策略类型
|
||||
activity_team_info.strategy_id(策略ID) <- ActivityTeamInfo.strategy_id <- $.策略ID
|
||||
|
||||
for(@商品规格 in 商品规格List)
|
||||
activity_team_product_sku_info 商品拼团规格信息表 -> ActivityTeamProductSkuInfo(实体类)
|
||||
activity_team_product_sku_info.id(主键) -> 自增 -> 回填 -> ActivityTeamProductSkuInfo.id
|
||||
activity_team_product_sku_info.team_id(活动ID) <- ActivityTeamProductSkuInfo.teamId <- ActivityTeamInfo.id
|
||||
activity_team_product_sku_info.product_id(商品ID) <- ActivityTeamProductSkuInfo.productId < $.商品ID
|
||||
activity_team_product_sku_info.product_sku(商品SKU) <- ActivityTeamProductSkuInfo.productSku <- @商品规格.规格SKU
|
||||
activity_team_product_sku_info.team_stock(拼团库存) <- ActivityTeamProductSkuInfo.teamStock <- @商品规格.拼团库存
|
||||
activity_team_product_sku_info.remain_stock(剩余库存) <- ActivityTeamProductSkuInfo.remainStock <- @商品规格.拼团库存
|
||||
activity_team_product_sku_info.team_price(拼团价格) <- ActivityTeamProductSkuInfo.teamPrice <- @商品规格.拼团价格
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"商品ID": "Long",
|
||||
"商品图片": "String",
|
||||
"活动名称": "String",
|
||||
"活动简介": "String",
|
||||
"商品单位": "String",
|
||||
"商品的轮播图": [
|
||||
"String", "String"
|
||||
],
|
||||
"活动时间": "date",
|
||||
"策略类型": "String",
|
||||
"策略ID": "Long",
|
||||
"商品规格List": [
|
||||
{
|
||||
"规格SKU": "String",
|
||||
"拼团价格": "BigDecimal",
|
||||
"拼团库存": "Long"
|
||||
}
|
||||
],
|
||||
"排序": "Integer",
|
||||
"详情": "String"
|
||||
}
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -33,7 +35,8 @@ spring:
|
|||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -4,6 +4,9 @@ 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.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoupdMoudel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
|
@ -53,7 +56,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private long sort;
|
||||
private Integer sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
|
@ -70,4 +73,44 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
* 策略ID
|
||||
*/
|
||||
private long strategyId;
|
||||
|
||||
/**
|
||||
* 公共添加模型,转换成添加对象
|
||||
* @param activityTeamInfoAddModel 添加模型
|
||||
* @return 添加对象
|
||||
*/
|
||||
public static ActivityTeamInfo addModelBuild(ActivityTeamInfoAddModel activityTeamInfoAddModel){
|
||||
return ActivityTeamInfo.builder()
|
||||
.name(activityTeamInfoAddModel.getName())
|
||||
.productId(activityTeamInfoAddModel.getProductId())
|
||||
.productImage(activityTeamInfoAddModel.getProductImage())
|
||||
.introduction(activityTeamInfoAddModel.getIntroduction())
|
||||
.unit(activityTeamInfoAddModel.getUnit())
|
||||
.imageList(activityTeamInfoAddModel.getImageList())
|
||||
.endTime(activityTeamInfoAddModel.getEndTime())
|
||||
.sort(activityTeamInfoAddModel.getSort())
|
||||
.content(activityTeamInfoAddModel.getContent())
|
||||
.status(activityTeamInfoAddModel.getStatus())
|
||||
.strategyType(activityTeamInfoAddModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoAddModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
public static ActivityTeamInfo updreq(ActivityTeamInfoupdMoudel activityTeamInfoupdMoudel){
|
||||
return ActivityTeamInfo.builder()
|
||||
.id(activityTeamInfoupdMoudel.getId())
|
||||
.name(activityTeamInfoupdMoudel.getName())
|
||||
.productId(activityTeamInfoupdMoudel.getProductId())
|
||||
.productImage(activityTeamInfoupdMoudel.getProductImage())
|
||||
.introduction(activityTeamInfoupdMoudel.getIntroduction())
|
||||
.unit(activityTeamInfoupdMoudel.getUnit())
|
||||
.imageList(activityTeamInfoupdMoudel.getImageList())
|
||||
.endTime(activityTeamInfoupdMoudel.getEndTime())
|
||||
.sort(activityTeamInfoupdMoudel.getSort())
|
||||
.content(activityTeamInfoupdMoudel.getContent())
|
||||
.status(activityTeamInfoupdMoudel.getStatus())
|
||||
.strategyType(activityTeamInfoupdMoudel.getStrategyType())
|
||||
.strategyId(activityTeamInfoupdMoudel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ 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.ActivityTeamProductSkuAddModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
|
@ -25,7 +26,7 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
private Long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
|
@ -46,4 +47,19 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 通过模型钢构件对象
|
||||
* @param activityTeamProductSkuAddModel 模型
|
||||
* @return 对象
|
||||
*/
|
||||
public static ActivityTeamProductSkuInfo modelBuild(ActivityTeamProductSkuAddModel activityTeamProductSkuAddModel) {
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.productId(activityTeamProductSkuAddModel.getProductId())
|
||||
.teamId(activityTeamProductSkuAddModel.getTeamId())
|
||||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 团购活动添加模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 09:38
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamInfoAddModel {
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
public static ActivityTeamInfoAddModel addReqBuild (ActivityTeamInfoSaveReq activityTeamInfoSaveReq){
|
||||
return ActivityTeamInfoAddModel.builder()
|
||||
.name(activityTeamInfoSaveReq.getName())
|
||||
.productId(activityTeamInfoSaveReq.getProductId())
|
||||
.productImage(activityTeamInfoSaveReq.getProductImage())
|
||||
.introduction(activityTeamInfoSaveReq.getIntroduction())
|
||||
.unit(activityTeamInfoSaveReq.getUnit())
|
||||
.imageList(activityTeamInfoSaveReq.getImageList())
|
||||
.endTime(activityTeamInfoSaveReq.getEndTime())
|
||||
.sort(activityTeamInfoSaveReq.getSort())
|
||||
.content(activityTeamInfoSaveReq.getContent())
|
||||
.status(activityTeamInfoSaveReq.getStatus())
|
||||
.strategyType(activityTeamInfoSaveReq.getStrategyType())
|
||||
.strategyId(activityTeamInfoSaveReq.getStrategyId())
|
||||
.activityTeamProductSkuAddModelList(
|
||||
activityTeamInfoSaveReq.getTeamProjectSkuInfoAddReqList()
|
||||
.stream()
|
||||
.map(addReq -> ActivityTeamProductSkuAddModel.addReqBuild(addReq, activityTeamInfoSaveReq::getProductId))
|
||||
.toList()
|
||||
).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 团购spu库存添加模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 09:36
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuAddModel {
|
||||
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String productSku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
private Long remainStock;
|
||||
|
||||
public static ActivityTeamProductSkuAddModel addReqBuild(TeamProjectSkuInfoAddReq teamProjectSkuInfoAddReq, Supplier<Long> productId){
|
||||
|
||||
return ActivityTeamProductSkuAddModel.builder()
|
||||
.productId(productId.get())
|
||||
.productSku(teamProjectSkuInfoAddReq.getProductSku())
|
||||
.teamStock(teamProjectSkuInfoAddReq.getTeamStock())
|
||||
.teamPrice(teamProjectSkuInfoAddReq.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -44,7 +44,7 @@ public class TeamProductDiscountPriceModel {
|
|||
* @return 优惠力度
|
||||
*/
|
||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||
TeamProductDiscountPriceModel.builder()
|
||||
return TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoSaveReq extends BaseEntity {
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddReqList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
}
|
|
@ -3,9 +3,10 @@ package com.muyu.marketing.domain.req;
|
|||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 添加的
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TeamProjectSkuInfoAddReq {
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private String productSku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -6,6 +6,7 @@ import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
package com.muyu.marketing.team.controller;
|
||||
|
||||
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoupdMoudel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoupdReq;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import com.muyu.marketing.domain.resp.ActivityTeamInfoByIdResp;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -26,7 +28,10 @@ import java.util.List;
|
|||
public class ActivityTeamController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;;
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询营销团购活动列表
|
||||
|
@ -44,4 +49,34 @@ public class ActivityTeamController {
|
|||
}}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购活动
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
* @return 结果集
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<String> save(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
||||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{teamId}")
|
||||
public Result<ActivityTeamInfoByIdResp> getByid(@PathVariable Long teamId){
|
||||
return Result.success(activityTeamInfoService.getupdId(teamId) ) ;
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/upd")
|
||||
public Result<String> upd( @RequestBody ActivityTeamInfoupdReq activityTeamInfoupdReq){
|
||||
boolean gettoupd = activityTeamInfoService.gettoupd(ActivityTeamInfoupdMoudel.updreq(activityTeamInfoupdReq));
|
||||
if(gettoupd){
|
||||
return Result.success("修改成功");
|
||||
}else{
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.muyu.marketing.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
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.*;
|
||||
import com.muyu.marketing.domain.resp.ActivityTeamInfoByIdResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -17,4 +18,14 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
|||
* @return 团购活动列表
|
||||
*/
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
|
||||
/**
|
||||
* 通过添加模型,去进行商品拼团活动的操作
|
||||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||
ActivityTeamInfoByIdResp getupdId(Long teamId);
|
||||
|
||||
boolean gettoupd( ActivityTeamInfoupdMoudel updsku);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ 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.ActivityTeamProductSkuAddModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
|
||||
|
@ -33,4 +34,11 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
*/
|
||||
public TeamProductStockModel getStock(Long teamId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购商品SKU
|
||||
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||
*/
|
||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,19 +4,22 @@ 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.exception.ServiceException;
|
||||
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.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuUpdReq;
|
||||
import com.muyu.marketing.domain.resp.ActivityTeamInfoByIdResp;
|
||||
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 org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -69,4 +72,104 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
tableDataInfo.setRows(activityTeamInfoListModels);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过添加模型,去进行商品拼团活动的操作
|
||||
*
|
||||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
@Override
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel) {
|
||||
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.addModelBuild(activityTeamInfoAddModel);
|
||||
Assert.isTrue(this.save(activityTeamInfo), StringUtils.format("团购活动添加失败:[{}]", activityTeamInfoAddModel));
|
||||
List<ActivityTeamProductSkuAddModel> teamProductSkuAddModelList = activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList();
|
||||
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfo.getId()));
|
||||
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityTeamInfoByIdResp getupdId(Long teamId) {
|
||||
ActivityTeamInfo byId = this.getById(teamId);
|
||||
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
|
||||
List<ActivityTeamProductSkuInfo> list = activityTeamProductSkuInfoService.list(queryWrapper);
|
||||
|
||||
List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddReqs = list.stream().map(activityTeamProductSkuInfo -> {
|
||||
TeamProjectSkuInfoAddReq build = TeamProjectSkuInfoAddReq.builder()
|
||||
.productSku(activityTeamProductSkuInfo.getProductSku())
|
||||
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||
.id(activityTeamProductSkuInfo.getId())
|
||||
.build();
|
||||
return build;
|
||||
}).toList();
|
||||
|
||||
return ActivityTeamInfoByIdResp.builder()
|
||||
.name(byId.getName())
|
||||
.name(byId.getName())
|
||||
.productId(byId.getProductId())
|
||||
.productImage(byId.getProductImage())
|
||||
.introduction(byId.getIntroduction())
|
||||
.unit(byId.getUnit())
|
||||
.imageList(byId.getImageList())
|
||||
.endTime(byId.getEndTime())
|
||||
.sort(byId.getSort())
|
||||
.teamProjectSkuInfoAddReqList(teamProjectSkuInfoAddReqs)
|
||||
.content(byId.getContent())
|
||||
.status(byId.getStatus())
|
||||
.strategyType(byId.getStrategyType())
|
||||
.strategyId(byId.getStrategyId())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
// private Long id;
|
||||
//
|
||||
// private String productSku;
|
||||
//
|
||||
// /**
|
||||
// * 拼团价格
|
||||
// */
|
||||
// private BigDecimal teamPrice;
|
||||
//
|
||||
// /**
|
||||
// * 拼团库存
|
||||
// */
|
||||
// private Long teamStock;
|
||||
|
||||
@Override
|
||||
public boolean gettoupd(ActivityTeamInfoupdMoudel updsku) {
|
||||
boolean updateById = this.updateById(ActivityTeamInfo.updreq(updsku));
|
||||
|
||||
|
||||
if(updateById){
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,updateById);
|
||||
List<ActivityTeamProductSkuInfo> list = this.activityTeamProductSkuInfoService.list(queryWrapper);
|
||||
|
||||
|
||||
// list.stream().map(
|
||||
// activityTeamProductSkuInfo -> {
|
||||
// TeamProjectSkuUpdReq build = TeamProjectSkuUpdReq.builder()
|
||||
// .id(activityTeamProductSkuInfo.getId())
|
||||
// .productSku(activityTeamProductSkuInfo.getProductSku())
|
||||
// .teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||
// .teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||
// .build();
|
||||
// return build;
|
||||
// }).toList();
|
||||
|
||||
|
||||
activityTeamProductSkuInfoService.saveBatch(list);
|
||||
|
||||
}
|
||||
return updateById;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpe
|
|||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamType, teamOpenType.code());
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ 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.ActivityTeamProductSkuAddModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
|
@ -12,7 +13,6 @@ 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;
|
||||
|
@ -64,4 +64,19 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
.remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L, Long::sum))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加团购商品SKU
|
||||
*
|
||||
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||
*/
|
||||
@Override
|
||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList) {
|
||||
if (activityTeamProductSkuAddModelList == null || activityTeamProductSkuAddModelList.isEmpty()) {
|
||||
throw new ServiceException("入参添加商品规格模型,不可为空");
|
||||
}
|
||||
this.saveBatch(
|
||||
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
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<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||
implements TeamStrategyExemptionService {
|
||||
|
|
|
@ -6,7 +6,7 @@ server:
|
|||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-marketing
|
||||
name: muyu-activity
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -16,16 +16,12 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AttributeGroupUpdResp {
|
||||
|
||||
/** 属性组编号 */
|
||||
private Long id;
|
||||
|
||||
/** 组名称 */
|
||||
private String name;
|
||||
|
||||
/** 状态 */
|
||||
private String states;
|
||||
|
||||
/**
|
||||
* 属性ID集合
|
||||
*/
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -16,10 +16,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 124.221.130.240:8848
|
||||
namespace: cloud-wang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue