main
parent
08b111cf1c
commit
741751955d
|
@ -23,9 +23,9 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
public class QueryModel<T> {
|
||||
|
||||
private Integer pageNum;
|
||||
private Integer pageNum = 1 ;
|
||||
|
||||
private Integer pagesSize;
|
||||
private Integer pagesSize = 2 ;
|
||||
|
||||
private String orderByColumn;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
|
@ -14,7 +15,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = "com.muyu.goods")
|
||||
//@EnableFeignClients
|
||||
public class MuYuGoodsApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuGoodsApplication.class, args);
|
||||
|
|
|
@ -3,16 +3,14 @@ package com.muyu.goods.controller;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.goods.domain.Model.ActivityTeamInfoListModel;
|
||||
import com.muyu.goods.domain.add.ActivityTeamInfoAdd;
|
||||
import com.muyu.goods.domain.req.TeamInfoListReq;
|
||||
import com.muyu.goods.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.goods.service.ActivityTeamInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -35,7 +33,7 @@ public class ActivityTeamInfoController {
|
|||
* 商品拼团信息列表
|
||||
*/
|
||||
@ApiOperation("商品拼团信息列表")
|
||||
@GetMapping("/list")
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<TeamInfoListResp>> query(@RequestBody TeamInfoListReq teamInfoListReq){
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.querya(teamInfoListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModeBuild).toList();
|
||||
|
@ -47,4 +45,16 @@ public class ActivityTeamInfoController {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@ApiOperation("添加商品拼团信息")
|
||||
@PostMapping("/add")
|
||||
public Result<String> add(@RequestBody ActivityTeamInfoAdd activityTeamInfoAdd){
|
||||
activityTeamInfoService.add(activityTeamInfoAdd);
|
||||
return Result.success("添加成功");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.goods.service.ActivityTeamProductSkuInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:尚志豪
|
||||
* @Package:com.muyu.goods.controller
|
||||
|
@ -15,4 +22,16 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RestController
|
||||
@RequestMapping("/ActivityTeamProductSkuInfo")
|
||||
public class ActivityTeamProductSkuInfoController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Result<List<ActivityTeamProductSkuInfo>> listResult(){
|
||||
return Result.success(activityTeamProductSkuInfoService.lists());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.core.utils.PageUtils;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public class BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||
*/
|
||||
@InitBinder
|
||||
public void initBinder (WebDataBinder binder) {
|
||||
// Date 类型转换
|
||||
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
|
||||
@Override
|
||||
public void setAsText (String text) {
|
||||
setValue(DateUtils.parseDate(text));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage () {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理分页的线程变量
|
||||
*/
|
||||
protected void clearPage () {
|
||||
PageUtils.clearPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected <T> Result<TableDataInfo<T>> getDataTable (List<T> list) {
|
||||
return Result.success(
|
||||
TableDataInfo.<T>builder()
|
||||
.total(new PageInfo(list).getTotal())
|
||||
.rows(list)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
public Result success () {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public Result success (String message) {
|
||||
return Result.success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public Result success (Object data) {
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public Result error () {
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public Result error (String message) {
|
||||
return Result.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*/
|
||||
public Result warn (String message) {
|
||||
return Result.warn(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param rows 影响行数
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected Result toAjax (int rows) {
|
||||
return rows > 0 ? Result.success() : Result.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param result 结果
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected Result toAjax (boolean result) {
|
||||
return result ? success() : error();
|
||||
}
|
||||
}
|
|
@ -7,12 +7,14 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 商品拼团信息
|
||||
* @TableName activity_team_info
|
||||
*/
|
||||
@TableName(value ="activity_team_info")
|
||||
@SuperBuilder
|
||||
@Data
|
||||
public class ActivityTeamInfo implements Serializable {
|
||||
/**
|
||||
|
@ -111,6 +113,8 @@ public class ActivityTeamInfo implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.goods.domain.Model;/**
|
||||
* @Author:尚志豪
|
||||
* @Package:com.muyu.goods.domain.Model
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityTeamProductSkuInfoAddModel
|
||||
* @Date:2024/11/24 22:47
|
||||
*/
|
||||
|
||||
/**
|
||||
* @program: cloud-server
|
||||
* @description: 商品拼团规格信息表模型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-24 22:47
|
||||
**/
|
||||
|
||||
public class ActivityTeamProductSkuInfoAddModel {
|
||||
}
|
|
@ -13,9 +13,10 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
/**
|
||||
* @program: cloud-server
|
||||
* @description: 团购商品库存模型
|
||||
* @description:
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-21 20:48
|
||||
* 团购商品库存模型
|
||||
**/
|
||||
|
||||
@Data
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.goods.domain.add;/**
|
||||
* @Author:尚志豪
|
||||
* @Package:com.muyu.goods.domain.add
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityTeamInfoAdd
|
||||
* @Date:2024/11/22 19:02
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.goods.domain.ActivityTeamInfo;
|
||||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.product.domain.CommentInfo;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.req.CommentInfoSaveReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: cloud-server
|
||||
* @description: 商品拼团信息添加表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-22 19:02
|
||||
**/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoAdd extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 商品单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 商品的轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
/**
|
||||
* 商品规格list
|
||||
*/
|
||||
private List<ActivityTeamProductSkuInfo> ruleInfoAddList;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static ActivityTeamInfo saveBuild(ActivityTeamInfoAdd activityTeamInfoAdd){
|
||||
return ActivityTeamInfo.builder()
|
||||
.id(activityTeamInfoAdd.getId())
|
||||
.productId(activityTeamInfoAdd.getProductId())
|
||||
.productImage(activityTeamInfoAdd.getProductImage())
|
||||
.name(activityTeamInfoAdd.getName())
|
||||
.introduction(activityTeamInfoAdd.getIntroduction())
|
||||
.unit(activityTeamInfoAdd.getUnit())
|
||||
.imageList(activityTeamInfoAdd.getImageList())
|
||||
.endTime(activityTeamInfoAdd.getEndTime())
|
||||
.strategyType(activityTeamInfoAdd.getStrategyType())
|
||||
.strategyId(activityTeamInfoAdd.getStrategyId())
|
||||
.sort(activityTeamInfoAdd.getSort())
|
||||
.content(activityTeamInfoAdd.getContent())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,6 @@ import java.util.Date;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TeamInfoListResp {
|
||||
/**
|
||||
* 拼团活动ID
|
||||
|
|
|
@ -2,11 +2,33 @@ package com.muyu.goods.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.goods.domain.ActivityTeamInfo;
|
||||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.goods.domain.add.ActivityTeamInfoAdd;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Entity com.muyu.goods.domain.ActivityTeamInfo
|
||||
*/
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
|
||||
/**
|
||||
* 商品拼团信息
|
||||
* @param activityTeamInfoAdd
|
||||
*/
|
||||
void add(ActivityTeamInfoAdd activityTeamInfoAdd);
|
||||
|
||||
/**
|
||||
* 循环sku添加
|
||||
*/
|
||||
void addlist( ActivityTeamProductSkuInfo info);
|
||||
|
||||
|
||||
// /**
|
||||
// * 添加属性集合
|
||||
// * @param ruleAttrAddModel
|
||||
// */
|
||||
// void addRuleAttrAddModel(RuleAttrAddModel ruleAttrAddModel);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,16 @@ package com.muyu.goods.mapper;
|
|||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Entity com.muyu.goods.domain.ActivityTeamProductSkuInfo
|
||||
*/
|
||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return
|
||||
*/
|
||||
List<ActivityTeamProductSkuInfo> lists();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.goods.remote;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient("muyu-product")
|
||||
public interface InvokeUserController {
|
||||
|
||||
// @PostMapping("/info/add")
|
||||
// public void add(@RequestBody List<ActivityTeamProductSkuInfo> ruleInfoAddList);
|
||||
}
|
|
@ -5,11 +5,19 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.goods.domain.ActivityTeamInfo;
|
||||
import com.muyu.goods.domain.Model.ActivityTeamInfoListModel;
|
||||
import com.muyu.goods.domain.Model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.goods.domain.add.ActivityTeamInfoAdd;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
|
||||
/**
|
||||
* 商品拼团信息列表
|
||||
*/
|
||||
TableDataInfo<ActivityTeamInfoListModel> querya(ActivityTeamInfoListQueryModel activityTeamInfoQueryModel);
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
void add(ActivityTeamInfoAdd activityTeamInfoAdd);
|
||||
}
|
||||
|
|
|
@ -31,4 +31,9 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
* @return
|
||||
*/
|
||||
public TeamProductStockModel getStock(Long teamId);
|
||||
/**
|
||||
* 列表
|
||||
* @return
|
||||
*/
|
||||
List<ActivityTeamProductSkuInfo> lists();
|
||||
}
|
||||
|
|
|
@ -6,16 +6,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.goods.domain.ActivityTeamInfo;
|
||||
import com.muyu.goods.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.goods.domain.Model.ActivityTeamInfoListModel;
|
||||
import com.muyu.goods.domain.Model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.goods.domain.Model.TeamProductStockModel;
|
||||
import com.muyu.goods.domain.TeamProductDiscountPriceMode;
|
||||
import com.muyu.goods.domain.add.ActivityTeamInfoAdd;
|
||||
import com.muyu.goods.remote.InvokeUserController;
|
||||
import com.muyu.goods.service.ActivityTeamInfoService;
|
||||
import com.muyu.goods.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.goods.service.ActivityTeamOpenInfoService;
|
||||
import com.muyu.goods.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -30,8 +36,15 @@ implements ActivityTeamInfoService{
|
|||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
private ActivityTeamInfoMapper activityTeamInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
@Autowired
|
||||
private InvokeUserController invokeUserController;
|
||||
/**
|
||||
* 商品拼团信息列表
|
||||
*/
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> querya(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
|
@ -71,6 +84,30 @@ implements ActivityTeamInfoService{
|
|||
tableDataInfo.setRows(activityTeamInfoListModels);
|
||||
return tableDataInfo;
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void add(ActivityTeamInfoAdd activityTeamInfoAdd) {
|
||||
|
||||
// 商品拼团信息
|
||||
activityTeamInfoMapper.add(activityTeamInfoAdd);
|
||||
// 返回只id
|
||||
Long id = activityTeamInfoAdd.getId();
|
||||
|
||||
// 获取list集合
|
||||
List<ActivityTeamProductSkuInfo> ruleInfoAddList = activityTeamInfoAdd.getRuleInfoAddList();
|
||||
|
||||
// 循环sku添加
|
||||
for (ActivityTeamProductSkuInfo info : ruleInfoAddList) {
|
||||
System.out.println(info);
|
||||
info.setTeamId(id);
|
||||
info.setProductId(activityTeamInfoAdd.getProductId());
|
||||
activityTeamInfoMapper.addlist(info);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,13 @@ implements ActivityTeamProductSkuInfoService{
|
|||
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoMapper activityTeamProductSkuInfoMapper;
|
||||
/**
|
||||
* 通过团购活动Id获取团购中最优惠的价格
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TeamProductDiscountPriceMode getDiscountPrice(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -49,7 +55,11 @@ implements ActivityTeamProductSkuInfoService{
|
|||
}
|
||||
return discountPriceModeOptional.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过活动Id获取 剩余库存
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TeamProductStockModel getStock(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||
|
@ -58,4 +68,12 @@ implements ActivityTeamProductSkuInfoService{
|
|||
.remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L,Long::sum))
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ActivityTeamProductSkuInfo> lists() {
|
||||
return activityTeamProductSkuInfoMapper.lists();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"商品ID": "Long",
|
||||
"商品名称": "String",
|
||||
"商品图": "String",
|
||||
"商品类型": "String",
|
||||
"商品分类": "String",
|
||||
"用户等级": "Long",
|
||||
"是否是付费会员": "Long",
|
||||
"用户分组": "Long"
|
||||
"用户标签": "String",
|
||||
"拼团活动名称": "String",
|
||||
"拼团活动简介": "TexT",
|
||||
"商品单位": "Long",
|
||||
"商品轮播图": [ "String", "String" ]
|
||||
"活动时间": "Date",
|
||||
"拼团时效": "Date",
|
||||
"拼团人数": "Long",
|
||||
"总购买数量限制": "Long",
|
||||
"单次购买数量限制": "Long",
|
||||
"补齐人数": "Long",
|
||||
"规格选择": [ "规格SKU": "String" ],
|
||||
"配送方法": "Long",
|
||||
"运费设置": "Long",
|
||||
"排序": "Long",
|
||||
"详情": "TexT"
|
||||
}
|
|
@ -33,4 +33,19 @@
|
|||
strategy_id,remark,create_by,
|
||||
create_time,update_by,update_time
|
||||
</sql>
|
||||
<!-- 商品拼团信息-->
|
||||
<insert id="add" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO activity_team_info
|
||||
( `name`, `product_id`, `product_image`, `introduction`, `unit`, `image_list`, `end_time`, `sort`, `content`, `status`, `strategy_type`, `strategy_id`, `remark`) VALUES
|
||||
( #{name}, #{productId}, #{productImage}, #{introduction},#{unit},#{imageList},#{endTime},#{sort}, #{content}, 1, #{strategyType}, #{strategyId}, #{remark} );
|
||||
|
||||
</insert>
|
||||
<!-- 循环sku添加-->
|
||||
<insert id="addlist">
|
||||
INSERT INTO activity_team_product_sku_info
|
||||
( `team_id`, `product_id`, `product_sku`, `team_stock`, `team_price`) VALUES
|
||||
( #{teamId}, #{productId}, #{productSku}, #{teamStock}, #{teamPrice});
|
||||
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -24,4 +24,8 @@
|
|||
create_by,create_time,update_by,
|
||||
update_time,remark
|
||||
</sql>
|
||||
<!-- 列表-->
|
||||
<select id="lists" resultType="com.muyu.goods.domain.ActivityTeamProductSkuInfo">
|
||||
select * from activity_team_product_sku_info
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,132 @@
|
|||
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.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 java.util.Date;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "activity_team_info", autoResultMap = true)
|
||||
public class ActivityTeamInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private long sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private long strategyId;
|
||||
|
||||
/**
|
||||
* 公共添加模型,转换成添加对象
|
||||
* @param activityTeamInfoAddModel 添加模型
|
||||
* @return 添加对象
|
||||
*/
|
||||
public static ActivityTeamInfo addModelBuild(ActivityTeamInfoAddModel activityTeamInfoAddModel){
|
||||
return ActivityTeamInfo.builder()
|
||||
.name(activityTeamInfoAddModel.getName())
|
||||
.productId(activityTeamInfoAddModel.getProductId())
|
||||
.productImage(activityTeamInfoAddModel.getProductImage())
|
||||
.introduction(activityTeamInfoAddModel.getIntroduction())
|
||||
.unit(activityTeamInfoAddModel.getUnit())
|
||||
.imageList(activityTeamInfoAddModel.getImageList())
|
||||
.endTime(activityTeamInfoAddModel.getEndTime())
|
||||
.sort(activityTeamInfoAddModel.getSort())
|
||||
.content(activityTeamInfoAddModel.getContent())
|
||||
.status(activityTeamInfoAddModel.getStatus())
|
||||
.strategyType(activityTeamInfoAddModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoAddModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ActivityTeamInfo teamSaveBuild(ActivityTeamInfoSaveModel activityTeamInfoSaveModel) {
|
||||
return ActivityTeamInfo.builder()
|
||||
.name(activityTeamInfoSaveModel.getName())
|
||||
.productId(activityTeamInfoSaveModel.getProductId())
|
||||
.productImage(activityTeamInfoSaveModel.getProductImage())
|
||||
.introduction(activityTeamInfoSaveModel.getIntroduction())
|
||||
.unit(activityTeamInfoSaveModel.getUnit())
|
||||
.imageList(activityTeamInfoSaveModel.getImageList())
|
||||
.endTime(activityTeamInfoSaveModel.getEndTime())
|
||||
.sort(activityTeamInfoSaveModel.getSort())
|
||||
.content(activityTeamInfoSaveModel.getContent())
|
||||
.status(activityTeamInfoSaveModel.getStatus())
|
||||
.strategyType(activityTeamInfoSaveModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoSaveModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
public static ActivityTeamInfo TeamUpdateBuild (ActivityTeamInfoUpdModel activityTeamInfoUpdModel){
|
||||
return ActivityTeamInfo.builder()
|
||||
.id(activityTeamInfoUpdModel.getId())
|
||||
.name(activityTeamInfoUpdModel.getName())
|
||||
.productId(activityTeamInfoUpdModel.getProductId())
|
||||
.productImage(activityTeamInfoUpdModel.getProductImage())
|
||||
.introduction(activityTeamInfoUpdModel.getIntroduction())
|
||||
.unit(activityTeamInfoUpdModel.getUnit())
|
||||
.imageList(activityTeamInfoUpdModel.getImageList())
|
||||
.endTime(activityTeamInfoUpdModel.getEndTime())
|
||||
.sort(activityTeamInfoUpdModel.getSort())
|
||||
.content(activityTeamInfoUpdModel.getContent())
|
||||
.status(activityTeamInfoUpdModel.getStatus())
|
||||
.strategyType(activityTeamInfoUpdModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoUpdModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
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.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "activity_team_open_info", autoResultMap = true)
|
||||
public class ActivityTeamOpenInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
private String teamType;
|
||||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
private String teamStrategyId;
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
private String executiveType;
|
||||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String productId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
private String key;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 开团状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
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.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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "activity_team_product_sku_info", autoResultMap = true)
|
||||
public class ActivityTeamProductSkuInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 通过模型钢构件对象
|
||||
* @param activityTeamProductSkuAddModel 模型
|
||||
* @return 对象
|
||||
*/
|
||||
public static ActivityTeamProductSkuInfo modelBuild(ActivityTeamProductSkuAddModel activityTeamProductSkuAddModel) {
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.productId(activityTeamProductSkuAddModel.getProductId())
|
||||
.teamId(activityTeamProductSkuAddModel.getTeamId())
|
||||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.productSku(activityTeamProductSkuAddModel.getSku())
|
||||
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
public static ActivityTeamProductSkuInfo updateModelBuild(ActivityTeamProductSkuReqModel activityTeamProductSkuReqModel) {
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.id(activityTeamProductSkuReqModel.getId())
|
||||
.productId(activityTeamProductSkuReqModel.getProductId())
|
||||
.teamStock(activityTeamProductSkuReqModel.getTeamStock())
|
||||
.productSku(activityTeamProductSkuReqModel.getProductSku())
|
||||
.teamPrice(activityTeamProductSkuReqModel.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ActivityTeamProductSkuInfo updModelBuild(ActivityTeamProductSkuUpdModel teamProductSkuUpdModel){
|
||||
return ActivityTeamProductSkuInfo.builder()
|
||||
.id(teamProductSkuUpdModel.getId())
|
||||
.teamPrice(teamProductSkuUpdModel.getTeamPrice())
|
||||
.teamStock(teamProductSkuUpdModel.getTeamStock())
|
||||
.remainStock(teamProductSkuUpdModel.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
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.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "team_strategy_exemption", autoResultMap = true)
|
||||
public class TeamStrategyExemption extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private long duration;
|
||||
/**
|
||||
* 免单人数
|
||||
*/
|
||||
private long exemptionNumber;
|
||||
/**
|
||||
* 最大购买量
|
||||
*/
|
||||
private long maxBuy;
|
||||
/**
|
||||
* 单次购买量
|
||||
*/
|
||||
private long oneBuy;
|
||||
/**
|
||||
* 虚拟人数
|
||||
*/
|
||||
private long virtualNumber;
|
||||
/**
|
||||
* 面单类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 返款阶梯
|
||||
*/
|
||||
private String ruleInfo;
|
||||
/**
|
||||
* 策略状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
|
||||
public class TeamStrategyHundred extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private long duration;
|
||||
/**
|
||||
* 最大购买量
|
||||
*/
|
||||
private long maxBuy;
|
||||
/**
|
||||
* 单次购买量
|
||||
*/
|
||||
private long oneBuy;
|
||||
/**
|
||||
* 虚拟人数
|
||||
*/
|
||||
private long virtualNumber;
|
||||
/**
|
||||
* 策略状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 规则信息
|
||||
*/
|
||||
private String ruleInfo;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
|
||||
public class TeamStrategyOrdinary extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private long duration;
|
||||
/**
|
||||
* 成团人数
|
||||
*/
|
||||
private long teamNumber;
|
||||
/**
|
||||
* 最大购买量
|
||||
*/
|
||||
private long maxBuy;
|
||||
/**
|
||||
* 单次购买量
|
||||
*/
|
||||
private long oneBuy;
|
||||
/**
|
||||
* 虚拟人数
|
||||
*/
|
||||
private long virtualNumber;
|
||||
/**
|
||||
* 策略状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 活动回显总模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 16:00
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamDetailModel {
|
||||
/**
|
||||
* 拼团id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<ActivityTeamProductSkuModel> projectSkuInfoAddReqList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
public static ActivityTeamDetailModel findSkuSumList (ActivityTeamInfo activityTeamInfo,
|
||||
Function<ActivityTeamDetailModel.ActivityTeamDetailModelBuilder, ActivityTeamDetailModel> function){
|
||||
return function.apply(ActivityTeamDetailModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.productId(activityTeamInfo.getProductId())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.introduction(activityTeamInfo.getIntroduction())
|
||||
.unit(activityTeamInfo.getUnit())
|
||||
.imageList(activityTeamInfo.getImageList())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.sort(activityTeamInfo.getSort())
|
||||
.content(activityTeamInfo.getContent())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
.strategyType(activityTeamInfo.getStrategyType())
|
||||
.strategyId(activityTeamInfo.getStrategyId())
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamInfoAddModel {
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
public static ActivityTeamInfoAddModel addReqBuild (ActivityTeamInfoSaveReq activityTeamInfoSaveReq){
|
||||
return ActivityTeamInfoAddModel.builder()
|
||||
.name(activityTeamInfoSaveReq.getName())
|
||||
.productId(activityTeamInfoSaveReq.getProductId())
|
||||
.productImage(activityTeamInfoSaveReq.getProductImage())
|
||||
.introduction(activityTeamInfoSaveReq.getIntroduction())
|
||||
.unit(activityTeamInfoSaveReq.getUnit())
|
||||
.imageList(activityTeamInfoSaveReq.getImageList())
|
||||
.endTime(activityTeamInfoSaveReq.getEndTime())
|
||||
.sort(activityTeamInfoSaveReq.getSort())
|
||||
.content(activityTeamInfoSaveReq.getContent())
|
||||
.status(activityTeamInfoSaveReq.getStatus())
|
||||
.strategyType(activityTeamInfoSaveReq.getStrategyType())
|
||||
.strategyId(activityTeamInfoSaveReq.getStrategyId())
|
||||
.activityTeamProductSkuAddModelList(
|
||||
activityTeamInfoSaveReq.getTeamProjectSkuInfoAddReqList()
|
||||
.stream()
|
||||
.map(addReq -> ActivityTeamProductSkuAddModel.addReqBuild(addReq, activityTeamInfoSaveReq::getProductId))
|
||||
.toList()
|
||||
).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 团购活动雷彪查询结果模型
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-20 14:18:10
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamInfoListModel {
|
||||
|
||||
/**
|
||||
* 拼团活动ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
|
||||
public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function<ActivityTeamInfoListModel.ActivityTeamInfoListModelBuilder, ActivityTeamInfoListModel> function) {
|
||||
ActivityTeamInfoListModel activityTeamInfoListModel = ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
// .openTeamNumber(teamOpenTypeNumber)
|
||||
// .addTeamNumber(teamInTypeNumber)
|
||||
// .attendNumber(teamOpenTypeNumber + teamInTypeNumber)
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
// .teamPrice(discountPrice.getTeamPrice())
|
||||
// .productPrice(discountPrice.getProductPrice())
|
||||
// .teamStock(teamProductStockModel.getTeamStock())
|
||||
// .remainStock(teamProductStockModel.getRemainStock())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
.build();
|
||||
return function.apply(
|
||||
ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 团购活动雷彪查询模型
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-20 14:18:10
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
|
||||
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 添加活动模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 10:59
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoSaveModel {
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
public static ActivityTeamInfoSaveModel activityTeamInfoSaveModelBuild (ActivityTeamInfoAddModel activityTeamInfoAddModel){
|
||||
return ActivityTeamInfoSaveModel.builder()
|
||||
.name(activityTeamInfoAddModel.getName())
|
||||
.productId(activityTeamInfoAddModel.getProductId())
|
||||
.productImage(activityTeamInfoAddModel.getProductImage())
|
||||
.introduction(activityTeamInfoAddModel.getIntroduction())
|
||||
.unit(activityTeamInfoAddModel.getUnit())
|
||||
.imageList(activityTeamInfoAddModel.getImageList())
|
||||
.endTime(activityTeamInfoAddModel.getEndTime())
|
||||
.sort(Long.valueOf(activityTeamInfoAddModel.getSort()))
|
||||
.content(activityTeamInfoAddModel.getContent())
|
||||
.status(activityTeamInfoAddModel.getStatus())
|
||||
.strategyType(activityTeamInfoAddModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoAddModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 活动商品规格修改模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 19:25
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoUpdModel {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long productId;
|
||||
private String productImage;
|
||||
private String introduction;
|
||||
private String unit;
|
||||
private String imageList;
|
||||
private Date endTime;
|
||||
private Long sort;
|
||||
private String content;
|
||||
private String status;
|
||||
private String strategyType;
|
||||
private Long strategyId;
|
||||
private ActivityTeamProductSkuSettingModel activityTeamProductSkuSettingModel;
|
||||
|
||||
public static ActivityTeamInfoUpdModel activityTeamInfoUpdReqModelBuild (ActivityTeamInfoUpdReq activityTeamInfoUpdReq){
|
||||
return ActivityTeamInfoUpdModel.builder()
|
||||
.id(activityTeamInfoUpdReq.getId())
|
||||
.name(activityTeamInfoUpdReq.getName())
|
||||
.productId(activityTeamInfoUpdReq.getProductId())
|
||||
.productImage(activityTeamInfoUpdReq.getProductImage())
|
||||
.introduction(activityTeamInfoUpdReq.getIntroduction())
|
||||
.unit(activityTeamInfoUpdReq.getUnit())
|
||||
.imageList(activityTeamInfoUpdReq.getImageList())
|
||||
.endTime(activityTeamInfoUpdReq.getEndTime())
|
||||
.sort(activityTeamInfoUpdReq.getSort())
|
||||
.content(activityTeamInfoUpdReq.getContent())
|
||||
.status(activityTeamInfoUpdReq.getStatus())
|
||||
.strategyType(activityTeamInfoUpdReq.getStrategyType())
|
||||
.strategyId(activityTeamInfoUpdReq.getStrategyId())
|
||||
.activityTeamProductSkuSettingModel(
|
||||
ActivityTeamProductSkuSettingModel.settingReqModel(
|
||||
activityTeamInfoUpdReq.getActivityTeamProductSkuSettingReq(),
|
||||
activityTeamInfoUpdReq::getProductId
|
||||
)
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 团购spu库存添加模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 09:36
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuAddListModel {
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 团购spu库存添加模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 09:36
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuAddModel {
|
||||
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static ActivityTeamProductSkuAddModel addReqBuild(TeamProjectSkuInfoAddReq teamProjectSkuInfoAddReq, Supplier<Long> productId){
|
||||
return ActivityTeamProductSkuAddModel.builder()
|
||||
.productId(productId.get())
|
||||
.sku(teamProjectSkuInfoAddReq.getSku())
|
||||
.teamStock(teamProjectSkuInfoAddReq.getTeamStock())
|
||||
.teamPrice(teamProjectSkuInfoAddReq.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.marketing.domain.model;/**
|
||||
* @Author:尚志豪
|
||||
* @Package:com.muyu.marketing.domain.model
|
||||
* @Project:2204a-cloud-server-DongZeLiang
|
||||
* @name:ActivityTeamProductSkuDelModel
|
||||
* @Date:2024/11/27 17:03
|
||||
*/
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server-DongZeLiang
|
||||
* @description: 删除商品规格
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-27 17:03
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuDelListModel {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品活动SKU信息模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 15:35
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuInfoForeignKeyModel extends ActivityTeamProductSkuInfoModel{
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private Integer name;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private Integer productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private Integer introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private Integer unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private Integer imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Integer endTime;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private Integer content;
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品活动SKU信息模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 15:35
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuInfoModel {
|
||||
/**
|
||||
* 团购商品SKU的ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 团ID
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.resp.ProjectFindSkuInfoResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 回显sku模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 16:03
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamProductSkuModel {
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static ActivityTeamProductSkuModel FindBuild(ActivityTeamProductSkuInfo activityTeamProductSkuInfo) {
|
||||
return ActivityTeamProductSkuModel.builder()
|
||||
.id(activityTeamProductSkuInfo.getId())
|
||||
.sku(activityTeamProductSkuInfo.getProductSku())
|
||||
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: sku修改模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 19:45
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamProductSkuReqModel {
|
||||
private Long id;
|
||||
private Long teamId;
|
||||
private Long productId;
|
||||
private String productSku;
|
||||
private Long teamStock;
|
||||
private Long remainStock;
|
||||
private BigDecimal teamPrice;
|
||||
public static ActivityTeamProductSkuReqModel activityTeamProductSkuReqModelBuild(ActivityTeamProductSkuReq activityTeamProductSkuReq){
|
||||
return ActivityTeamProductSkuReqModel.builder()
|
||||
.id(activityTeamProductSkuReq.getId())
|
||||
.productId(activityTeamProductSkuReq.getProductId())
|
||||
.teamId(activityTeamProductSkuReq.getTeamId())
|
||||
.productSku(activityTeamProductSkuReq.getProductSku())
|
||||
.remainStock(activityTeamProductSkuReq.getRemainStock())
|
||||
.teamStock(activityTeamProductSkuReq.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuReq.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品活动,修改,删除,添加,模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 15:35
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuUpdDelAddModel {
|
||||
/**
|
||||
* 修改商品规格LIST
|
||||
*/
|
||||
private List<ActivityTeamProductSkuUpdListModel> activityTeamProductSkuUpdModelList;
|
||||
/**
|
||||
* 删除商品规格LIST
|
||||
*/
|
||||
private List<ActivityTeamProductSkuDelListModel> activityTeamProductSkuDelModelList;
|
||||
|
||||
/**
|
||||
* 添加商品规格LIST
|
||||
*/
|
||||
private List<ActivityTeamProductSkuAddListModel> ActivityTeamProductSkuAddListModelList;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 拼团活动商品SKU
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-27 14:18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuUpdListModel {
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 团购价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoUpdReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 拼团活动商品SKU
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-27 14:18
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuUpdModel {
|
||||
|
||||
/**
|
||||
* 商品规格ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 团购价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static ActivityTeamProductSkuUpdModel updReqBuild(TeamProjectSkuInfoUpdReq teamProjectSkuInfoUpdReq){
|
||||
return ActivityTeamProductSkuUpdModel.builder()
|
||||
.id(teamProjectSkuInfoUpdReq.getId())
|
||||
.teamStock(teamProjectSkuInfoUpdReq.getTeamStock())
|
||||
.teamPrice(teamProjectSkuInfoUpdReq.getTeamPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import com.muyu.marketing.domain.req.TeamProjectSkuInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 团购spu库存添加模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-26 09:36
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ActivityTeamProductSkuUpdateModel {
|
||||
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 活动回显总模型
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 16:00
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamUpdateModel {
|
||||
/**
|
||||
* 拼团id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private List<ActivityTeamProductSkuUpdDelAddModel> activityTeamProductSkuUpdDelAddModelList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 团购商品优惠力度模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-21 11:57
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TeamProductDiscountPriceModel {
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
|
||||
/**
|
||||
* 团购优惠价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠力度 (商品价格 - 团购优惠价格) / 商品价格
|
||||
*/
|
||||
private double discount;
|
||||
|
||||
/**
|
||||
* 通过 商品价格和团购价格 生成优惠力度
|
||||
* @param productPrice 商品价格
|
||||
* @param teamPrice 团购加
|
||||
* @return 优惠力度
|
||||
*/
|
||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||
return TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(
|
||||
productPrice.subtract(teamPrice).divide(productPrice, 2, RoundingMode.HALF_UP).doubleValue()
|
||||
)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 团购商品库存模型
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-21 14:04
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TeamProductStockModel {
|
||||
|
||||
/**
|
||||
* 拼团总库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
/**
|
||||
* 拼团剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoSaveReq extends BaseEntity {
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<TeamProjectSkuInfoAddReq> teamProjectSkuInfoAddReqList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 活动商品规格修改入参
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 19:25
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoUpdReq {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long productId;
|
||||
private String productImage;
|
||||
private String introduction;
|
||||
private String unit;
|
||||
private String imageList;
|
||||
private Date endTime;
|
||||
private Long sort;
|
||||
private String content;
|
||||
private String status;
|
||||
private String strategyType;
|
||||
private Long strategyId;
|
||||
private ActivityTeamProductSkuSettingReq activityTeamProductSkuSettingReq;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: sku修改入参
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 19:45
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamProductSkuReq {
|
||||
private Long id;
|
||||
private Long teamId;
|
||||
private Long productId;
|
||||
private String productSku;
|
||||
private Long teamStock;
|
||||
private Long remainStock;
|
||||
private BigDecimal teamPrice;
|
||||
}
|
|
@ -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,37 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
//@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamInfoListReq extends PageDomain {
|
||||
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 通过当前对象构建业务查询模型
|
||||
* @return 业务查询模型
|
||||
*/
|
||||
public ActivityTeamInfoListQueryModel buildQueryModel() {
|
||||
return ActivityTeamInfoListQueryModel.builder()
|
||||
.keyWord(this.keyWord)
|
||||
.status(this.status)
|
||||
.build()
|
||||
.domainBuild(this);
|
||||
}
|
||||
}
|
|
@ -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 TeamProjectSkuInfoAddReq {
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamDetailResp extends BaseEntity {
|
||||
/**
|
||||
* 团购ID
|
||||
*/
|
||||
private Long teamId;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<ActivityTeamProjectSkuResp> ActivityTeamProjectSkuRespList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class ActivityTeamProjectSkuResp{
|
||||
private Long teamStock;
|
||||
private String sku;
|
||||
private BigDecimal teamPrice;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 添加的
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamProjectSkuResp {
|
||||
|
||||
/**
|
||||
* 团购商品SKU的ID
|
||||
*/
|
||||
private Long productSkuId;
|
||||
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 回显resp
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectFindSkuInfoResp {
|
||||
/**
|
||||
* 规格id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 规格SKU
|
||||
*/
|
||||
private String sku;
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static ProjectFindSkuInfoResp projectFindSkuInfoBuild (ActivityTeamProductSkuModel activityTeamProductSkuModel) {
|
||||
return ProjectFindSkuInfoResp.builder()
|
||||
.teamStock(activityTeamProductSkuModel.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuModel.getTeamPrice())
|
||||
.id(activityTeamProductSkuModel.getId())
|
||||
.sku(activityTeamProductSkuModel.getSku())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamDetailModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: 2204a-cloud-server
|
||||
* @description: 团购活动回显响应
|
||||
* @author: AoCi Tian
|
||||
* @create: 2024-11-26 15:19
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class TeamInfoFindByIdResp {
|
||||
/**
|
||||
* 拼团id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
private List<ProjectFindSkuInfoResp> projectSkuInfoAddList;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
public static TeamInfoFindByIdResp teamInfoFindByIdBuild (ActivityTeamDetailModel activityTeamDetailModel){
|
||||
return TeamInfoFindByIdResp.builder()
|
||||
.id(activityTeamDetailModel.getId())
|
||||
.name(activityTeamDetailModel.getName())
|
||||
.productId(activityTeamDetailModel.getProductId())
|
||||
.productImage(activityTeamDetailModel.getProductImage())
|
||||
.introduction(activityTeamDetailModel.getIntroduction())
|
||||
.unit(activityTeamDetailModel.getUnit())
|
||||
.imageList(activityTeamDetailModel.getImageList())
|
||||
.endTime(activityTeamDetailModel.getEndTime())
|
||||
.sort(activityTeamDetailModel.getSort())
|
||||
.projectSkuInfoAddList(activityTeamDetailModel.getProjectSkuInfoAddReqList().stream().map(ProjectFindSkuInfoResp::projectFindSkuInfoBuild).toList())
|
||||
// .projectSkuInfoAddList(
|
||||
// teamInfoFindByIdRespModel.getProjectSkuInfoAddReqList().stream().map(activityTeamProductSkuModel ->
|
||||
// ProjectFindSkuInfoResp.projectFindSkuInfoBuild(activityTeamProductSkuModel)).toList()
|
||||
// )
|
||||
.content(activityTeamDetailModel.getContent())
|
||||
.status(activityTeamDetailModel.getStatus())
|
||||
.strategyType(activityTeamDetailModel.getStrategyType())
|
||||
.strategyId(activityTeamDetailModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
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 java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TeamInfoListResp {
|
||||
|
||||
/**
|
||||
* 拼团活动ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
/**
|
||||
* 列表查询结果,构建为响应对象
|
||||
* @param activityTeamInfoListModel 列表数据查询结果
|
||||
* @return 响应对象
|
||||
*/
|
||||
public static TeamInfoListResp listModelBuild(ActivityTeamInfoListModel activityTeamInfoListModel) {
|
||||
return TeamInfoListResp.builder()
|
||||
.id(activityTeamInfoListModel.getId())
|
||||
.name(activityTeamInfoListModel.getName())
|
||||
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.attendNumber(activityTeamInfoListModel.getAttendNumber())
|
||||
.endTime(activityTeamInfoListModel.getEndTime())
|
||||
.teamPrice(activityTeamInfoListModel.getTeamPrice())
|
||||
.productImage(activityTeamInfoListModel.getProductImage())
|
||||
.productPrice(activityTeamInfoListModel.getProductPrice())
|
||||
.remainStock(activityTeamInfoListModel.getRemainStock())
|
||||
.status(activityTeamInfoListModel.getStatus())
|
||||
.teamStock(activityTeamInfoListModel.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>marketing-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 远程调用 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>marketing-remote</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 商品服务 缓存依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,24 @@
|
|||
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.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
|
||||
public class MuYuMarketIngApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuMarketIngApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package com.muyu.marketing.team.controller;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
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.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdReq;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoFindByIdResp;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 营销团购活动控制层
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-20 14:25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/team")
|
||||
public class ActivityTeamController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService skuInfoService;
|
||||
|
||||
/**
|
||||
* 查询营销团购活动列表
|
||||
* @param teamInfoListReq 活动查询入参
|
||||
* @return 活动响应结果
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<TeamInfoListResp>> list(@RequestBody TeamInfoListReq teamInfoListReq) {
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList();
|
||||
return Result.success(
|
||||
new TableDataInfo<>(){{
|
||||
setRows(respList);
|
||||
setTotal(tableDataInfo.getTotal());
|
||||
}}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购活动
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
* @return 结果集
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Result<String> save(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
||||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*/
|
||||
@PostMapping("/detail")
|
||||
public List<ActivityTeamProductSkuModel> findListByTeamId(Long teamId) {
|
||||
List<ActivityTeamProductSkuModel> list = skuInfoService.findListByTeamId(teamId);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findTeam/{id}")
|
||||
public Result<List<ActivityTeamInfo>> findTeam(@PathVariable("id") Long id){
|
||||
return Result.success(activityTeamInfoService.findTeam(id));
|
||||
}
|
||||
|
||||
/** 根据id回显
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findById/{id}")
|
||||
public Result<TeamInfoFindByIdResp> findTeamById(@PathVariable Long id) {
|
||||
return Result.success(TeamInfoFindByIdResp.teamInfoFindByIdBuild(activityTeamInfoService.findDetailById(id)));
|
||||
}
|
||||
|
||||
@PutMapping("/updateByTeamId")
|
||||
public Result updateByTeamId(@RequestBody ActivityTeamInfoUpdReq activityTeamInfoUpdReq){
|
||||
activityTeamInfoService.update(ActivityTeamInfoUpdModel.activityTeamInfoUpdReqModelBuild(activityTeamInfoUpdReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购活动列表
|
||||
*/
|
||||
@GetMapping("/teamList")
|
||||
public Result<TableDataInfo<ActivityTeamInfo>> teamList( TeamInfoListReq teamInfoListReq){
|
||||
PageHelper.startPage(teamInfoListReq.getPageNum(), teamInfoListReq.getPageSize());
|
||||
PageInfo<ActivityTeamInfo> pageInfo = new PageInfo<>(activityTeamInfoService.list());
|
||||
TableDataInfo<ActivityTeamInfo> tableDataInfo = new TableDataInfo<>();
|
||||
tableDataInfo.setRows(pageInfo.getList());
|
||||
tableDataInfo.setTotal(pageInfo.getTotal());
|
||||
return Result.success(tableDataInfo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.marketing.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuInfoForeignKeyModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
// List<ActivityTeamProductSkuInfoForeignKeyModel> lists();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
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;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.marketing.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.marketing.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionMapper extends BaseMapper<TeamStrategyExemption> {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.marketing.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 通过查询模型查询团购活动列表
|
||||
* @param activityTeamInfoListQueryModel 团购活动查询模型
|
||||
* @return 团购活动列表
|
||||
*/
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
|
||||
/**
|
||||
* 通过添加模型,去进行商品拼团活动的操作
|
||||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||
|
||||
/**
|
||||
* 根据ID查询商品的详情
|
||||
* @param id 团购活动ID
|
||||
* @return 团购详情
|
||||
*/
|
||||
ActivityTeamDetailModel findDetailById(Long id);
|
||||
|
||||
/**
|
||||
* 修改团购活动信息
|
||||
* @param activityTeamInfoUpdModel 团购活动信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
||||
|
||||
List<ActivityTeamInfo> findTeam(Long id);
|
||||
|
||||
|
||||
// List<ActivityTeamProductSkuInfoForeignKeyModel> lists();
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
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.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
|
||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
|
||||
/**
|
||||
* 通过活动ID和开团类型查询开团数量
|
||||
* @param teamId 活动ID
|
||||
* @param teamOpenType 开团类型
|
||||
* @return 开团数量
|
||||
*/
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType);
|
||||
|
||||
/**
|
||||
* 根据活动ID获取开团数量
|
||||
* @param teamId 团购活动ID
|
||||
* @return 开团数量
|
||||
*/
|
||||
public default Long getTeamOpenTypeNumberByTeamId(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动ID获取参团数量
|
||||
* @param teamId 团购活动ID
|
||||
* @return 参团数量
|
||||
*/
|
||||
public default Long getTeamInTypeNumberByTeamId(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
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.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||
|
||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId){
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过团购活动ID获取团购中最优惠的价格
|
||||
* @param teamId 团购ID
|
||||
* @return 优惠价格
|
||||
*/
|
||||
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过活动ID获取 剩余库存
|
||||
* @param teamId 活动ID
|
||||
* @return 库存
|
||||
*/
|
||||
public TeamProductStockModel getStock(Long teamId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购商品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);
|
||||
|
||||
/**
|
||||
* 根据 业务模型 进行 团购商品修改
|
||||
* @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());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.marketing.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.team.strategy.ActivityTeamStrategy;
|
||||
|
||||
/**
|
||||
* 免单
|
||||
*/
|
||||
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> {
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
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.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.team.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||
implements ActivityTeamInfoService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
@Autowired
|
||||
private ActivityTeamInfoMapper activityTeamInfoMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord());
|
||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStatus());
|
||||
|
||||
/**
|
||||
* Object<T> -> 创建对象的时候进行的占用
|
||||
* <T> Result<T> 以方法返回值为占用
|
||||
*/
|
||||
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(), queryWrapper);
|
||||
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
||||
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
|
||||
.map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
|
||||
(activityTeamInfoListModelBuilder) -> {
|
||||
TeamProductDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
|
||||
TeamProductStockModel teamProductStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
|
||||
Long teamOpenTypeNumber = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId());
|
||||
Long teamInTypeNumber = activityTeamOpenInfoService.getTeamInTypeNumberByTeamId(activityTeamInfo.getId());
|
||||
|
||||
return activityTeamInfoListModelBuilder
|
||||
.openTeamNumber(teamOpenTypeNumber)
|
||||
.addTeamNumber(teamInTypeNumber)
|
||||
.attendNumber(teamOpenTypeNumber + teamInTypeNumber)
|
||||
.teamPrice(discountPrice.getTeamPrice())
|
||||
.productPrice(discountPrice.getProductPrice())
|
||||
.teamStock(teamProductStockModel.getTeamStock())
|
||||
.remainStock(teamProductStockModel.getRemainStock())
|
||||
.build();
|
||||
})).toList();
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo<>();
|
||||
tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
|
||||
tableDataInfo.setRows(activityTeamInfoListModels);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过添加模型,去进行商品拼团活动的操作
|
||||
*
|
||||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
@Override
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel) {
|
||||
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.addModelBuild(activityTeamInfoAddModel);
|
||||
Assert.isTrue(this.save(activityTeamInfo),StringUtils.format("团购活动添加失败: [{}]", activityTeamInfoAddModel));
|
||||
List<ActivityTeamProductSkuAddModel> teamProductSkuAddModelList = activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList();
|
||||
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfo.getId()));
|
||||
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询商品的详情
|
||||
* @param id 团购活动ID
|
||||
* @return 团购详情
|
||||
*/
|
||||
@Override
|
||||
public ActivityTeamDetailModel findDetailById(Long id) {
|
||||
ActivityTeamInfo activityTeamInfo = this.getById(id);
|
||||
List<ActivityTeamProductSkuModel> activityTeamProductSkuModelList = activityTeamProductSkuInfoService.findListByTeamId(id);
|
||||
return ActivityTeamDetailModel.findSkuSumList(activityTeamInfo,
|
||||
(teamInfoFindByIdRespModelBuilder) -> teamInfoFindByIdRespModelBuilder.projectSkuInfoAddReqList(activityTeamProductSkuModelList).build()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团购活动信息
|
||||
* @param activityTeamInfoUpdModel 团购活动信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
|
||||
boolean update = this.updateById(ActivityTeamInfo.TeamUpdateBuild(activityTeamInfoUpdModel));
|
||||
Assert.isTrue(update,"修改失败");
|
||||
activityTeamProductSkuInfoService.setting(activityTeamInfoUpdModel.getActivityTeamProductSkuSettingModel());
|
||||
return update;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivityTeamInfo> findTeam(Long id) {
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamInfo::getProductId,id);
|
||||
queryWrapper.last("limit 2");
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
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.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
||||
implements ActivityTeamOpenInfoService {
|
||||
|
||||
/**
|
||||
* 通过活动ID和开团类型查询开团数量
|
||||
*
|
||||
* @param teamId 活动ID
|
||||
* @param teamOpenType 开团类型
|
||||
* @return 开团数量
|
||||
*/
|
||||
@Override
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
|
||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamId, teamId);
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamType, teamOpenType.code());
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
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;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
/**
|
||||
* 通过团购活动ID获取团购中最优惠的价格
|
||||
*
|
||||
* @param teamId 团购ID
|
||||
* @return 优惠价格
|
||||
*/
|
||||
@Override
|
||||
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||
|
||||
// 优惠模型集合
|
||||
Optional<TeamProductDiscountPriceModel> discountPriceModelOptional = teamProductSkuInfoList.stream()
|
||||
.map(activityTeamProductSkuInfo -> {
|
||||
ProjectSkuInfo projectSkuInfo = projectSkuCache.getData(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
|
||||
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||
|
||||
if (discountPriceModelOptional.isEmpty()){
|
||||
throw new ServiceException("团购活动下没有商品绑定");
|
||||
}
|
||||
return discountPriceModelOptional.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过活动ID获取 剩余库存
|
||||
*
|
||||
* @param teamId 活动ID
|
||||
* @return 库存
|
||||
*/
|
||||
@Override
|
||||
public TeamProductStockModel getStock(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||
return TeamProductStockModel.builder()
|
||||
.teamStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L, Long::sum))
|
||||
.remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L, Long::sum))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加团购商品SKU
|
||||
*
|
||||
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||
*/
|
||||
@Override
|
||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList) {
|
||||
if (activityTeamProductSkuAddModelList == null || activityTeamProductSkuAddModelList.isEmpty()) {
|
||||
throw new ServiceException("入参添加商品规格模型,不可为空");
|
||||
}
|
||||
this.saveBatch(
|
||||
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过拼团活动ID获取拼团下商品SKU集合
|
||||
*
|
||||
* @param teamId 活动ID
|
||||
* @return 拼团商品SKU集合
|
||||
*/
|
||||
// @Override
|
||||
// public List<ActivityTeamProductSkuModel> findListByTeamId(Long teamId) {
|
||||
// LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 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();
|
||||
// }
|
||||
@Override
|
||||
public List<ActivityTeamProductSkuModel> findListByTeamId(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
List<ActivityTeamProductSkuInfo> list = this.list(queryWrapper);
|
||||
return list.stream().map(ActivityTeamProductSkuModel::FindBuild).toList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
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()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.marketing.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.team.mapper.TeamStrategyExemptionMapper;
|
||||
import com.muyu.marketing.team.service.TeamStrategyExemptionService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.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) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,30 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9209
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-marketing
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 150.158.86.96:8848
|
||||
namespace: 2204a
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 150.158.86.96:8848
|
||||
namespace: 2204a
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.marketing.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-system"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
muyu-marketing营销模块
|
||||
</description>
|
||||
<modules>
|
||||
<module>marketing-common</module>
|
||||
<module>marketing-remote</module>
|
||||
<module>marketing-server</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -9,6 +9,7 @@ import com.muyu.product.domain.RuleInfo;
|
|||
import com.muyu.product.remote.RemoteRuleAttrService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -17,6 +18,7 @@ import java.util.List;
|
|||
* @description: 规格数据获取实现层 默认就读取远程调用
|
||||
* @Date 2024/4/7 下午8:32
|
||||
*/
|
||||
@Service
|
||||
public class RuleCacheDataRemoteImpl implements RuleCacheData {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -80,5 +80,14 @@ public class AttributeGroup extends BaseEntity {
|
|||
.states(attributeGroupEditReq.getStates())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static AttributeGroup editUpdBuild(Long id, String states){
|
||||
return AttributeGroup.builder()
|
||||
.id(id)
|
||||
.states(states)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.product.domain.model.ProductSkuModel;
|
||||
import com.muyu.product.domain.model.ProjectAddModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -159,5 +160,20 @@ public class ProjectInfo extends BaseEntity {
|
|||
.brandId(projectInfoEditReq.getBrandId())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static ProjectInfo editProductBuild(Long id, ProjectInfoSaveReq projectInfoSaveReq){
|
||||
return ProjectInfo.builder()
|
||||
.id(id)
|
||||
.name(projectInfoSaveReq.getProjectAddModel().getName())
|
||||
.brandId(projectInfoSaveReq.getProjectAddModel().getBrandId())
|
||||
.image(projectInfoSaveReq.getProjectAddModel().getImage())
|
||||
.status(projectInfoSaveReq.getProjectAddModel().getStatus())
|
||||
.type(projectInfoSaveReq.getProjectAddModel().getType())
|
||||
.ruleId(projectInfoSaveReq.getProjectAddModel().getRuleId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -115,5 +115,16 @@ public class ProjectSkuInfo extends BaseEntity {
|
|||
.price(productSkuModel.getPrice())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static ProjectSkuInfo saveProductBuild(ProductSkuModel productSkuModel, Supplier<Long> projectId){
|
||||
return ProjectSkuInfo.builder()
|
||||
.projectId(projectId.get())
|
||||
.sku(productSkuModel.getSku())
|
||||
.stock(productSkuModel.getStock())
|
||||
.price(productSkuModel.getPrice())
|
||||
.image(productSkuModel.getImage())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,15 @@ public class RuleInfo extends BaseEntity {
|
|||
.status(ruleInfoEditReq.getStatus())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 修改构造器(指定状态)
|
||||
*/
|
||||
public static RuleInfo editUpdBuild(Long id, String status){
|
||||
return RuleInfo.builder()
|
||||
.id(id)
|
||||
.status(status)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.function.Supplier;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TemplateAttributeGroupModel extends BaseEntity {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
|
@ -49,9 +49,9 @@ public class TemplateAttributeGroupModel extends BaseEntity {
|
|||
* @param attributeList
|
||||
* @return
|
||||
*/
|
||||
public static TemplateAttributeGroupModel attributeGroupBuild(AttributeGroup attributeGroup,
|
||||
Function<Long, List<TemplateAttributeModel>> attributeList){
|
||||
public static TemplateAttributeGroupModel attributeGroupBuild(AttributeGroup attributeGroup, Function<Long, List<TemplateAttributeModel>> attributeList){
|
||||
return TemplateAttributeGroupModel.builder()
|
||||
.id(attributeGroup.getId())
|
||||
.groupName(attributeGroup.getName())
|
||||
.attributeList(attributeList.apply(attributeGroup.getId()))
|
||||
.build();
|
||||
|
|
|
@ -2,9 +2,7 @@ package com.muyu.product.remote.factory;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.remote.RemoteProjectInfoService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import java.util.List;
|
|||
* @description: 远程调熔断器
|
||||
* @Date 2024-4-7 上午 10:59
|
||||
*/
|
||||
@Service
|
||||
public class RemoteProjectSkuFactory implements FallbackFactory<RemoteProjectSkuService> {
|
||||
@Override
|
||||
public RemoteProjectSkuService create (Throwable cause) {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import com.muyu.product.remote.RemoteRuleAttrService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue