Compare commits
2 Commits
517f694ec2
...
341383d398
Author | SHA1 | Date |
---|---|---|
|
341383d398 | |
|
b6c4a790d7 |
|
@ -20,7 +20,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
|
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
|
||||||
public class TeamStrategyExemptionHundred extends BaseEntity {
|
public class TeamStrategyHundred extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
|
@ -19,7 +19,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
|
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
|
||||||
public class TeamStrategyExemptionOrdinary extends BaseEntity {
|
public class TeamStrategyOrdinary extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
|
@ -57,7 +57,7 @@ public class ActivityTeamInfoAddModel {
|
||||||
/**
|
/**
|
||||||
* 活动排序
|
* 活动排序
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Long sort;
|
||||||
/**
|
/**
|
||||||
* 商品SkU集合
|
* 商品SkU集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,7 +58,7 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 活动排序
|
* 活动排序
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Long sort;
|
||||||
/**
|
/**
|
||||||
* 商品SkU集合
|
* 商品SkU集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -2,8 +2,6 @@ package com.muyu.marketing.team.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
|
|
|
@ -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> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -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> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -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> {
|
||||||
|
|
||||||
|
}
|
|
@ -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> {
|
||||||
|
|
||||||
|
}
|
|
@ -55,4 +55,27 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
public boolean deleteById(List<Long> skuByIdDeleteList);
|
public boolean deleteById(List<Long> skuByIdDeleteList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 业务模型 进行 团购商品修改
|
||||||
|
* @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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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> {
|
|
||||||
}
|
|
|
@ -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> {
|
|
||||||
}
|
|
|
@ -2,7 +2,10 @@ package com.muyu.marketing.team.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
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> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -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> {
|
||||||
|
}
|
|
@ -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> {
|
||||||
|
}
|
|
@ -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 {
|
|
||||||
|
|
||||||
}
|
|
|
@ -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 {
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,10 +4,62 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
|
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
|
||||||
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
|
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Log4j2
|
||||||
|
@Service("team-strategy-exemption")
|
||||||
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||||
implements TeamStrategyExemptionService {
|
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) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
|
@ -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) {
|
||||||
|
// 假设这里是通过方法获取的type,activityTeamId.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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue