fix():添加了开团功能
parent
d23f85f6c8
commit
05168aaf28
|
@ -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:";
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -23,11 +26,11 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 团购活动ID
|
* 团购活动ID
|
||||||
*/
|
*/
|
||||||
private long teamId;
|
private Long teamId;
|
||||||
/**
|
/**
|
||||||
* 团购类型
|
* 团购类型
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +38,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 团购策略
|
* 团购策略
|
||||||
*/
|
*/
|
||||||
private String teamStrategyId;
|
private Long teamStrategyId;
|
||||||
/**
|
/**
|
||||||
* 参团类型
|
* 参团类型
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +52,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 商品ID
|
* 商品ID
|
||||||
*/
|
*/
|
||||||
private String productId;
|
private Long productId;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +64,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 开团标识
|
* 开团标识
|
||||||
*/
|
*/
|
||||||
private String key;
|
private String openKey;
|
||||||
/**
|
/**
|
||||||
* 订单ID
|
* 订单ID
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,6 +7,9 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.marketing;
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.muyu.marketing.team.mapper")
|
||||||
public class MuYuMarketIngApplication {
|
public class MuYuMarketIngApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(MuYuMarketIngApplication.class, args);
|
SpringApplication.run(MuYuMarketIngApplication.class, args);
|
||||||
|
|
|
@ -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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
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.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||||
|
|
|
@ -5,6 +5,9 @@ import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
|
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.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,13 @@ package com.muyu.marketing.team.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
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.ActivityTeamOpenInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,12 +2,15 @@ package com.muyu.marketing.team.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
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.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||||
|
|
||||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId) {
|
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId) {
|
||||||
|
@ -19,6 +22,7 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过团购活动ID获取团购中最优惠的价格
|
* 通过团购活动ID获取团购中最优惠的价格
|
||||||
|
*
|
||||||
* @param teamId 团购ID
|
* @param teamId 团购ID
|
||||||
* @return 优惠价格
|
* @return 优惠价格
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +31,7 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过活动ID获取 剩余库存
|
* 通过活动ID获取 剩余库存
|
||||||
|
*
|
||||||
* @param teamId 活动ID
|
* @param teamId 活动ID
|
||||||
* @return 库存
|
* @return 库存
|
||||||
*/
|
*/
|
||||||
|
@ -35,12 +40,14 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加团购商品SKU
|
* 添加团购商品SKU
|
||||||
|
*
|
||||||
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||||
*/
|
*/
|
||||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过拼团活动ID获取拼团下商品SKU集合
|
* 通过拼团活动ID获取拼团下商品SKU集合
|
||||||
|
*
|
||||||
* @param teamId 活动ID
|
* @param teamId 活动ID
|
||||||
* @return 拼团商品SKU集合
|
* @return 拼团商品SKU集合
|
||||||
*/
|
*/
|
||||||
|
@ -62,4 +69,21 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
*/
|
*/
|
||||||
public void batchUpdate(List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdModelList);
|
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.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
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.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
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,15 +3,23 @@ package com.muyu.marketing.team.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
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.ActivityTeamOpenInfo;
|
||||||
import com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper;
|
import com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhuyufeng
|
||||||
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
||||||
implements ActivityTeamOpenInfoService {
|
implements ActivityTeamOpenInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ActivityTeamOpenInfoMapper activityTeamOpenInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过活动ID和开团类型查询开团数量
|
* 通过活动ID和开团类型查询开团数量
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.marketing.team.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.common.core.exception.ServiceException;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
|
@ -126,4 +127,33 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
||||||
this.updateBatchById(teamProductSkuInfos);
|
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,19 +1,134 @@
|
||||||
package com.muyu.marketing.team.service.impl;
|
package com.muyu.marketing.team.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
import com.muyu.common.core.constant.TeamOpenKeyConstants;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
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.TeamStrategyExemptionHundredMapper;
|
||||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
|
import com.muyu.marketing.team.service.*;
|
||||||
import com.muyu.marketing.team.service.TeamStrategyExemptionHundredService;
|
import com.muyu.product.cache.ProjectInfoCache;
|
||||||
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
|
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;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhuyufeng
|
* @author zhuyufeng
|
||||||
*/
|
*/
|
||||||
@Service
|
@Log4j2
|
||||||
|
@Service("team-strategy-hundred")
|
||||||
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
|
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,13 +4,44 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionOrdinaryMapper;
|
import com.muyu.marketing.team.mapper.TeamStrategyExemptionOrdinaryMapper;
|
||||||
import com.muyu.marketing.team.service.TeamStrategyExemptionOrdinaryService;
|
import com.muyu.marketing.team.service.TeamStrategyExemptionOrdinaryService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhuyufeng
|
* @author zhuyufeng
|
||||||
*/
|
*/
|
||||||
@Service
|
@Log4j2
|
||||||
|
@Service("team-strategy-ordinary")
|
||||||
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
|
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
|
||||||
implements TeamStrategyExemptionOrdinaryService {
|
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,18 +4,20 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhuyufeng
|
* @author zhuyufeng
|
||||||
*/
|
*/
|
||||||
@Service
|
@Log4j2
|
||||||
|
@Service("team-strategy-free")
|
||||||
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||||
implements TeamStrategyExemptionService {
|
implements TeamStrategyExemptionService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openTeam(Long activityTeamId) {
|
public void openTeam(Long activityTeamId,Long teamProjectSkuId) {
|
||||||
|
log.info("参加-免单团-[{}]",activityTeamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,8 +11,9 @@ public interface ActivityTeamStrategy {
|
||||||
* 开团
|
* 开团
|
||||||
*
|
*
|
||||||
* @param activityTeamId 团购活动id
|
* @param activityTeamId 团购活动id
|
||||||
|
* @param teamProjectSkuId 团购活动商品规格id
|
||||||
*/
|
*/
|
||||||
public void openTeam(Long activityTeamId);
|
public void openTeam(Long activityTeamId,Long teamProjectSkuId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请加团
|
* 申请加团
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
@RestController
|
||||||
@RequestMapping("/info")
|
@RequestMapping("/info")
|
||||||
public class ProjectInfoController extends BaseController {
|
public class ProjectInfoController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectInfoService projectInfoService;
|
private ProjectInfoService projectInfoService;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue