fix():团购策略

1127/chenzhixv
DongZeLiang 2024-11-29 15:46:06 +08:00
parent 02f640092a
commit b6c4a790d7
43 changed files with 636 additions and 103 deletions

0
doc/策略.md 100644
View File

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -33,7 +33,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
dataId: sentinel-muyu-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -5,7 +5,9 @@ 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 com.muyu.marketing.domain.model.ActivityTeamProductSkuModel;
import com.muyu.marketing.domain.model.ActivityTeamProductSkuReqModel;
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
import lombok.*;
import lombok.experimental.SuperBuilder;
@ -74,4 +76,13 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
.build();
}
public static ActivityTeamProductSkuInfo updModelBuild(ActivityTeamProductSkuUpdModel teamProductSkuUpdModel){
return ActivityTeamProductSkuInfo.builder()
.id(teamProductSkuUpdModel.getId())
.teamPrice(teamProductSkuUpdModel.getTeamPrice())
.teamStock(teamProductSkuUpdModel.getTeamStock())
.remainStock(teamProductSkuUpdModel.getTeamStock())
.build();
}
}

View File

@ -13,7 +13,7 @@ import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
public class TeamStrategyExemptionHundred extends BaseEntity {
public class TeamStrategyHundred extends BaseEntity {
/**
*

View File

@ -13,7 +13,7 @@ import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
public class TeamStrategyExemptionOrdinary extends BaseEntity {
public class TeamStrategyOrdinary extends BaseEntity {
/**
*

View File

@ -58,7 +58,7 @@ public class ActivityTeamInfoAddModel {
/**
*
*/
private Integer sort;
private Long sort;
/**
* SkU
*/

View File

@ -1,11 +1,15 @@
package com.muyu.marketing.domain.model;
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdReq;
import com.muyu.marketing.domain.req.ActivityTeamProductSkuSettingReq;
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
import com.muyu.marketing.domain.req.TeamProjectSkuInfoUpdReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -33,7 +37,7 @@ public class ActivityTeamInfoUpdModel {
private String status;
private String strategyType;
private Long strategyId;
private List<ActivityTeamProductSkuReqModel> activityTeamProductSkuModelList;
private ActivityTeamProductSkuSettingModel activityTeamProductSkuSettingModel;
public static ActivityTeamInfoUpdModel activityTeamInfoUpdReqModelBuild (ActivityTeamInfoUpdReq activityTeamInfoUpdReq){
return ActivityTeamInfoUpdModel.builder()
@ -50,7 +54,12 @@ public class ActivityTeamInfoUpdModel {
.status(activityTeamInfoUpdReq.getStatus())
.strategyType(activityTeamInfoUpdReq.getStrategyType())
.strategyId(activityTeamInfoUpdReq.getStrategyId())
.activityTeamProductSkuModelList(activityTeamInfoUpdReq.getActivityTeamProductSkuList().stream().map(ActivityTeamProductSkuReqModel::activityTeamProductSkuReqModelBuild).toList())
.activityTeamProductSkuSettingModel(
ActivityTeamProductSkuSettingModel.settingReqModel(
activityTeamInfoUpdReq.getActivityTeamProductSkuSettingReq(),
activityTeamInfoUpdReq::getProductId
)
)
.build();
}
}

View File

@ -0,0 +1,59 @@
package com.muyu.marketing.domain.model;
import com.muyu.marketing.domain.req.ActivityTeamProductSkuSettingReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.function.Supplier;
/**
*
*
* @author DongZeLiang
* @date 2024-11-28 11:15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivityTeamProductSkuSettingModel {
/**
* ID
*/
private Long teamId;
/**
* ID
*/
private List<Long> removeIds;
/**
*
*/
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList;
/**
*
*/
private List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList;
public static ActivityTeamProductSkuSettingModel settingReqModel(ActivityTeamProductSkuSettingReq activityTeamProductSkuSettingReq, Supplier<Long> productId) {
return ActivityTeamProductSkuSettingModel.builder()
.removeIds(activityTeamProductSkuSettingReq.getRemoveIds())
.activityTeamProductSkuAddModelList(
activityTeamProductSkuSettingReq.getTeamProjectSkuInfoAddReqList().stream()
.map(teamProjectSkuInfoAddReq -> ActivityTeamProductSkuAddModel.addReqBuild(teamProjectSkuInfoAddReq, productId))
.toList()
)
.activityTeamProductSkuUpdModelList(
activityTeamProductSkuSettingReq.getTeamProjectSkuInfoUpdReqList().stream()
.map(ActivityTeamProductSkuUpdModel::updReqBuild)
.toList()
).build();
}
}

View File

@ -1,6 +1,7 @@
package com.muyu.marketing.domain.model;
import com.muyu.marketing.domain.req.TeamProjectSkuInfoUpdReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -34,4 +35,12 @@ public class ActivityTeamProductSkuUpdModel {
*
*/
private Long teamStock;
public static ActivityTeamProductSkuUpdModel updReqBuild(TeamProjectSkuInfoUpdReq teamProjectSkuInfoUpdReq){
return ActivityTeamProductSkuUpdModel.builder()
.id(teamProjectSkuInfoUpdReq.getId())
.teamStock(teamProjectSkuInfoUpdReq.getTeamStock())
.teamPrice(teamProjectSkuInfoUpdReq.getTeamPrice())
.build();
}
}

View File

@ -51,7 +51,7 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
/**
*
*/
private Integer sort;
private Long sort;
/**
* SkU
*/

View File

@ -32,5 +32,5 @@ public class ActivityTeamInfoUpdReq {
private String status;
private String strategyType;
private Long strategyId;
private List<ActivityTeamProductSkuReq> activityTeamProductSkuList;
private ActivityTeamProductSkuSettingReq activityTeamProductSkuSettingReq;
}

View File

@ -0,0 +1,37 @@
package com.muyu.marketing.domain.req;
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
*
*
* @author DongZeLiang
* @date 2024-11-28 11:27
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivityTeamProductSkuSettingReq {
/**
* ID
*/
private List<Long> removeIds;
/**
*
*/
private List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddReqList;
/**
*
*/
private List<TeamProjectSkuInfoUpdReq> teamProjectSkuInfoUpdReqList;
}

View File

@ -0,0 +1,33 @@
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 TeamProjectSkuInfoUpdReq {
/**
* SKU
*/
private Long id;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -2,8 +2,6 @@ package com.muyu.marketing.team.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import org.apache.ibatis.annotations.Mapper;
@Mapper

View File

@ -1,11 +0,0 @@
package com.muyu.marketing.team.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyExemption;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
}

View File

@ -1,11 +0,0 @@
package com.muyu.marketing.team.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper<TeamStrategyExemptionOrdinary> {
}

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.team.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyHundred;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyHundredMapper extends BaseMapper<TeamStrategyHundred> {
}

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.team.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyOrdinary;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyOrdinaryMapper extends BaseMapper<TeamStrategyOrdinary> {
}

View File

@ -3,7 +3,6 @@ package com.muyu.marketing.team.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.domain.model.*;
import java.util.List;
@ -48,4 +47,27 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList);
/**
*
* @param activityTeamProductSkuUpdModel
* @return
*/
public boolean update(ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel);
/**
*
* @param activityTeamProductSkuUpdModelList
* @return
*/
public boolean batchUpdate(List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList);
/**
*
* @param activityTeamProductSkuSettingModel
*/
public default void setting(ActivityTeamProductSkuSettingModel activityTeamProductSkuSettingModel){
this.batchSave(activityTeamProductSkuSettingModel.getActivityTeamProductSkuAddModelList());
this.batchUpdate(activityTeamProductSkuSettingModel.getActivityTeamProductSkuUpdModelList());
this.removeByIds(activityTeamProductSkuSettingModel.getRemoveIds());
}
}

View File

@ -1,8 +0,0 @@
package com.muyu.marketing.team.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred> {
}

View File

@ -1,7 +0,0 @@
package com.muyu.marketing.team.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
public interface TeamStrategyExemptionOrdinaryService extends IService<TeamStrategyExemptionOrdinary> {
}

View File

@ -2,7 +2,10 @@ 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> {
/**
*
*/
public interface TeamStrategyExemptionService extends ActivityTeamStrategy, IService<TeamStrategyExemption> {
}

View File

@ -0,0 +1,11 @@
package com.muyu.marketing.team.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyHundred;
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
/**
*
*/
public interface TeamStrategyHundredService extends ActivityTeamStrategy, IService<TeamStrategyHundred> {
}

View File

@ -0,0 +1,11 @@
package com.muyu.marketing.team.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyOrdinary;
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
/**
*
*/
public interface TeamStrategyOrdinaryService extends ActivityTeamStrategy, IService<TeamStrategyOrdinary> {
}

View File

@ -101,8 +101,8 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
@Override
public boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
boolean update = this.updateById(ActivityTeamInfo.TeamUpdateBuild(activityTeamInfoUpdModel));
io.jsonwebtoken.lang.Assert.isTrue(update,"修改失败");
activityTeamProductSkuInfoService.updateBath(activityTeamInfoUpdModel.getActivityTeamProductSkuModelList());
Assert.isTrue(update,"修改失败");
activityTeamProductSkuInfoService.setting(activityTeamInfoUpdModel.getActivityTeamProductSkuSettingModel());
return update;
}
}

View File

@ -1,6 +1,7 @@
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.exception.ServiceException;
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
@ -100,4 +101,38 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList) {
return this.updateBatchById(activityTeamProductSkuReqModelList.stream().map(ActivityTeamProductSkuInfo::updateModelBuild).toList());
}
/**
*
*
* @param activityTeamProductSkuUpdModel
* @return
*/
@Override
public boolean update(ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel) {
// update set where
LambdaUpdateWrapper<ActivityTeamProductSkuInfo> updateWrapper = new LambdaUpdateWrapper<>();
// 字段=值
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamStock,activityTeamProductSkuUpdModel.getTeamStock());
updateWrapper.set(ActivityTeamProductSkuInfo::getRemainStock,activityTeamProductSkuUpdModel.getTeamStock());
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamPrice,activityTeamProductSkuUpdModel.getTeamPrice());
// id=
updateWrapper.eq(ActivityTeamProductSkuInfo::getId,activityTeamProductSkuUpdModel.getId());
return this.update(updateWrapper);
}
/**
*
*
* @param activityTeamProductSkuUpdModelList
* @return
*/
@Override
public boolean batchUpdate(List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList) {
return this.updateBatchById(
activityTeamProductSkuUpdModelList.stream()
.map(ActivityTeamProductSkuInfo::updModelBuild)
.toList()
);
}
}

View File

@ -1,16 +0,0 @@
package com.muyu.marketing.team.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyExemption;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.team.mapper.TeamStrategyExemptionHundredMapper;
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
import com.muyu.marketing.team.service.TeamStrategyExemptionHundredService;
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
import org.springframework.stereotype.Service;
@Service
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
implements TeamStrategyExemptionHundredService {
}

View File

@ -1,13 +0,0 @@
package com.muyu.marketing.team.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
import com.muyu.marketing.team.mapper.TeamStrategyExemptionOrdinaryMapper;
import com.muyu.marketing.team.service.TeamStrategyExemptionOrdinaryService;
import org.springframework.stereotype.Service;
@Service
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
implements TeamStrategyExemptionOrdinaryService {
}

View File

@ -4,10 +4,62 @@ 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
@Log4j2
@Service("team-strategy-exemption")
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
implements TeamStrategyExemptionService {
/**
*
*
* @param activityTeamId ID
*/
@Override
public void openTeam(Long activityTeamId) {
log.info("参加 - 免单团 - [{}]", activityTeamId);
}
/**
*
*
* @param teamId ID
*/
@Override
public void applyTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
* @param orderNumber
*/
@Override
public void addTeam(Long teamId, String orderNumber) {
}
/**
* 退
*
* @param teamId ID
*/
@Override
public void backTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
*/
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,66 @@
package com.muyu.marketing.team.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyHundred;
import com.muyu.marketing.team.mapper.TeamStrategyHundredMapper;
import com.muyu.marketing.team.service.TeamStrategyHundredService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@Log4j2
@Service("team-strategy-hundred")
public class TeamStrategyHundredServiceImpl extends ServiceImpl<TeamStrategyHundredMapper, TeamStrategyHundred>
implements TeamStrategyHundredService {
/**
*
*
* @param activityTeamId ID
*/
@Override
public void openTeam(Long activityTeamId) {
log.info("参加 - 百人团 - [{}]", activityTeamId);
}
/**
*
*
* @param teamId ID
*/
@Override
public void applyTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
* @param orderNumber
*/
@Override
public void addTeam(Long teamId, String orderNumber) {
}
/**
* 退
*
* @param teamId ID
*/
@Override
public void backTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
*/
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,66 @@
package com.muyu.marketing.team.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyOrdinary;
import com.muyu.marketing.team.mapper.TeamStrategyOrdinaryMapper;
import com.muyu.marketing.team.service.TeamStrategyOrdinaryService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@Log4j2
@Service("team-strategy-ordinary")
public class TeamStrategyOrdinaryServiceImpl extends ServiceImpl<TeamStrategyOrdinaryMapper, TeamStrategyOrdinary>
implements TeamStrategyOrdinaryService {
/**
*
*
* @param activityTeamId ID
*/
@Override
public void openTeam(Long activityTeamId) {
log.info("参加 - 普通团 - [{}]", activityTeamId);
}
/**
*
*
* @param teamId ID
*/
@Override
public void applyTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
* @param orderNumber
*/
@Override
public void addTeam(Long teamId, String orderNumber) {
}
/**
* 退
*
* @param teamId ID
*/
@Override
public void backTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
*/
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,44 @@
package com.muyu.marketing.team.strategy;
import org.apache.ibatis.annotations.Param;
/**
*
*
* @author DongZeLiang
* @date 2024-11-29 15:03
*/
public interface ActivityTeamStrategy {
/**
*
* @param activityTeamId ID
*/
public void openTeam(Long activityTeamId);
/**
*
* @param teamId ID
*/
public void applyTeam(Long teamId);
/**
*
* @param teamId ID
* @param orderNumber
*/
public void addTeam(Long teamId, String orderNumber);
/**
* 退
* @param teamId ID
*/
public void backTeam(Long teamId);
/**
*
* @param teamId ID
*/
public void settle(Long teamId);
}

View File

@ -0,0 +1,85 @@
package com.muyu.marketing.team.strategy.impl;
import com.muyu.common.core.exception.ServiceException;
import com.muyu.common.core.utils.SpringUtils;
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
/**
*
*
* @author DongZeLiang
* @date 2024-11-29 15:28
*/
@Service
@Primary
public class ActivityTeamStrategyImpl implements ActivityTeamStrategy {
/**
*
*
* @param activityTeamId ID
*/
@Override
public void openTeam(Long activityTeamId) {
// 假设这里是通过方法获取的typeactivityTeamId.toString()
// "team-strategy-exemption"
// "team-strategy-hundred"
// "team-strategy-ordinary"
String activityTeamType = null;
if (activityTeamId == null) {
throw new ServiceException("activityTeamId is null");
}else if (activityTeamId == 0) {
activityTeamType = "team-strategy-exemption";
}else if (activityTeamId == 1) {
activityTeamType = "team-strategy-hundred";
}else if (activityTeamId == 2) {
activityTeamType = "team-strategy-ordinary";
}
ActivityTeamStrategy activityTeamStrategy = SpringUtils.getBean(activityTeamType);
activityTeamStrategy.openTeam(activityTeamId);
}
/**
*
*
* @param teamId ID
*/
@Override
public void applyTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
* @param orderNumber
*/
@Override
public void addTeam(Long teamId, String orderNumber) {
}
/**
* 退
*
* @param teamId ID
*/
@Override
public void backTeam(Long teamId) {
}
/**
*
*
* @param teamId ID
*/
@Override
public void settle(Long teamId) {
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -0,0 +1,28 @@
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 DongZeLiang
* @date 2024-11-29 15:40
*/
@SpringBootTest(classes = MuYuMarketIngApplication.class)
public class TeamStrategyTest {
@Autowired
private ActivityTeamStrategy activityTeamStrategy;
@Test
public void testStrategy() {
activityTeamStrategy.openTeam(0L);
activityTeamStrategy.openTeam(1L);
activityTeamStrategy.openTeam(2L);
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 120.46.147.226:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置