Compare commits
4 Commits
master
...
1202/zhuyu
Author | SHA1 | Date |
---|---|---|
|
05168aaf28 | |
|
d23f85f6c8 | |
|
c788779d4c | |
|
67d1a4637b |
|
@ -0,0 +1,21 @@
|
|||
# 功能划分
|
||||
## 查看商品列表
|
||||
获取商品列表
|
||||
## 选择团购信息
|
||||
获取团购列表
|
||||
## 选择商品以及规格
|
||||
根据商品id查询规格列表
|
||||
选择商品规格信息
|
||||
## 加入团购
|
||||
填写拼团信息
|
||||
将拼团信息添加到团购执行表中
|
||||
## 完成付款
|
||||
付款接口
|
||||
|
||||
|
||||
### 商品详情页面
|
||||
1.商品详情
|
||||
2.商品评论
|
||||
3.商品商品规格
|
||||
4.商品详情
|
||||
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.common.core.constant;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/12/1 19:46
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
public class TeamOpenKeyConstants {
|
||||
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
public static final String TEAM_OPEN_KEY = "team_open_key:";
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.gateway.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.web.cors.reactive.CorsUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig
|
||||
{
|
||||
/**
|
||||
* 这里为支持的请求头,如果有自定义的header字段请自己添加
|
||||
*/
|
||||
private static final String ALLOWED_HEADERS = "X-Requested-With, Content-Type, Authorization, credential, X-XSRF-TOKEN, token, Admin-Token, App-Token";
|
||||
private static final String ALLOWED_METHODS = "GET,POST,PUT,DELETE,OPTIONS,HEAD";
|
||||
private static final String ALLOWED_ORIGIN = "*";
|
||||
private static final String ALLOWED_EXPOSE = "*";
|
||||
private static final String MAX_AGE = "18000L";
|
||||
|
||||
@Bean
|
||||
public WebFilter corsFilter()
|
||||
{
|
||||
return (ServerWebExchange ctx, WebFilterChain chain) -> {
|
||||
ServerHttpRequest request = ctx.getRequest();
|
||||
if (CorsUtils.isCorsRequest(request))
|
||||
{
|
||||
ServerHttpResponse response = ctx.getResponse();
|
||||
HttpHeaders headers = response.getHeaders();
|
||||
headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS);
|
||||
headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
|
||||
headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN);
|
||||
headers.add("Access-Control-Expose-Headers", ALLOWED_EXPOSE);
|
||||
headers.add("Access-Control-Max-Age", MAX_AGE);
|
||||
headers.add("Access-Control-Allow-Credentials", "true");
|
||||
if (request.getMethod() == HttpMethod.OPTIONS)
|
||||
{
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
return Mono.empty();
|
||||
}
|
||||
}
|
||||
return chain.filter(ctx);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -33,7 +33,7 @@ spring:
|
|||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -3,15 +3,20 @@ 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.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoUpdModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
@ -52,6 +57,8 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
@ -112,7 +119,8 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
.strategyId(activityTeamInfoSaveModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
public static ActivityTeamInfo TeamUpdateBuild (ActivityTeamInfoUpdModel activityTeamInfoUpdModel){
|
||||
|
||||
public static ActivityTeamInfo updTeamInfoBuild(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
|
||||
return ActivityTeamInfo.builder()
|
||||
.id(activityTeamInfoUpdModel.getId())
|
||||
.name(activityTeamInfoUpdModel.getName())
|
||||
|
|
|
@ -3,12 +3,17 @@ 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.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
@ -21,11 +26,11 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
|||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
private Long id;
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
private Long teamId;
|
||||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
|
@ -33,7 +38,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
|||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
private String teamStrategyId;
|
||||
private Long teamStrategyId;
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
|
@ -41,11 +46,13 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
|||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String productId;
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
|
@ -57,7 +64,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
|||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
private String key;
|
||||
private String openKey;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuReqModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
|
@ -27,7 +29,7 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
private Long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
|
@ -74,4 +76,23 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static ActivityTeamProductSkuInfo updModelBuild(ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel) {
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.id(activityTeamProductSkuUpdModel.getId())
|
||||
.teamPrice(activityTeamProductSkuUpdModel.getTeamPrice())
|
||||
.teamStock(activityTeamProductSkuUpdModel.getTeamStock())
|
||||
.remainStock(activityTeamProductSkuUpdModel.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ActivityTeamProductSkuInfo buildAddSku(TeamProjectSkuInfoAddReq teamProjectSkuInfoAddReq) {
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.teamId(teamProjectSkuInfoAddReq.getTeamId())
|
||||
.productId(teamProjectSkuInfoAddReq.getProductId())
|
||||
.productSku(teamProjectSkuInfoAddReq.getSku())
|
||||
.teamPrice(teamProjectSkuInfoAddReq.getTeamPrice())
|
||||
.teamStock(teamProjectSkuInfoAddReq.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,15 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "team_strategy_exemption", autoResultMap = true)
|
||||
@TableName(value = "team_strategy_exemption_free", autoResultMap = true)
|
||||
public class TeamStrategyExemption extends BaseEntity {
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,9 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -55,7 +56,8 @@ public class ActivityTeamDetailModel {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
|
|
@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -53,7 +54,8 @@ public class ActivityTeamInfoAddModel {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
@ -29,6 +31,8 @@ public class ActivityTeamInfoListModel {
|
|||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private Long productId;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
|
@ -40,6 +44,8 @@ public class ActivityTeamInfoListModel {
|
|||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 开团人数
|
||||
|
@ -75,6 +81,7 @@ public class ActivityTeamInfoListModel {
|
|||
ActivityTeamInfoListModel activityTeamInfoListModel = ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.productId(activityTeamInfo.getProductId())
|
||||
// .openTeamNumber(teamOpenTypeNumber)
|
||||
// .addTeamNumber(teamInTypeNumber)
|
||||
// .attendNumber(teamOpenTypeNumber + teamInTypeNumber)
|
||||
|
@ -90,6 +97,7 @@ public class ActivityTeamInfoListModel {
|
|||
ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.productId(activityTeamInfo.getProductId())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -51,12 +52,13 @@ public class ActivityTeamInfoSaveModel {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
private Integer sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuUpdReq;
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -20,20 +24,62 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoUpdModel {
|
||||
|
||||
/** 主键自增 */
|
||||
private Long id;
|
||||
|
||||
/** 活动表名称 */
|
||||
private String name;
|
||||
|
||||
/** 主键商品id */
|
||||
private Long productId;
|
||||
|
||||
/** 商品图片 */
|
||||
private String productImage;
|
||||
|
||||
/** 活动介绍 */
|
||||
private String introduction;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 轮播图 */
|
||||
private String imageList;
|
||||
|
||||
/** 结束时间 */
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
|
||||
/** 排序 */
|
||||
private Long sort;
|
||||
|
||||
/** 主键介绍 */
|
||||
private String content;
|
||||
|
||||
/** 活动状态 */
|
||||
private String status;
|
||||
|
||||
/** 策略类型 */
|
||||
private String strategyType;
|
||||
|
||||
/** 策略id */
|
||||
private Long strategyId;
|
||||
private List<ActivityTeamProductSkuReqModel> activityTeamProductSkuModelList;
|
||||
|
||||
/**
|
||||
* 拼团商品sku集合
|
||||
*/
|
||||
private List<Long> teamProductSkuIds;
|
||||
|
||||
/**
|
||||
* 修改的活动商品sku集合
|
||||
*/
|
||||
private List<ActivityTeamProductSkuUpdReq> activityTeamProductSkuList;
|
||||
|
||||
/**
|
||||
* 新增的活动商品sku集合
|
||||
*/
|
||||
private List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddList;
|
||||
|
||||
public static ActivityTeamInfoUpdModel activityTeamInfoUpdReqModelBuild (ActivityTeamInfoUpdReq activityTeamInfoUpdReq){
|
||||
return ActivityTeamInfoUpdModel.builder()
|
||||
|
@ -50,7 +96,10 @@ public class ActivityTeamInfoUpdModel {
|
|||
.status(activityTeamInfoUpdReq.getStatus())
|
||||
.strategyType(activityTeamInfoUpdReq.getStrategyType())
|
||||
.strategyId(activityTeamInfoUpdReq.getStrategyId())
|
||||
.activityTeamProductSkuModelList(activityTeamInfoUpdReq.getActivityTeamProductSkuList().stream().map(ActivityTeamProductSkuReqModel::activityTeamProductSkuReqModelBuild).toList())
|
||||
.teamProductSkuIds(activityTeamInfoUpdReq.getTeamProductSkuIds())
|
||||
.activityTeamProductSkuList(activityTeamInfoUpdReq.getActivityTeamProductSkuList())
|
||||
.teamProjectSkuInfoAddList(activityTeamInfoUpdReq.getTeamProjectSkuInfoAddList())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuUpdReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -34,4 +35,12 @@ public class ActivityTeamProductSkuUpdModel {
|
|||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static ActivityTeamProductSkuUpdModel skuUpdBuild(ActivityTeamProductSkuUpdReq activityTeamProductSkuUpdReq) {
|
||||
return ActivityTeamProductSkuUpdModel.builder()
|
||||
.id(activityTeamProductSkuUpdReq.getId())
|
||||
.teamPrice(activityTeamProductSkuUpdReq.getTeamPrice())
|
||||
.teamStock(activityTeamProductSkuUpdReq.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -46,7 +47,8 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -19,18 +21,61 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoUpdReq {
|
||||
|
||||
/** 主键自增 */
|
||||
private Long id;
|
||||
|
||||
/** 活动表名称 */
|
||||
private String name;
|
||||
|
||||
/** 主键商品id */
|
||||
private Long productId;
|
||||
|
||||
/** 商品图片 */
|
||||
private String productImage;
|
||||
|
||||
/** 活动简介 */
|
||||
private String introduction;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 轮播图 */
|
||||
private String imageList;
|
||||
|
||||
/** 结束时间 */
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
|
||||
/** 排序 */
|
||||
private Long sort;
|
||||
|
||||
/** 详情 */
|
||||
private String content;
|
||||
|
||||
/** 活动状态 */
|
||||
private String status;
|
||||
|
||||
/** 策略类型 */
|
||||
private String strategyType;
|
||||
|
||||
/** 策略id */
|
||||
private Long strategyId;
|
||||
private List<ActivityTeamProductSkuReq> activityTeamProductSkuList;
|
||||
|
||||
/**
|
||||
* 拼团商品sku集合
|
||||
*/
|
||||
private List<Long> teamProductSkuIds;
|
||||
|
||||
/**
|
||||
* 修改的活动商品sku集合
|
||||
*/
|
||||
private List<ActivityTeamProductSkuUpdReq> activityTeamProductSkuList;
|
||||
|
||||
/**
|
||||
* 新增的活动商品sku集合
|
||||
*/
|
||||
private List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddList;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/27 16:49
|
||||
*
|
||||
* 修改活动商品sku的req
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamProductSkuUpdReq {
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 团购价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.math.BigDecimal;
|
|||
|
||||
/**
|
||||
* 添加的
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
|
@ -16,6 +17,16 @@ import java.math.BigDecimal;
|
|||
@NoArgsConstructor
|
||||
public class TeamProjectSkuInfoAddReq {
|
||||
|
||||
/**
|
||||
* 活动id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
|
@ -30,4 +41,6 @@ public class TeamProjectSkuInfoAddReq {
|
|||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -52,7 +53,8 @@ public class ActivityTeamDetailResp extends BaseEntity {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
|
|
@ -2,11 +2,11 @@ package com.muyu.marketing.domain.resp;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamDetailModel;
|
||||
import com.muyu.marketing.domain.req.ProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -55,7 +55,8 @@ public class TeamInfoFindByIdResp {
|
|||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
@ -24,6 +26,9 @@ public class TeamInfoListResp {
|
|||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
|
@ -35,6 +40,8 @@ public class TeamInfoListResp {
|
|||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 开团人数
|
||||
|
@ -74,6 +81,7 @@ public class TeamInfoListResp {
|
|||
return TeamInfoListResp.builder()
|
||||
.id(activityTeamInfoListModel.getId())
|
||||
.name(activityTeamInfoListModel.getName())
|
||||
.productId(activityTeamInfoListModel.getProductId())
|
||||
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
|
|
|
@ -3,6 +3,7 @@ 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.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.muyu.marketing.team.mapper")
|
||||
public class MuYuMarketIngApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuMarketIngApplication.class, args);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.muyu.marketing.team.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoUpdModel;
|
||||
|
@ -13,6 +15,7 @@ import com.muyu.marketing.domain.resp.TeamInfoFindByIdResp;
|
|||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -28,10 +31,11 @@ import java.util.List;
|
|||
public class ActivityTeamController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;;
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
/**
|
||||
* 查询营销团购活动列表
|
||||
*
|
||||
* @param teamInfoListReq 活动查询入参
|
||||
* @return 活动响应结果
|
||||
*/
|
||||
|
@ -40,16 +44,16 @@ public class ActivityTeamController {
|
|||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList();
|
||||
return Result.success(
|
||||
new TableDataInfo<>(){{
|
||||
new TableDataInfo<>() {{
|
||||
setRows(respList);
|
||||
setTotal(tableDataInfo.getTotal());
|
||||
setTotal(respList.size());
|
||||
}}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购活动
|
||||
*
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
* @return 结果集
|
||||
*/
|
||||
|
@ -60,12 +64,31 @@ public class ActivityTeamController {
|
|||
}
|
||||
|
||||
@PostMapping("/findById/{id}")
|
||||
public Result<TeamInfoFindByIdResp> findTeamById(@PathVariable Long id){
|
||||
public Result<TeamInfoFindByIdResp> findTeamById(@PathVariable Long id) {
|
||||
return Result.success(TeamInfoFindByIdResp.teamInfoFindByIdBuild(activityTeamInfoService.findDetailById(id)));
|
||||
}
|
||||
@PutMapping("/updateByTeamId")
|
||||
public Result updateByTeamId(@RequestBody ActivityTeamInfoUpdReq activityTeamInfoUpdReq){
|
||||
|
||||
/**
|
||||
* 修改拼团活动信息
|
||||
*
|
||||
* @param activityTeamInfoUpdReq
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/updateActivityTeamInfo")
|
||||
public Result<?> updateByTeamId(@RequestBody ActivityTeamInfoUpdReq activityTeamInfoUpdReq) {
|
||||
activityTeamInfoService.update(ActivityTeamInfoUpdModel.activityTeamInfoUpdReqModelBuild(activityTeamInfoUpdReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品ID查询活动列表
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getTeamListByProductId/{id}")
|
||||
public Result<List<ActivityTeamInfo>> getTeamListByProductId(@PathVariable Long id){
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamInfo::getProductId,id);
|
||||
return Result.success(this.activityTeamInfoService.list(queryWrapper));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.marketing.team.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/12/1 10:37
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("teamOpen")
|
||||
public class ActivityTeamOpenController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamStrategy activityTeamStrategy;
|
||||
|
||||
/**
|
||||
* 开团
|
||||
* @param activityTeamId
|
||||
* @param teamProjectSkuId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("openTeam/{activityTeamId}/{teamProjectSkuId}")
|
||||
public Result<?> openTeam(@PathVariable Long activityTeamId,@PathVariable Long teamProjectSkuId){
|
||||
activityTeamStrategy.openTeam(activityTeamId,teamProjectSkuId);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -2,10 +2,11 @@ package com.muyu.marketing.team.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.marketing.team.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||
|
|
|
@ -5,6 +5,9 @@ import com.muyu.marketing.domain.TeamStrategyExemption;
|
|||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
|
||||
|
||||
|
@ -33,7 +36,6 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
|||
* @param activityTeamInfoUpdModel 团购活动信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
||||
|
||||
public void update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,13 @@ package com.muyu.marketing.team.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,15 +2,18 @@ package com.muyu.marketing.team.service;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||
|
||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId){
|
||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
|
@ -19,6 +22,7 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
|
||||
/**
|
||||
* 通过团购活动ID获取团购中最优惠的价格
|
||||
*
|
||||
* @param teamId 团购ID
|
||||
* @return 优惠价格
|
||||
*/
|
||||
|
@ -27,6 +31,7 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
|
||||
/**
|
||||
* 通过活动ID获取 剩余库存
|
||||
*
|
||||
* @param teamId 活动ID
|
||||
* @return 库存
|
||||
*/
|
||||
|
@ -35,17 +40,50 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
|
||||
/**
|
||||
* 添加团购商品SKU
|
||||
*
|
||||
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||
*/
|
||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||
|
||||
/**
|
||||
* 通过拼团活动ID获取拼团下商品SKU集合
|
||||
*
|
||||
* @param teamId 活动ID
|
||||
* @return 拼团商品SKU集合
|
||||
*/
|
||||
public List<ActivityTeamProductSkuModel> findListByTeamId(Long teamId);
|
||||
|
||||
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList);
|
||||
/**
|
||||
* 修改团购商品sku信息
|
||||
*
|
||||
* @param activityTeamProductSkuUpdModel
|
||||
* @return
|
||||
*/
|
||||
public boolean update(ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel);
|
||||
|
||||
/**
|
||||
* 修改团购商品sku信息(批量修改)
|
||||
*
|
||||
* @param activityTeamProductSkuUpdModelList
|
||||
* @return
|
||||
*/
|
||||
public void batchUpdate(List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList);
|
||||
|
||||
/**
|
||||
* 根据活动id和商品id获取活动商品sku的集合
|
||||
*
|
||||
* @param teamId
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
public Result<List<ActivityTeamProductSkuModel>> findListByTeamIdAndProductId(Long teamId, Long productId);
|
||||
|
||||
/**
|
||||
* 根据ID获取团购商品SKU信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public Result<ActivityTeamProductSkuInfo> findById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,12 @@ package com.muyu.marketing.team.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
|
||||
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred> {
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface TeamStrategyExemptionHundredService extends ActivityTeamStrategy, IService<TeamStrategyExemptionHundred> {
|
||||
|
||||
public void addTeam(Long teamId, String orderNumber);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.muyu.marketing.team.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
|
||||
public interface TeamStrategyExemptionOrdinaryService extends IService<TeamStrategyExemptionOrdinary> {
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface TeamStrategyExemptionOrdinaryService extends ActivityTeamStrategy, IService<TeamStrategyExemptionOrdinary> {
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@ package com.muyu.marketing.team.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
|
||||
public interface TeamStrategyExemptionService extends IService<TeamStrategyExemption> {
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
* 免单
|
||||
*/
|
||||
public interface TeamStrategyExemptionService extends ActivityTeamStrategy,IService<TeamStrategyExemption> {
|
||||
}
|
||||
|
|
|
@ -3,24 +3,29 @@ package com.muyu.marketing.team.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.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.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuUpdReq;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||
implements ActivityTeamInfoService {
|
||||
implements ActivityTeamInfoService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
@ -81,6 +86,7 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
|
||||
/**
|
||||
* 根据ID查询商品的详情
|
||||
*
|
||||
* @param id 团购活动ID
|
||||
* @return 团购详情
|
||||
*/
|
||||
|
@ -95,14 +101,37 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
|
||||
/**
|
||||
* 修改团购活动信息
|
||||
*
|
||||
* @param activityTeamInfoUpdModel 团购活动信息
|
||||
* @return 是否成功
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
|
||||
boolean update = this.updateById(ActivityTeamInfo.TeamUpdateBuild(activityTeamInfoUpdModel));
|
||||
io.jsonwebtoken.lang.Assert.isTrue(update,"修改失败");
|
||||
activityTeamProductSkuInfoService.updateBath(activityTeamInfoUpdModel.getActivityTeamProductSkuModelList());
|
||||
return update;
|
||||
@Transactional(rollbackFor = {ServiceException.class})
|
||||
public void update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
|
||||
//判断活动状态是否是关闭状态
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamInfo::getId,activityTeamInfoUpdModel.getId());
|
||||
ActivityTeamInfo activityTeamInfo = this.getOne(queryWrapper);
|
||||
if ("已开启".equals(activityTeamInfo.getStatus())){
|
||||
throw new ServiceException("活动已开启,无法修改");
|
||||
}
|
||||
//修改拼团活动表信息
|
||||
this.updateById(ActivityTeamInfo.updTeamInfoBuild(activityTeamInfoUpdModel));
|
||||
//根据根据前台传过来的skuIds集合,批量删除团购商品sku集合
|
||||
activityTeamProductSkuInfoService.removeBatchByIds(activityTeamInfoUpdModel.getTeamProductSkuIds());
|
||||
//批量添加团购商品sku集合
|
||||
activityTeamProductSkuInfoService.saveBatch(
|
||||
//将activityTeamInfoUpdModel类型转成ActivityTeamProductSkuInfo类型集合
|
||||
activityTeamInfoUpdModel.getTeamProjectSkuInfoAddList().stream()
|
||||
.map(ActivityTeamProductSkuInfo::buildAddSku)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
//根据activityTeamProductSkuList集合,批量修改团购商品sku集合
|
||||
List<ActivityTeamProductSkuUpdReq> activityTeamProductSkuList = activityTeamInfoUpdModel.getActivityTeamProductSkuList();
|
||||
activityTeamProductSkuInfoService.batchUpdate(
|
||||
activityTeamProductSkuList.stream()
|
||||
.map(ActivityTeamProductSkuUpdModel::skuUpdBuild)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,23 @@ package com.muyu.marketing.team.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Service
|
||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
||||
implements ActivityTeamOpenInfoService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoMapper activityTeamOpenInfoMapper;
|
||||
|
||||
/**
|
||||
* 通过活动ID和开团类型查询开团数量
|
||||
*
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.muyu.marketing.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
|
@ -19,10 +21,11 @@ import java.util.ArrayList;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
@ -44,7 +47,7 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||
|
||||
if (discountPriceModelOptional.isEmpty()){
|
||||
if (discountPriceModelOptional.isEmpty()) {
|
||||
throw new ServiceException("团购活动下没有商品绑定");
|
||||
}
|
||||
return discountPriceModelOptional.get();
|
||||
|
@ -89,15 +92,68 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
@Override
|
||||
public List<ActivityTeamProductSkuModel> findListByTeamId(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
List<ActivityTeamProductSkuInfo> list = this.list(queryWrapper);
|
||||
return list.stream().map(ActivityTeamProductSkuModel::FindBuild).toList();
|
||||
// return list.stream().map(activityTeamProductSkuInfo -> ActivityTeamProductSkuModel.FindBuild(activityTeamProductSkuInfo)).toList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
/**
|
||||
* 修改团购商品sku信息(单个信息修改)
|
||||
*
|
||||
* @param activityTeamProductSkuUpdModel
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList) {
|
||||
return this.updateBatchById(activityTeamProductSkuReqModelList.stream().map(ActivityTeamProductSkuInfo::updateModelBuild).toList());
|
||||
public boolean update(ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel) {
|
||||
LambdaUpdateWrapper<ActivityTeamProductSkuInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamPrice, activityTeamProductSkuUpdModel.getTeamPrice());
|
||||
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamStock, activityTeamProductSkuUpdModel.getTeamStock());
|
||||
updateWrapper.eq(ActivityTeamProductSkuInfo::getId, activityTeamProductSkuUpdModel.getId());
|
||||
return this.update(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团购商品sku信息(批量修改)
|
||||
*
|
||||
* @param activityTeamProductSkuUpdModelList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void batchUpdate(List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList) {
|
||||
List<ActivityTeamProductSkuInfo> teamProductSkuInfos = activityTeamProductSkuUpdModelList.stream()
|
||||
.map(ActivityTeamProductSkuInfo::updModelBuild)
|
||||
.toList();
|
||||
this.updateBatchById(teamProductSkuInfos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动id和商品id获取活动商品sku的集合
|
||||
*
|
||||
* @param teamId
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<List<ActivityTeamProductSkuModel>> findListByTeamIdAndProductId(Long teamId, Long productId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getProductId, productId);
|
||||
List<ActivityTeamProductSkuInfo> list = this.list(queryWrapper);
|
||||
List<ActivityTeamProductSkuModel> activityTeamProductSkuModels = list.stream().map(ActivityTeamProductSkuModel::FindBuild).toList();
|
||||
return Result.success(activityTeamProductSkuModels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取团购商品sku信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<ActivityTeamProductSkuInfo> findById(Long id) {
|
||||
ActivityTeamProductSkuInfo teamProductSkuInfo = this.getById(id);
|
||||
return Result.success(teamProductSkuInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,134 @@
|
|||
package com.muyu.marketing.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.common.core.constant.TeamOpenKeyConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.uuid.UUID;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.marketing.domain.*;
|
||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionHundredMapper;
|
||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
|
||||
import com.muyu.marketing.team.service.TeamStrategyExemptionHundredService;
|
||||
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
|
||||
import com.muyu.marketing.team.service.*;
|
||||
import com.muyu.product.cache.ProjectInfoCache;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Log4j2
|
||||
@Service("team-strategy-hundred")
|
||||
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
|
||||
implements TeamStrategyExemptionHundredService {
|
||||
implements TeamStrategyExemptionHundredService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
@Autowired
|
||||
private ProjectInfoCache projectInfoCache;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 开团-百人团
|
||||
*
|
||||
* @param activityTeamId 团购活动id
|
||||
* @param activityTeamId 活动商品规格的id
|
||||
*/
|
||||
@Override
|
||||
public void openTeam(Long activityTeamId,Long teamProjectSkuId) {
|
||||
//添加拼团活动执行表
|
||||
ActivityTeamOpenInfo teamOpenInfo = new ActivityTeamOpenInfo();
|
||||
teamOpenInfo.setTeamId(activityTeamId);
|
||||
teamOpenInfo.setTeamType("百人团");
|
||||
//根据团购活动id查询活动表获取团购策略id
|
||||
ActivityTeamInfo teamInfo = activityTeamInfoService.getById(activityTeamId);
|
||||
teamOpenInfo.setTeamStrategyId(teamInfo.getStrategyId());
|
||||
//参团类型
|
||||
teamOpenInfo.setExecutiveType("开团");
|
||||
//拿到活动结束时间
|
||||
teamOpenInfo.setEndTime(teamInfo.getEndTime());
|
||||
//根据活动对象获取商品信息
|
||||
teamOpenInfo.setProductId(teamInfo.getProductId());
|
||||
ProjectInfo projectInfo = projectInfoCache.get(teamInfo.getProductId());
|
||||
teamOpenInfo.setProductName(projectInfo.getName());
|
||||
//根据活动商品sku的id查询列表,获取商品sku信息
|
||||
Result<ActivityTeamProductSkuInfo> teamProductSkuInfo = activityTeamProductSkuInfoService.findById(teamProjectSkuId);
|
||||
teamOpenInfo.setProductSku(teamProductSkuInfo.getData().getProductSku());
|
||||
//生成开团标识
|
||||
String key = UUID.randomUUID().toString();
|
||||
teamOpenInfo.setOpenKey(key);
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
teamOpenInfo.setCreateBy(loginUser.getUsername());
|
||||
//执行开团操作
|
||||
boolean save = this.activityTeamOpenInfoService.save(teamOpenInfo);
|
||||
//最后把开团标识存进redis(团购id+用户id+团购活动id,key)
|
||||
if (save){
|
||||
redisTemplate.opsForValue().set(TeamOpenKeyConstants.TEAM_OPEN_KEY+
|
||||
teamOpenInfo.getId()+":"+loginUser.getUserid()+":"
|
||||
+teamOpenInfo.getTeamId(),key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请加团,得到申请的令牌
|
||||
*
|
||||
* @param teamId 团id
|
||||
*/
|
||||
@Override
|
||||
public void applyTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 参团
|
||||
* 需要拿到开团标识
|
||||
*
|
||||
* @param teamId 团id
|
||||
* @param orderNumber 订单编号
|
||||
*/
|
||||
@Override
|
||||
public void addTeam(Long teamId, String orderNumber) {
|
||||
//添加拼团活动执行表
|
||||
ActivityTeamOpenInfo teamOpenInfo = new ActivityTeamOpenInfo();
|
||||
teamOpenInfo.setTeamId(teamId);
|
||||
teamOpenInfo.setTeamType("百人团");
|
||||
//根据团购活动id查询活动表获取团购策略id
|
||||
ActivityTeamInfo teamInfo = activityTeamInfoService.getById(teamId);
|
||||
teamOpenInfo.setTeamStrategyId(teamInfo.getStrategyId());
|
||||
//参团类型
|
||||
teamOpenInfo.setExecutiveType("参团");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退团
|
||||
*
|
||||
* @param teamId
|
||||
*/
|
||||
@Override
|
||||
public void exitTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算团
|
||||
*
|
||||
* @param teamId
|
||||
*/
|
||||
@Override
|
||||
public void settleTeam(Long teamId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,44 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionOrdinaryMapper;
|
||||
import com.muyu.marketing.team.service.TeamStrategyExemptionOrdinaryService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Log4j2
|
||||
@Service("team-strategy-ordinary")
|
||||
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
|
||||
implements TeamStrategyExemptionOrdinaryService {
|
||||
|
||||
/**
|
||||
* 开团-普通团
|
||||
* @param activityTeamId 团购活动id
|
||||
* @param teamProjectSkuId 团购活动商品规格id
|
||||
*/
|
||||
@Override
|
||||
public void openTeam(Long activityTeamId,Long teamProjectSkuId) {
|
||||
log.info("参加-普通团-[{}]", activityTeamId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeam(Long teamId, String orderNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settleTeam(Long teamId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,39 @@ 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 lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
@Log4j2
|
||||
@Service("team-strategy-free")
|
||||
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||
implements TeamStrategyExemptionService {
|
||||
|
||||
@Override
|
||||
public void openTeam(Long activityTeamId,Long teamProjectSkuId) {
|
||||
log.info("参加-免单团-[{}]",activityTeamId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeam(Long teamId, String orderNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settleTeam(Long teamId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.marketing.team.strategy;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/29 16:49
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
public interface ActivityTeamStrategy {
|
||||
|
||||
/**
|
||||
* 开团
|
||||
*
|
||||
* @param activityTeamId 团购活动id
|
||||
* @param teamProjectSkuId 团购活动商品规格id
|
||||
*/
|
||||
public void openTeam(Long activityTeamId,Long teamProjectSkuId);
|
||||
|
||||
/**
|
||||
* 申请加团
|
||||
*
|
||||
* @param teamId 团id
|
||||
*/
|
||||
public void applyTeam(Long teamId);
|
||||
|
||||
/**
|
||||
* 参团
|
||||
*
|
||||
* @param teamId 团id
|
||||
* @param orderNumber 订单编号
|
||||
*/
|
||||
public void addTeam(Long teamId, String orderNumber);
|
||||
|
||||
/**
|
||||
* 退出团
|
||||
*
|
||||
* @param teamId
|
||||
*/
|
||||
public void exitTeam(Long teamId);
|
||||
|
||||
/**
|
||||
* 结算团
|
||||
*
|
||||
* @param teamId
|
||||
*/
|
||||
public void settleTeam(Long teamId);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.marketing.team.strategy.impl;
|
||||
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/12/1 14:58
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@Service
|
||||
@Primary
|
||||
public class ActivityTeamStrategyImpl implements ActivityTeamStrategy {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
/**
|
||||
* 开团
|
||||
* @param activityTeamId 团购活动id
|
||||
* @param teamProjectSkuId 团购活动商品规格id
|
||||
*/
|
||||
@Override
|
||||
public void openTeam(Long activityTeamId,Long teamProjectSkuId) {
|
||||
//先根据活动id查询活动的拼团类型
|
||||
ActivityTeamInfo teamInfo = activityTeamInfoService.getById(activityTeamId);
|
||||
//获取活动拼团类型
|
||||
String teamStrategyType = teamInfo.getStrategyType();
|
||||
//根据不同的拼团类型,调用不同的策略类
|
||||
ActivityTeamStrategy activityTeamStrategy = SpringUtils.getBean(teamStrategyType);
|
||||
activityTeamStrategy.openTeam(activityTeamId,teamProjectSkuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTeam(Long teamId, String orderNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitTeam(Long teamId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settleTeam(Long teamId) {
|
||||
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ server:
|
|||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-buy
|
||||
name: muyu-team
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.test;
|
||||
|
||||
import com.muyu.marketing.MuYuMarketIngApplication;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/12/1 15:22
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@SpringBootTest(classes = MuYuMarketIngApplication.class)
|
||||
public class StrategyTest {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamStrategy activityTeamStrategy;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
activityTeamStrategy.openTeam(0L);
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
@RestController
|
||||
@RequestMapping("/info")
|
||||
public class ProjectInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ProjectInfoService projectInfoService;
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -16,10 +16,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.46.147.226:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue