fix():拼团服务的增删改查
parent
5e137c9f39
commit
3ac6928c32
|
@ -31,6 +31,11 @@ public class TokenController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录验证
|
||||||
|
* @param form
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
// 用户登录
|
// 用户登录
|
||||||
|
@ -39,6 +44,11 @@ public class TokenController {
|
||||||
return Result.success(tokenService.createToken(userInfo));
|
return Result.success(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@DeleteMapping("logout")
|
@DeleteMapping("logout")
|
||||||
public Result<?> logout (HttpServletRequest request) {
|
public Result<?> logout (HttpServletRequest request) {
|
||||||
String token = SecurityUtils.getToken(request);
|
String token = SecurityUtils.getToken(request);
|
||||||
|
@ -52,6 +62,11 @@ public class TokenController {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户刷新
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("refresh")
|
@PostMapping("refresh")
|
||||||
public Result<?> refresh (HttpServletRequest request) {
|
public Result<?> refresh (HttpServletRequest request) {
|
||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
@ -63,6 +78,11 @@ public class TokenController {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
* @param registerBody
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
||||||
// 用户注册
|
// 用户注册
|
||||||
|
|
|
@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@ -58,6 +59,7 @@ public class QueryModel<T> {
|
||||||
page.setOrders(Arrays.asList(this.isAsc()
|
page.setOrders(Arrays.asList(this.isAsc()
|
||||||
?OrderItem.asc(this.getOrderByColumn())
|
?OrderItem.asc(this.getOrderByColumn())
|
||||||
: OrderItem.desc(this.getOrderByColumn())));
|
: OrderItem.desc(this.getOrderByColumn())));
|
||||||
|
// page.setOrders(List.of(this.isAsc() ? OrderItem.asc(this.getOrderByColumn()) : OrderItem.desc(this.getOrderByColumn())));
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,121 +1,101 @@
|
||||||
package com.muyu.marketing.domain;
|
package com.muyu.marketing.domain;
|
||||||
|
|
||||||
import com.alibaba.ttl.threadpool.agent.internal.javassist.bytecode.AttributeInfo;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.xmlbeans.impl.xb.xsdschema.AttributeGroup;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品拼团信息
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("activity_team_info")
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "activity_team_info", description = "商品拼团信息")
|
@TableName(value = "activity_team_info", autoResultMap = true)
|
||||||
public class ActivityTeamInfo extends BaseEntity {
|
public class ActivityTeamInfo extends BaseEntity {
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 拼团名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 商品ID
|
|
||||||
*/
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品活动图
|
* 主键
|
||||||
*/
|
*/
|
||||||
private String productImage;
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
/**
|
private Long id;
|
||||||
* 活动简介
|
/**
|
||||||
*/
|
* 拼团名称
|
||||||
private String introduction;
|
*/
|
||||||
/**
|
private String name;
|
||||||
* 单位
|
/**
|
||||||
*/
|
* 商品ID
|
||||||
private String unit;
|
*/
|
||||||
/**
|
private Long projectId;
|
||||||
* 轮播图
|
/**
|
||||||
*/
|
* 商品活动图
|
||||||
private String imageList;
|
*/
|
||||||
/**
|
private String productImage;
|
||||||
* 活动结束时间
|
/**
|
||||||
*/
|
* 活动简介
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
private String introduction;
|
||||||
private Date endTime;
|
/**
|
||||||
/**
|
* 单位
|
||||||
* 活动排序
|
*/
|
||||||
*/
|
private String unit;
|
||||||
private Integer sort;
|
/**
|
||||||
/**
|
* 轮播图
|
||||||
* 活动详情
|
*/
|
||||||
*/
|
private String imageList;
|
||||||
private String content;
|
/**
|
||||||
/**
|
* 活动结束时间
|
||||||
* 活动状态
|
*/
|
||||||
*/
|
private Date endTime;
|
||||||
private String status;
|
/**
|
||||||
/**
|
* 活动排序
|
||||||
* 策略类型
|
*/
|
||||||
*/
|
private Long sort;
|
||||||
private String strategyType;
|
/**
|
||||||
/**
|
* 活动详情
|
||||||
* 策略ID
|
*/
|
||||||
*/
|
private String content;
|
||||||
private Long strategyId;
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团活动新增构建器
|
* 公共添加模型,转换成添加对象
|
||||||
*
|
* @param activityTeamInfoAddModel 添加模型
|
||||||
* @param activityTeamInfoAddModel
|
* @return 添加对象
|
||||||
* @return
|
*/
|
||||||
*/
|
public static ActivityTeamInfo addModelBuild(ActivityTeamInfoAddModel activityTeamInfoAddModel){
|
||||||
public static ActivityTeamInfo saveBuildModel(ActivityTeamInfoAddReq activityTeamInfoAddModel, Supplier<String> createBy){
|
return ActivityTeamInfo.builder()
|
||||||
return ActivityTeamInfo.builder()
|
.name(activityTeamInfoAddModel.getName())
|
||||||
.id(activityTeamInfoAddModel.getId())
|
.projectId(activityTeamInfoAddModel.getProductId())
|
||||||
.name(activityTeamInfoAddModel.getName())
|
.productImage(activityTeamInfoAddModel.getProductImage())
|
||||||
.productId(activityTeamInfoAddModel.getProductId())
|
.introduction(activityTeamInfoAddModel.getIntroduction())
|
||||||
.productImage(activityTeamInfoAddModel.getProductImage())
|
.unit(activityTeamInfoAddModel.getUnit())
|
||||||
.introduction(activityTeamInfoAddModel.getIntroduction())
|
.imageList(activityTeamInfoAddModel.getImageList())
|
||||||
.unit(activityTeamInfoAddModel.getUnit())
|
.endTime(activityTeamInfoAddModel.getEndTime())
|
||||||
.imageList(activityTeamInfoAddModel.getImageList())
|
.sort(activityTeamInfoAddModel.getSort())
|
||||||
.endTime(activityTeamInfoAddModel.getEndTime())
|
.content(activityTeamInfoAddModel.getContent())
|
||||||
.sort(activityTeamInfoAddModel.getSort())
|
.status(activityTeamInfoAddModel.getStatus())
|
||||||
.content(activityTeamInfoAddModel.getContent())
|
.strategyType(activityTeamInfoAddModel.getStrategyType())
|
||||||
.strategyType(activityTeamInfoAddModel.getStrategyType())
|
.strategyId(activityTeamInfoAddModel.getStrategyId())
|
||||||
.strategyId(activityTeamInfoAddModel.getStrategyId())
|
.build();
|
||||||
.content(activityTeamInfoAddModel.getContent())
|
}
|
||||||
.status(activityTeamInfoAddModel.getStatus())
|
|
||||||
.createBy(createBy.get())
|
|
||||||
.createTime(new Date())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -13,64 +12,61 @@ import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品拼团规格信息
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("activity_team_open_info")
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "activity_team_open_info", description = "团购活动执行表")
|
@TableName(value = "activity_team_open_info", autoResultMap = true)
|
||||||
public class ActivityTeamOpenInfo extends BaseEntity {
|
public class ActivityTeamOpenInfo extends BaseEntity {
|
||||||
/**
|
|
||||||
* 主键
|
/**
|
||||||
*/
|
* 主键
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
*/
|
||||||
private Long id;
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
/**
|
private long id;
|
||||||
* 团购活动ID
|
/**
|
||||||
*/
|
* 团购活动ID
|
||||||
private Long teamId;
|
*/
|
||||||
/**
|
private long teamId;
|
||||||
* 团购类型
|
/**
|
||||||
*/
|
* 团购类型
|
||||||
private String teamType;
|
*/
|
||||||
/**
|
private String teamType;
|
||||||
* 团购策略
|
/**
|
||||||
*/
|
* 团购策略
|
||||||
private Long teamStrategyId;
|
*/
|
||||||
/**
|
private String teamStrategyId;
|
||||||
* 参团类型
|
/**
|
||||||
*/
|
* 参团类型
|
||||||
private String executiveType;
|
*/
|
||||||
/**
|
private String executiveType;
|
||||||
* 结束团购时间
|
/**
|
||||||
*/
|
* 结束团购时间
|
||||||
private Date endTime;
|
*/
|
||||||
/**
|
private Date endTime;
|
||||||
* 商品ID
|
/**
|
||||||
*/
|
* 商品ID
|
||||||
private Long productId;
|
*/
|
||||||
/**
|
private String productId;
|
||||||
* 商品名称
|
/**
|
||||||
*/
|
* 商品名称
|
||||||
private String productName;
|
*/
|
||||||
/**
|
private String productName;
|
||||||
* 商品规格
|
/**
|
||||||
*/
|
* 商品规格
|
||||||
private String productSku;
|
*/
|
||||||
/**
|
private String productSku;
|
||||||
* 开团标识
|
/**
|
||||||
*/
|
* 开团标识
|
||||||
private String key;
|
*/
|
||||||
/**
|
private String key;
|
||||||
* 订单ID
|
/**
|
||||||
*/
|
* 订单ID
|
||||||
private Long orderId;
|
*/
|
||||||
/**
|
private String orderId;
|
||||||
* 开团状态
|
/**
|
||||||
*/
|
* 开团状态
|
||||||
private String status;
|
*/
|
||||||
|
private String status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.product.domain.ProjectSkuInfo;
|
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -14,79 +13,56 @@ import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品拼团规格信息
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName("activity_team_product_sku_info")
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "activity_team_product_sku_info", description = "商品拼团规格信息表")
|
@TableName(value = "activity_team_product_sku_info", autoResultMap = true)
|
||||||
public class ActivityTeamProductSkuInfo extends BaseEntity {
|
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;
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
/**
|
private Long id;
|
||||||
* 拼团价格
|
/**
|
||||||
*/
|
* 活动ID
|
||||||
private BigDecimal teamPrice;
|
*/
|
||||||
|
private Long teamId;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
/**
|
||||||
|
* 商品SKU
|
||||||
|
*/
|
||||||
|
private String productSku;
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
/**
|
||||||
|
* 剩余库存
|
||||||
|
*/
|
||||||
|
private Long remainStock;
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 拼团规格信息构建
|
* 通过模型钢构件对象
|
||||||
// * @param projectSkuInfo
|
* @param activityTeamProductSkuAddModel 模型
|
||||||
// * @param o
|
* @return 对象
|
||||||
// * @return
|
*/
|
||||||
// */
|
public static ActivityTeamProductSkuInfo modelBuild(ActivityTeamProductSkuAddModel activityTeamProductSkuAddModel) {
|
||||||
// public static ActivityTeamProductSkuInfo productSkuModelBuild(ProjectSkuInfo projectSkuInfo, Object o) {
|
return ActivityTeamProductSkuInfo.builder()
|
||||||
// return ActivityTeamProductSkuInfo.builder()
|
.productId(activityTeamProductSkuAddModel.getProductId())
|
||||||
// .productId(projectSkuInfo.getProjectId())
|
.teamId(activityTeamProductSkuAddModel.getTeamId())
|
||||||
// .productSku(projectSkuInfo.getSku())
|
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||||
// .teamPrice(projectSkuInfo.getPrice())
|
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||||
// .teamStock(projectSkuInfo.getStock())
|
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||||
// .remainStock(projectSkuInfo.getStock())
|
.build();
|
||||||
// .build();
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 拼团规格信息构建
|
|
||||||
// * @param projectSkuInfo
|
|
||||||
// * @param id
|
|
||||||
// * @param o
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// public static ActivityTeamProductSkuInfo productSkuModelBuild(ProjectSkuInfo projectSkuInfo, Long id, Object o) {
|
|
||||||
// return ActivityTeamProductSkuInfo.builder()
|
|
||||||
// .id(id)
|
|
||||||
// .productId(projectSkuInfo.getProjectId())
|
|
||||||
// .productSku(projectSkuInfo.getSku())
|
|
||||||
// .teamPrice(projectSkuInfo.getPrice())
|
|
||||||
// .teamStock(projectSkuInfo.getStock())
|
|
||||||
// .remainStock(projectSkuInfo.getStock())
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
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.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
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,50 @@
|
||||||
|
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.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
|
||||||
|
public class TeamStrategyExemptionHundred 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,50 @@
|
||||||
|
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.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
|
||||||
|
public class TeamStrategyExemptionOrdinary 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,41 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ActivityProductSkuListModel {
|
||||||
|
/**
|
||||||
|
* 活动id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 规格id
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
/**
|
||||||
|
* 规格SKU
|
||||||
|
*/
|
||||||
|
private String sku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动商品修改参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ActivityProductUpdModel {
|
||||||
|
/**
|
||||||
|
* 活动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 ActivityProductUpdResp activityProductUpdResp;
|
||||||
|
/**
|
||||||
|
* 活动详情
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购活动添加模型
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-11-26 09:38
|
||||||
|
*/
|
||||||
|
@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 addBuild(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.getProjectSkuInfoAddReqList()
|
||||||
|
.stream().map(addReq -> ActivityTeamProductSkuAddModel.addReqBuild(addReq,activityTeamInfoSaveReq::getProductId))
|
||||||
|
.toList()
|
||||||
|
).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -8,17 +8,20 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 团购活动列表查询结果模型
|
* 团购活动雷彪查询结果模型
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-11-20 14:18:10
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Builder
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class ActivityTeamInfoListModel {
|
public class ActivityTeamInfoListModel {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 拼团活动ID
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
|
@ -29,48 +32,67 @@ public class ActivityTeamInfoListModel {
|
||||||
* 参团人数
|
* 参团人数
|
||||||
*/
|
*/
|
||||||
private Long addTeamNumber;
|
private Long addTeamNumber;
|
||||||
|
/**
|
||||||
|
* 拼团人数
|
||||||
|
*/
|
||||||
|
private Long attendNumber;
|
||||||
|
/**
|
||||||
|
* 团购结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
/**
|
/**
|
||||||
* 开团人数
|
* 开团人数
|
||||||
*/
|
*/
|
||||||
private Long openTeamNumber;
|
private Long openTeamNumber;
|
||||||
/**
|
/**
|
||||||
* 拼团人数
|
* 拼团商品图片
|
||||||
*/
|
|
||||||
private Long attendTeamNumber;
|
|
||||||
/**
|
|
||||||
* 活动结束时间
|
|
||||||
*/
|
|
||||||
private Date endTime;
|
|
||||||
/**
|
|
||||||
* 图片
|
|
||||||
*/
|
*/
|
||||||
private String productImage;
|
private String productImage;
|
||||||
/**
|
|
||||||
* 拼团价格
|
|
||||||
*/
|
|
||||||
private BigDecimal teamPrice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品价格
|
* 商品价格
|
||||||
*/
|
*/
|
||||||
private BigDecimal productPrice;
|
private BigDecimal productPrice;
|
||||||
|
/**
|
||||||
|
* 剩余库存
|
||||||
|
*/
|
||||||
|
private Long remainStock;
|
||||||
|
/**
|
||||||
|
* 团购状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
/**
|
/**
|
||||||
* 团购库存
|
* 团购库存
|
||||||
*/
|
*/
|
||||||
private Long teamStock;
|
private Long teamStock;
|
||||||
/**
|
|
||||||
* 总库存
|
|
||||||
*/
|
|
||||||
private Long totalStock;
|
|
||||||
/**
|
|
||||||
* 剩余库存
|
|
||||||
*/
|
|
||||||
private Long RemainStock;
|
|
||||||
/**
|
|
||||||
* 活动状态
|
|
||||||
*/
|
|
||||||
private String Status;
|
|
||||||
|
|
||||||
|
|
||||||
|
public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function<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())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.marketing.domain.model;
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.muyu.common.core.web.model.QueryModel;
|
import com.muyu.common.core.web.model.QueryModel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -7,19 +9,29 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购活动雷彪查询模型
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-11-20 14:18:10
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
|
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索关键词
|
* 搜索关键词
|
||||||
*/
|
*/
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 活动状态
|
||||||
*/
|
*/
|
||||||
private String states;
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.marketing.domain.req.ProjectSkuInfoAddReq;
|
||||||
|
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 ActivityTeamProductSkuAddModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购活动ID
|
||||||
|
*/
|
||||||
|
private Long teamId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格SKU
|
||||||
|
*/
|
||||||
|
private String productSku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
|
||||||
|
public static ActivityTeamProductSkuAddModel addReqBuild(ProjectSkuInfoAddReq projectSkuInfoAddReq, Supplier<Long> getProductId) {
|
||||||
|
return ActivityTeamProductSkuAddModel.builder()
|
||||||
|
.teamId(projectSkuInfoAddReq.getId())
|
||||||
|
.productId(getProductId.get())
|
||||||
|
.productSku(projectSkuInfoAddReq.getSku())
|
||||||
|
.teamStock(projectSkuInfoAddReq.getTeamStock())
|
||||||
|
.teamPrice(projectSkuInfoAddReq.getTeamPrice())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团活动商品sku修改模型
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ActivityTeamProductSkuUpdModel {
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long ProductId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ProductSkuAddModel {
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
/**
|
||||||
|
* 商品规格
|
||||||
|
*/
|
||||||
|
private String productSku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.marketing.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格的修改模型
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ProductSkuUpdModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -1,47 +0,0 @@
|
||||||
package com.muyu.marketing.domain.model;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 团购商品优惠券模型
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class TeamProductDisCountPriceModel {
|
|
||||||
/**
|
|
||||||
* 商品价格
|
|
||||||
*/
|
|
||||||
private BigDecimal productPrice;
|
|
||||||
/**
|
|
||||||
* 团购优惠价格
|
|
||||||
*/
|
|
||||||
private BigDecimal teamPrice;
|
|
||||||
/**
|
|
||||||
* 优惠力度
|
|
||||||
*/
|
|
||||||
private BigDecimal discount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过商品价格和团购价格计算出优惠力度
|
|
||||||
* @param productPrice 商品价格
|
|
||||||
* @param teamPrice 团购价格
|
|
||||||
* @return 优惠力度
|
|
||||||
*/
|
|
||||||
public static TeamProductDisCountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
|
||||||
return TeamProductDisCountPriceModel.builder()
|
|
||||||
.productPrice(productPrice)
|
|
||||||
.teamPrice(teamPrice)
|
|
||||||
.discount(
|
|
||||||
BigDecimal.valueOf(productPrice.subtract(teamPrice).divide(productPrice, 2, BigDecimal.ROUND_HALF_UP).doubleValue())
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,17 +8,21 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 团购商品库存模型
|
* 团购商品库存模型
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-11-21 14:04
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Builder
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class TeamProductStockModel {
|
public class TeamProductStockModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团库存
|
* 拼团总库存
|
||||||
*/
|
*/
|
||||||
private Long teamStock;
|
private Long teamStock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团剩余库存
|
* 拼团剩余库存
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.marketing.domain.req;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ActivityProductUpdReq {
|
||||||
|
/**
|
||||||
|
* 活动id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 拼团名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
/**
|
||||||
|
* 商品活动图
|
||||||
|
*/
|
||||||
|
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 ActivityProductUpdResp activityProductUpdResp;
|
||||||
|
/**
|
||||||
|
* 活动详情
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ public class ActivityTeamInfoReq extends PageDomain {
|
||||||
public ActivityTeamInfoListQueryModel buildQueryModel(){
|
public ActivityTeamInfoListQueryModel buildQueryModel(){
|
||||||
return ActivityTeamInfoListQueryModel.builder()
|
return ActivityTeamInfoListQueryModel.builder()
|
||||||
.keyWord(this.keyWord)
|
.keyWord(this.keyWord)
|
||||||
.states(this.states)
|
.status(this.states)
|
||||||
.build()
|
.build()
|
||||||
.domainBuild(this);
|
.domainBuild(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<ProjectSkuInfoAddReq> projectSkuInfoAddReqList;
|
||||||
|
/**
|
||||||
|
* 活动详情
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
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 ProjectSkuInfoAddReq {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格SKU
|
||||||
|
*/
|
||||||
|
private String sku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -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
|
||||||
|
@Builder
|
||||||
|
@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.resp;
|
||||||
|
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ActivityProductUpdResp {
|
||||||
|
/**
|
||||||
|
* 商品修改SkU集合
|
||||||
|
*/
|
||||||
|
private List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品规格idList
|
||||||
|
*/
|
||||||
|
private List<Long> deleteSkuIdList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加商品规格的List
|
||||||
|
*/
|
||||||
|
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.muyu.marketing.domain.resp;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改回显的团购活动信息
|
||||||
|
*
|
||||||
|
* @author DongZeLiang
|
||||||
|
* @date 2024-11-26 09:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ActivityTeamInfoDetailResp {
|
||||||
|
/**
|
||||||
|
* 活动id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 拼团名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
/**
|
||||||
|
* 商品活动图
|
||||||
|
*/
|
||||||
|
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<ActivityTeamProductSkuResp> ActivityTeamProductSkuList;
|
||||||
|
/**
|
||||||
|
* 活动详情
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
}
|
|
@ -1,81 +0,0 @@
|
||||||
//package com.muyu.marketing.domain.resp;
|
|
||||||
//
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.Builder;
|
|
||||||
//import lombok.Data;
|
|
||||||
//import lombok.NoArgsConstructor;
|
|
||||||
//
|
|
||||||
//import javax.validation.constraints.NotNull;
|
|
||||||
//import javax.validation.constraints.Pattern;
|
|
||||||
//import java.math.BigDecimal;
|
|
||||||
//import java.util.Date;
|
|
||||||
//
|
|
||||||
//@Data
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@NoArgsConstructor
|
|
||||||
//@Builder
|
|
||||||
//public class ActivityTeamInfoResp {
|
|
||||||
// /**
|
|
||||||
// * 主键
|
|
||||||
// */
|
|
||||||
// private Long id;
|
|
||||||
// /**
|
|
||||||
// * 拼团名称
|
|
||||||
// */
|
|
||||||
// @NotNull(message = "拼团名称不能为空")
|
|
||||||
// private String name;
|
|
||||||
// /**
|
|
||||||
// * 参团人数
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "拼团人数必须为正整数")
|
|
||||||
// private Long addTeamNumber;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 开团人数
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "开团人数必须为正整数")
|
|
||||||
// private Long openTeamNumber;
|
|
||||||
// /**
|
|
||||||
// * 拼团人数
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "拼团人数必须为正整数")
|
|
||||||
// private Long attendTeamNumber;
|
|
||||||
// /**
|
|
||||||
// * 活动结束时间
|
|
||||||
// */
|
|
||||||
// private Date endTime;
|
|
||||||
// /**
|
|
||||||
// * 图片
|
|
||||||
// */
|
|
||||||
// private String productImage;
|
|
||||||
// /**
|
|
||||||
// * 拼团价格
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^(([1-9][0-9]*)|(([0-9]|[1-9][0-9]*)(\\.[0-9]{1,2})?))$", message = "拼团价格必须为小数")
|
|
||||||
// private BigDecimal teamPrice;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 商品价格
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^(([1-9][0-9]*)|(([0-9]|[1-9][0-9]*)(\\.[0-9]{1,2})?))$", message = "商品价格必须为小数")
|
|
||||||
// private BigDecimal productPrice;
|
|
||||||
// /**
|
|
||||||
// * 总库存
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "总库存必须为正整数")
|
|
||||||
// private Long totalStock;
|
|
||||||
// /**
|
|
||||||
// * 团购库存
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "团购库存必须为正整数")
|
|
||||||
// private Long teamStock;
|
|
||||||
// /**
|
|
||||||
// * 剩余库存
|
|
||||||
// */
|
|
||||||
// @Pattern(regexp = "^[1-9]\\d*$", message = "剩余库存必须为正整数")
|
|
||||||
// private Long RemainStock;
|
|
||||||
// /**
|
|
||||||
// * 活动状态
|
|
||||||
// */
|
|
||||||
// private String Status;
|
|
||||||
//}
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.marketing.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ActivityTeamProductSkuResp {
|
||||||
|
/**
|
||||||
|
* 规格id
|
||||||
|
*/
|
||||||
|
private Long ProductId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格SKU
|
||||||
|
*/
|
||||||
|
private String sku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.marketing.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格数据
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ProductSkuResp {
|
||||||
|
/**
|
||||||
|
* 规格id
|
||||||
|
*/
|
||||||
|
private Long ProductId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
//package com.muyu.marketing.domain.resp;
|
|
||||||
//
|
|
||||||
//import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
//import io.swagger.annotations.ApiModelProperty;
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.Data;
|
|
||||||
//import lombok.NoArgsConstructor;
|
|
||||||
//
|
|
||||||
//import java.math.BigDecimal;
|
|
||||||
//
|
|
||||||
//@Data
|
|
||||||
//@NoArgsConstructor
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@TableName(value = "activity_team_product_sku_info")
|
|
||||||
//public class RuleInfo {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 主键
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @TableId(value = "id",type = IdType.AUTO)
|
|
||||||
// @ApiModelProperty("主键")
|
|
||||||
// private Long id;
|
|
||||||
// /**
|
|
||||||
// *规格Sku
|
|
||||||
// */
|
|
||||||
// private String ruleSku;
|
|
||||||
// /**
|
|
||||||
// *拼团库存
|
|
||||||
// */
|
|
||||||
// private Long teamStock;
|
|
||||||
// /**
|
|
||||||
// * 拼团价格
|
|
||||||
// */
|
|
||||||
// private BigDecimal teamPrice;
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -1,25 +0,0 @@
|
||||||
//package com.muyu.marketing.domain.resp;
|
|
||||||
//
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.Data;
|
|
||||||
//import lombok.NoArgsConstructor;
|
|
||||||
//
|
|
||||||
//import java.math.BigDecimal;
|
|
||||||
//
|
|
||||||
//@Data
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@NoArgsConstructor
|
|
||||||
//public class Strategy {
|
|
||||||
// /**
|
|
||||||
// * 商品规格id
|
|
||||||
// */
|
|
||||||
// private Long productSkuId;
|
|
||||||
// /**
|
|
||||||
// * 拼团价格
|
|
||||||
// */
|
|
||||||
// private BigDecimal price;
|
|
||||||
// /**
|
|
||||||
// * 拼团库存
|
|
||||||
// */
|
|
||||||
// private Long stock;
|
|
||||||
//}
|
|
|
@ -1,24 +1,22 @@
|
||||||
package com.muyu.marketing.domain.resp;
|
package com.muyu.marketing.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品拼团列表信息响应
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Builder
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class TeamInfoListResp {
|
public class TeamInfoListResp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 拼团活动ID
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
|
@ -29,47 +27,63 @@ public class TeamInfoListResp {
|
||||||
* 参团人数
|
* 参团人数
|
||||||
*/
|
*/
|
||||||
private Long addTeamNumber;
|
private Long addTeamNumber;
|
||||||
|
/**
|
||||||
|
* 拼团人数
|
||||||
|
*/
|
||||||
|
private Long attendNumber;
|
||||||
|
/**
|
||||||
|
* 团购结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
/**
|
/**
|
||||||
* 开团人数
|
* 开团人数
|
||||||
*/
|
*/
|
||||||
private Long openTeamNumber;
|
private Long openTeamNumber;
|
||||||
/**
|
/**
|
||||||
* 拼团人数
|
* 拼团商品图片
|
||||||
*/
|
|
||||||
private Long attendTeamNumber;
|
|
||||||
/**
|
|
||||||
* 活动结束时间
|
|
||||||
*/
|
|
||||||
private Date endTime;
|
|
||||||
/**
|
|
||||||
* 图片
|
|
||||||
*/
|
*/
|
||||||
private String productImage;
|
private String productImage;
|
||||||
/**
|
|
||||||
* 拼团价格
|
|
||||||
*/
|
|
||||||
private BigDecimal teamPrice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品价格
|
* 商品价格
|
||||||
*/
|
*/
|
||||||
private BigDecimal productPrice;
|
private BigDecimal productPrice;
|
||||||
/**
|
/**
|
||||||
* 总库存
|
* 剩余库存
|
||||||
*/
|
*/
|
||||||
private Long totalStock;
|
private Long remainStock;
|
||||||
|
/**
|
||||||
|
* 团购状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
/**
|
/**
|
||||||
* 团购库存
|
* 团购库存
|
||||||
*/
|
*/
|
||||||
private Long teamStock;
|
private Long teamStock;
|
||||||
/**
|
|
||||||
* 剩余库存
|
|
||||||
*/
|
|
||||||
private Long RemainStock;
|
|
||||||
/**
|
|
||||||
* 活动状态
|
|
||||||
*/
|
|
||||||
private String Status;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表查询结果,构建为响应对象
|
||||||
|
* @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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,5 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,21 +1,21 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
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">
|
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>
|
<parent>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-marketing</artifactId>
|
<artifactId>muyu-marketing</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>marketing-server</artifactId>
|
<artifactId>marketing-server</artifactId>
|
||||||
|
|
||||||
<description>
|
<properties>
|
||||||
marketing-server系统模块
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
</description>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
@ -79,7 +79,27 @@
|
||||||
<artifactId>muyu-common-swagger</artifactId>
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
</dependency>
|
</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>marketing-remote</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 商品服务 缓存依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-product-cache</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>marketing-common</artifactId>
|
<artifactId>marketing-common</artifactId>
|
||||||
|
@ -88,18 +108,11 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-product-cache</artifactId>
|
<artifactId>marketing-common</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun.oss</groupId>
|
|
||||||
<artifactId>aliyun-sdk-oss</artifactId>
|
|
||||||
<version>3.15.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>muyu-file</artifactId>
|
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-product-server</artifactId>
|
<artifactId>muyu-product-server</artifactId>
|
||||||
|
@ -133,5 +146,4 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
</project>
|
||||||
</project>
|
|
|
@ -16,7 +16,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.muyu.marketing.mapper")
|
|
||||||
public class MuYuMarketingApplication {
|
public class MuYuMarketingApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(MuYuMarketingApplication.class, args);
|
SpringApplication.run(MuYuMarketingApplication.class, args);
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.muyu.marketing.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||||
|
import com.muyu.marketing.domain.req.ActivityProductUpdReq;
|
||||||
|
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||||
|
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||||
|
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||||
|
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||||
|
import com.muyu.marketing.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 activityTeamProductSkuInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询营销团购活动列表
|
||||||
|
* @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());
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加营销团购活动
|
||||||
|
*/
|
||||||
|
@PostMapping("insert")
|
||||||
|
public Result<String> insert(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
||||||
|
// 保存活动信息
|
||||||
|
activityTeamInfoService.save(ActivityTeamInfoAddModel.addBuild(activityTeamInfoSaveReq));
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营销团购活动信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/{teamId}")
|
||||||
|
public Result<ActivityTeamInfoDetailResp> getTeamInfo(@PathVariable("teamId") Long teamId){
|
||||||
|
return Result.success(activityTeamInfoService.getActivityByTeamId(teamId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营销活动的修改
|
||||||
|
*/
|
||||||
|
@PutMapping("update")
|
||||||
|
public Result<String> update(@RequestBody ActivityProductUpdReq activityProductUpdReq){
|
||||||
|
activityTeamInfoService.edit(activityProductUpdReq);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购活动列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/teamList")
|
||||||
|
public Result<TableDataInfo<ActivityTeamInfo>> teamList(){
|
||||||
|
List<ActivityTeamInfo> list = activityTeamInfoService.list();
|
||||||
|
TableDataInfo<ActivityTeamInfo> tableDataInfo = new TableDataInfo<>();
|
||||||
|
tableDataInfo.setRows(list);
|
||||||
|
tableDataInfo.setTotal(list.size());
|
||||||
|
return Result.success(tableDataInfo);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,46 +0,0 @@
|
||||||
package com.muyu.marketing.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
|
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
|
|
||||||
|
|
||||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
|
||||||
import com.muyu.marketing.util.OssUtil;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
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.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/activity")
|
|
||||||
public class ActivityTeamInfoController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActivityTeamInfoService activityTeamInfoService;
|
|
||||||
|
|
||||||
@PostMapping("list")
|
|
||||||
public Result<TableDataInfo<ActivityTeamInfoListModel>> list(@RequestBody ActivityTeamInfoReq activityTeamInfoReq) {
|
|
||||||
TableDataInfo<ActivityTeamInfoListModel> query = activityTeamInfoService.query(activityTeamInfoReq.buildQueryModel());
|
|
||||||
return Result.success(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增拼团
|
|
||||||
*/
|
|
||||||
@Log(title = "拼团", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public Result add(@RequestBody ActivityTeamInfoAddReq activityTeamInfoAddReq) {
|
|
||||||
|
|
||||||
return activityTeamInfoService.insert(activityTeamInfoAddReq);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.marketing.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.marketing.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
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.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper<TeamStrategyExemptionOrdinary> {
|
||||||
|
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
package com.muyu.marketing.remote;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.product.domain.ProjectSkuInfo;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@FeignClient(value = "muyu-product")
|
|
||||||
public interface ProjectRemoteService {
|
|
||||||
@GetMapping("/sku/list/{projectId}")
|
|
||||||
public Result<List<ProjectSkuInfo>> listByProjectId(@PathVariable("projectId") Long projectId);
|
|
||||||
}
|
|
|
@ -4,25 +4,39 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
|
import com.muyu.marketing.domain.req.ActivityProductUpdReq;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过查询模型团购活动表
|
* 通过查询模型查询团购活动列表
|
||||||
* @param activityTeamInfoListQueryModel 团购查询模型
|
* @param activityTeamInfoListQueryModel 团购活动查询模型
|
||||||
* @return 团购活动列表
|
* @return 团购活动列表
|
||||||
*/
|
*/
|
||||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增团购活动
|
* 通过添加模型,去进行商品拼团活动的操作
|
||||||
* @param activityTeamInfoAddReq
|
* @param activityTeamInfoAddModel 团购添加模型
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq);
|
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询团购活动详情
|
||||||
|
*/
|
||||||
|
ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团购活动信息
|
||||||
|
* @param activityProductUpdReq
|
||||||
|
*/
|
||||||
|
void edit(ActivityProductUpdReq activityProductUpdReq);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,30 +5,30 @@ import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||||
|
|
||||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据活动id和类型获取团队人数
|
* 通过活动ID和开团类型查询开团数量
|
||||||
* @param teamId 活动id
|
* @param teamId 活动ID
|
||||||
* @param teamOpenType 开团类型
|
* @param teamOpenType 开团类型
|
||||||
* @return 开团数量
|
* @return 开团数量
|
||||||
*/
|
*/
|
||||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType);
|
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据活动id获取开团人数
|
* 根据活动ID获取开团数量
|
||||||
* @param teamId
|
* @param teamId 团购活动ID
|
||||||
* @return
|
* @return 开团数量
|
||||||
*/
|
*/
|
||||||
public default Long getTeamOpenNumberByTeamId(Long teamId) {
|
public default Long getTeamOpenTypeNumberByTeamId(Long teamId){
|
||||||
return getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM);
|
return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据活动id获取参团人数
|
* 根据活动ID获取参团数量
|
||||||
* @param teamId
|
* @param teamId 团购活动ID
|
||||||
* @return
|
* @return 参团数量
|
||||||
*/
|
*/
|
||||||
public default Long getTeamInNumberByTeamId(Long teamId) {
|
public default Long getTeamInTypeNumberByTeamId(Long teamId){
|
||||||
return getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM);
|
return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,41 +2,56 @@ package com.muyu.marketing.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
import com.muyu.marketing.domain.model.*;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
|
||||||
import com.muyu.marketing.domain.model.TeamProductDisCountPriceModel;
|
|
||||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||||
|
|
||||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId) {
|
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId){
|
||||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据拼团id获取拼团价格
|
|
||||||
*
|
|
||||||
* @param teamId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public TeamProductDisCountPriceModel getDiscountPrice(Long teamId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过活动id获取剩余库存
|
* 通过团购活动ID获取团购中最优惠的价格
|
||||||
*
|
* @param teamId 团购ID
|
||||||
* @param teamId
|
* @return 优惠价格
|
||||||
|
*/
|
||||||
|
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动ID获取 剩余库存
|
||||||
|
* @param teamId 活动ID
|
||||||
* @return 库存
|
* @return 库存
|
||||||
*/
|
*/
|
||||||
public TeamProductStockModel getStock(Long teamId);
|
public TeamProductStockModel getStock(Long teamId);
|
||||||
|
|
||||||
|
|
||||||
List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId);
|
/**
|
||||||
|
* 添加团购商品SKU
|
||||||
|
* @param activityTeamProductSkuAddModelList 团购商品SKU添加模型集合
|
||||||
|
*/
|
||||||
|
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动id查询活动商品规格信息
|
||||||
|
*/
|
||||||
|
public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品规格
|
||||||
|
*/
|
||||||
|
public boolean editBatchActivityTeamProductSkuUpdModelList(List<ActivityTeamProductSkuUpdModel> productSkuUpdList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格的批量删除
|
||||||
|
*/
|
||||||
|
public boolean deleteBatchByTeamIds(List<Long> id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.muyu.marketing.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||||
|
import com.muyu.marketing.strategy.ActivityTeamStrategy;
|
||||||
|
|
||||||
|
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred>, ActivityTeamStrategy {
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.muyu.marketing.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||||
|
import com.muyu.marketing.strategy.ActivityTeamStrategy;
|
||||||
|
|
||||||
|
public interface TeamStrategyExemptionOrdinaryService extends ActivityTeamStrategy,IService<TeamStrategyExemptionOrdinary> {
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.muyu.marketing.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||||
|
import com.muyu.marketing.strategy.ActivityTeamStrategy;
|
||||||
|
|
||||||
|
public interface TeamStrategyExemptionService extends ActivityTeamStrategy, IService<TeamStrategyExemption> {
|
||||||
|
}
|
|
@ -4,28 +4,32 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.core.utils.bean.BeanUtils;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
|
import com.muyu.marketing.domain.req.ActivityProductUpdReq;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamProductSkuResp;
|
||||||
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
||||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||||
import com.muyu.marketing.service.ActivityTeamOpenInfoService;
|
import com.muyu.marketing.service.ActivityTeamOpenInfoService;
|
||||||
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
||||||
import com.muyu.product.domain.RuleInfo;
|
|
||||||
import com.muyu.product.service.ProjectInfoService;
|
|
||||||
import com.muyu.marketing.remote.ProjectRemoteService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.Date;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo> implements ActivityTeamInfoService {
|
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||||
|
implements ActivityTeamInfoService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||||
|
@ -34,91 +38,180 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
||||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private ProjectInfoService projectInfoService;
|
// private ActivityTeamInfoMapper activityTeamInfoMapper;
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private ProjectRemoteService projectRemoteService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||||
|
// 查询条件
|
||||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 关键字查询
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord());
|
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord());
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStates()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStates());
|
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStatus());
|
||||||
|
|
||||||
|
/**
|
||||||
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(
|
* Object<T> -> 创建对象的时候进行的占用
|
||||||
activityTeamInfoListQueryModel.buildPage()
|
* <T> Result<T> 以方法返回值为占用
|
||||||
, queryWrapper);
|
*/
|
||||||
|
// 分页查询
|
||||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo();
|
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(), queryWrapper);
|
||||||
|
// 查询数据列表
|
||||||
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
||||||
|
// 数据转换
|
||||||
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
|
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
|
||||||
.map(activityTeamInfo -> {
|
.map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
|
||||||
Long addTeamNumber = activityTeamOpenInfoService.getTeamOpenNumberByTeamId(activityTeamInfo.getId());
|
(activityTeamInfoListModelBuilder) -> {
|
||||||
|
//获取折扣价
|
||||||
Long openTeamNumber = activityTeamOpenInfoService.getTeamInNumberByTeamId(activityTeamInfo.getId());
|
TeamProductDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
|
||||||
|
//根据活动id获取库存模型
|
||||||
TeamProductDisCountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
|
TeamProductStockModel teamProductStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
|
||||||
|
//获取已开团和已参团人数
|
||||||
TeamProductStockModel productStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
|
Long teamOpenTypeNumber = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId());
|
||||||
|
Long teamInTypeNumber = activityTeamOpenInfoService.getTeamInTypeNumberByTeamId(activityTeamInfo.getId());
|
||||||
return ActivityTeamInfoListModel.builder()
|
//封装活动详情
|
||||||
.id(activityTeamInfo.getId())
|
return activityTeamInfoListModelBuilder
|
||||||
.name(activityTeamInfo.getName())
|
.openTeamNumber(teamOpenTypeNumber)
|
||||||
.addTeamNumber(addTeamNumber)
|
.addTeamNumber(teamInTypeNumber)
|
||||||
.openTeamNumber(openTeamNumber)
|
.attendNumber(teamOpenTypeNumber + teamInTypeNumber)
|
||||||
.attendTeamNumber(openTeamNumber + addTeamNumber)
|
.teamPrice(discountPrice.getTeamPrice())
|
||||||
.endTime(activityTeamInfo.getEndTime())
|
.productPrice(discountPrice.getProductPrice())
|
||||||
.productImage(activityTeamInfo.getProductImage())
|
.teamStock(teamProductStockModel.getTeamStock())
|
||||||
.teamPrice(discountPrice.getTeamPrice())
|
.remainStock(teamProductStockModel.getRemainStock())
|
||||||
.productPrice(discountPrice.getProductPrice())
|
.build();
|
||||||
.teamStock(productStockModel.getTeamStock())
|
})).toList();
|
||||||
.RemainStock(productStockModel.getRemainStock())
|
// 封装分页数据
|
||||||
.Status(activityTeamInfo.getStatus())
|
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo<>();
|
||||||
.build();
|
|
||||||
}).toList();
|
|
||||||
tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
|
tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
|
||||||
tableDataInfo.setRows(activityTeamInfoListModels);
|
tableDataInfo.setRows(activityTeamInfoListModels);
|
||||||
return tableDataInfo;
|
return tableDataInfo;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增拼团活动
|
* 通过添加模型,去进行商品拼团活动的操作
|
||||||
* @param activityTeamInfoAddReq
|
*
|
||||||
|
* @param activityTeamInfoAddModel 团购添加模型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel) {
|
||||||
|
// 添加团购活动
|
||||||
|
boolean save = this.save(ActivityTeamInfo.addModelBuild(activityTeamInfoAddModel));
|
||||||
|
//判断是否添加成功
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException(
|
||||||
|
StringUtils.format("团购活动添加失败:[{}]", activityTeamInfoAddModel)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//拼团活动添加后添加商品SKU
|
||||||
|
this.activityTeamProductSkuInfoService.batchSave(
|
||||||
|
activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询活动详情
|
||||||
|
*
|
||||||
|
* @param teamId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq) {
|
public ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId) {
|
||||||
//构建活动信息
|
//根据id查询活动详情
|
||||||
ActivityTeamInfo activityTeamInfo=ActivityTeamInfo.saveBuildModel(activityTeamInfoAddReq,SecurityUtils::getUsername);
|
ActivityTeamInfo activityTeamInfo = getById(teamId);
|
||||||
//插入活动信息
|
//封装活动详情
|
||||||
this.save(activityTeamInfo);
|
ActivityTeamInfoDetailResp activityTeamInfoDetailResp = new ActivityTeamInfoDetailResp();
|
||||||
//构建拼团规则信息
|
//根据活动id查询活动商品SKU集合
|
||||||
List<RuleInfo> ruleInfoList = activityTeamInfoAddReq.getRuleInfoList();
|
List<ActivityProductSkuListModel> teamProductSkuInfoList = activityTeamProductSkuInfoService.getTeamProductSkuInfoListByTeamId(teamId);
|
||||||
//构建拼团规则明细
|
if (teamProductSkuInfoList != null) {
|
||||||
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = ruleInfoList.stream().map(ruleInfo -> {
|
//定义一个空集合
|
||||||
ActivityTeamProductSkuInfo teamProductSkuInfo = ActivityTeamProductSkuInfo.builder()
|
ArrayList<ActivityTeamProductSkuResp> activityProductSkuList = new ArrayList<>();
|
||||||
.id(ruleInfo.getId())
|
for (ActivityProductSkuListModel activityProductSkuListModel : teamProductSkuInfoList) {
|
||||||
.teamId(activityTeamInfo.getId())
|
Long id = activityProductSkuListModel.getId();
|
||||||
.productId(activityTeamInfoAddReq.getProductId())
|
//根据id查询
|
||||||
.teamStock(ruleInfo.getTeamStock())
|
ActivityTeamProductSkuInfo activityTeamProductSkuInfo = activityTeamProductSkuInfoService.getById(id);
|
||||||
.teamPrice(ruleInfo.getTeamPrice())
|
//添加到集合中
|
||||||
.productSku(ruleInfo.getRuleSku())
|
activityProductSkuList.add(
|
||||||
.createTime(new Date())
|
ActivityTeamProductSkuResp.builder()
|
||||||
.updateTime(new Date())
|
.ProductId(activityTeamProductSkuInfo.getProductId())
|
||||||
.createBy(SecurityUtils.getUsername())
|
.sku(activityTeamProductSkuInfo.getProductSku())
|
||||||
.updateBy(SecurityUtils.getUsername())
|
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||||
.remark(ruleInfo.getRemark())
|
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||||
.params(ruleInfo.getParams())
|
.build()
|
||||||
.searchValue(ruleInfo.getSearchValue())
|
);
|
||||||
.build();
|
}
|
||||||
return teamProductSkuInfo;
|
//赋值
|
||||||
}).toList();
|
activityTeamInfoDetailResp.setActivityTeamProductSkuList(activityProductSkuList);
|
||||||
//批量插入拼团规则明细
|
//克隆到activityTeamInfo
|
||||||
activityTeamProductSkuInfoService.saveBatch(activityTeamProductSkuInfoList);
|
BeanUtils.copyBeanProp(activityTeamInfoDetailResp, activityTeamInfo);
|
||||||
return Result.success(200,"添加成功");
|
}
|
||||||
|
return activityTeamInfoDetailResp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团购活动信息
|
||||||
|
* @param activityProductUpdReq
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void edit(ActivityProductUpdReq activityProductUpdReq) {
|
||||||
|
//获取活动商品SKU
|
||||||
|
ActivityProductUpdResp activityProductUpdResp = activityProductUpdReq.getActivityProductUpdResp();
|
||||||
|
//获取需要删除的SKU集合
|
||||||
|
List<Long> deleteSkuIdList = activityProductUpdResp.getDeleteSkuIdList();
|
||||||
|
//判断是否为空
|
||||||
|
if (deleteSkuIdList != null){
|
||||||
|
activityTeamProductSkuInfoService.deleteBatchByTeamIds(deleteSkuIdList);
|
||||||
|
}
|
||||||
|
//获取需要修改的SKU集合
|
||||||
|
List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuList = activityProductUpdResp.getActivityTeamProductSkuUpdList();
|
||||||
|
//判断是否为空
|
||||||
|
if (activityTeamProductSkuList != null){
|
||||||
|
activityTeamProductSkuList.stream().map(productSkuUpdModel -> {
|
||||||
|
return ProductSkuUpdModel.builder()
|
||||||
|
.productId(productSkuUpdModel.getProductId())
|
||||||
|
.teamPrice(productSkuUpdModel.getTeamPrice())
|
||||||
|
.teamStock(productSkuUpdModel.getTeamStock())
|
||||||
|
.build();
|
||||||
|
}).toList();
|
||||||
|
//批量修改SKU集合
|
||||||
|
activityTeamProductSkuInfoService.editBatchActivityTeamProductSkuUpdModelList(activityTeamProductSkuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取要添加的SKU集合
|
||||||
|
List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddList = activityProductUpdResp.getActivityTeamProductSkuAddList();
|
||||||
|
//判断是否为空
|
||||||
|
if (activityTeamProductSkuAddList != null){
|
||||||
|
activityTeamProductSkuAddList.stream().map(productSkuAddModel -> {
|
||||||
|
return ProductSkuAddModel.builder()
|
||||||
|
.productId(productSkuAddModel.getProductId())
|
||||||
|
.teamPrice(productSkuAddModel.getTeamPrice())
|
||||||
|
.teamStock(productSkuAddModel.getTeamStock())
|
||||||
|
.productSku(productSkuAddModel.getProductSku())
|
||||||
|
.build();
|
||||||
|
}).toList();
|
||||||
|
//批量添加SKU集合
|
||||||
|
activityTeamProductSkuInfoService.batchSave(activityTeamProductSkuAddList);
|
||||||
|
|
||||||
|
}
|
||||||
|
//修改活动信息
|
||||||
|
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.builder()
|
||||||
|
.id(activityProductUpdReq.getId())
|
||||||
|
.name(activityProductUpdReq.getName())
|
||||||
|
.projectId(activityProductUpdReq.getProjectId())
|
||||||
|
.productImage(activityProductUpdReq.getProductImage())
|
||||||
|
.introduction(activityProductUpdReq.getIntroduction())
|
||||||
|
.unit(activityProductUpdReq.getUnit())
|
||||||
|
.imageList(activityProductUpdReq.getImageList())
|
||||||
|
.endTime(activityProductUpdReq.getEndTime())
|
||||||
|
.sort(activityProductUpdReq.getSort())
|
||||||
|
.content(activityProductUpdReq.getContent())
|
||||||
|
.status(activityProductUpdReq.getStatus())
|
||||||
|
.strategyType(activityProductUpdReq.getStrategyType())
|
||||||
|
.strategyId(activityProductUpdReq.getStrategyId())
|
||||||
|
.build();
|
||||||
|
//修改拼团活动
|
||||||
|
updateById(activityTeamInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -9,8 +9,16 @@ import com.muyu.marketing.service.ActivityTeamOpenInfoService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo> implements ActivityTeamOpenInfoService {
|
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
||||||
|
implements ActivityTeamOpenInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动ID和开团类型查询开团数量
|
||||||
|
*
|
||||||
|
* @param teamId 活动ID
|
||||||
|
* @param teamOpenType 开团类型
|
||||||
|
* @return 开团数量
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
|
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
|
||||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
|
@ -1,67 +1,155 @@
|
||||||
package com.muyu.marketing.service.impl;
|
package com.muyu.marketing.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.ActivityTeamProductSkuInfo;
|
||||||
|
import com.muyu.marketing.domain.model.*;
|
||||||
import com.muyu.marketing.domain.model.TeamProductDisCountPriceModel;
|
|
||||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
|
||||||
import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper;
|
import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper;
|
||||||
|
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||||
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
||||||
import com.muyu.product.cache.ProjectSkuCache;
|
import com.muyu.product.cache.ProjectSkuCache;
|
||||||
import com.muyu.product.domain.ProjectSkuInfo;
|
import com.muyu.product.domain.ProjectSkuInfo;
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.ArrayList;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.rmi.ServerException;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo> implements ActivityTeamProductSkuInfoService {
|
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
|
||||||
|
implements ActivityTeamProductSkuInfoService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSkuCache projectSkuCache;
|
private ProjectSkuCache projectSkuCache;
|
||||||
|
@Autowired
|
||||||
|
private @Lazy ActivityTeamInfoService activityTeamInfoService;
|
||||||
|
@Autowired
|
||||||
|
private ActivityTeamProductSkuInfoMapper activityTeamProductSkuInfoMapper;
|
||||||
|
|
||||||
@SneakyThrows
|
/**
|
||||||
|
* 通过团购活动ID获取团购中最优惠的价格
|
||||||
|
* @param teamId 团购ID
|
||||||
|
* @return 优惠价格
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TeamProductDisCountPriceModel getDiscountPrice(Long teamId) {
|
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) {
|
||||||
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||||
|
// 优惠模型集合
|
||||||
|
Optional<TeamProductDiscountPriceModel> discountPriceModelOptional = teamProductSkuInfoList.stream()
|
||||||
|
.map(activityTeamProductSkuInfo -> {
|
||||||
|
// 根据商品ID和商品SKU查询商品信息
|
||||||
|
ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
|
||||||
|
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||||
|
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||||
|
|
||||||
Optional<TeamProductDisCountPriceModel> disCountPriceModelOptional = activityTeamProductSkuInfoList.stream().map(
|
if (discountPriceModelOptional.isEmpty()) {
|
||||||
activityTeamProductSkuInfo -> {
|
throw new ServiceException("团购活动下没有商品绑定");
|
||||||
ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
|
|
||||||
|
|
||||||
return TeamProductDisCountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
|
||||||
}).sorted(Comparator.comparing(TeamProductDisCountPriceModel::getDiscount))
|
|
||||||
.findFirst();
|
|
||||||
if (disCountPriceModelOptional.isEmpty()) {
|
|
||||||
throw new ServerException("没有找到商品拼团信息");
|
|
||||||
}
|
}
|
||||||
return disCountPriceModelOptional.get();
|
return discountPriceModelOptional.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动ID获取 剩余库存
|
||||||
|
*
|
||||||
|
* @param teamId 活动ID
|
||||||
|
* @return 库存
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TeamProductStockModel getStock(Long teamId) {
|
public TeamProductStockModel getStock(Long teamId) {
|
||||||
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
//根据活动id查询团购商品SKU集合
|
||||||
|
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||||
|
//封装返回对象
|
||||||
return TeamProductStockModel.builder()
|
return TeamProductStockModel.builder()
|
||||||
.teamStock(activityTeamProductSkuInfoList.stream().mapToLong(ActivityTeamProductSkuInfo::getTeamStock).sum())
|
.teamStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L, Long::sum))
|
||||||
.remainStock(activityTeamProductSkuInfoList.stream().mapToLong(ActivityTeamProductSkuInfo::getRemainStock).sum())
|
.remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L, Long::sum))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据商品id获取商品拼团规格信息
|
* 添加团购商品SKU
|
||||||
* @param productId
|
*
|
||||||
|
* @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
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId) {
|
public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId) {
|
||||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<ActivityTeamProductSkuInfo>().eq(ActivityTeamProductSkuInfo::getProductId, productId);
|
//根据活动id查询团购商品SKU集合
|
||||||
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.list(queryWrapper);
|
List<ActivityTeamProductSkuInfo> activityTeamProductSkuList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||||
return activityTeamProductSkuInfoList;
|
//封装返回对象
|
||||||
|
ArrayList<ActivityProductSkuListModel> activityProductSkuList = new ArrayList<>();
|
||||||
|
//遍历
|
||||||
|
for (ActivityTeamProductSkuInfo activityTeamProductSkuInfo : activityTeamProductSkuList) {
|
||||||
|
//添加到集合中
|
||||||
|
activityProductSkuList.add(ActivityProductSkuListModel.builder()
|
||||||
|
.id(activityTeamProductSkuInfo.getId())
|
||||||
|
.productId(activityTeamProductSkuInfo.getProductId())
|
||||||
|
.sku(activityTeamProductSkuInfo.getProductSku())
|
||||||
|
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||||
|
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
return activityProductSkuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑团购商品SKU集合
|
||||||
|
*
|
||||||
|
* @param productSkuUpdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean editBatchActivityTeamProductSkuUpdModelList(List<ActivityTeamProductSkuUpdModel> productSkuUpdList) {
|
||||||
|
//创建updateWrapper
|
||||||
|
LambdaUpdateWrapper<ActivityTeamProductSkuInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
//遍历集合
|
||||||
|
for (ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel : productSkuUpdList) {
|
||||||
|
//赋值
|
||||||
|
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamPrice, activityTeamProductSkuUpdModel.getTeamPrice());
|
||||||
|
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamStock, activityTeamProductSkuUpdModel.getTeamStock());
|
||||||
|
updateWrapper.eq(ActivityTeamProductSkuInfo::getProductId, activityTeamProductSkuUpdModel.getProductId());
|
||||||
|
}
|
||||||
|
//返回
|
||||||
|
return this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格的批量删除
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteBatchByTeamIds(List<Long> id) {
|
||||||
|
//创建updateWrapper
|
||||||
|
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//根据id查询
|
||||||
|
List<Long> productIdList = activityTeamProductSkuInfoMapper.selectList(lambdaQueryWrapper).stream().map(ActivityTeamProductSkuInfo::getProductId).toList();
|
||||||
|
//判断集合是否为空
|
||||||
|
if (productIdList == null && productIdList.isEmpty()) {
|
||||||
|
throw new ServiceException("该团购下没有商品");
|
||||||
|
}
|
||||||
|
return this.removeByIds(productIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.marketing.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||||
|
import com.muyu.marketing.mapper.TeamStrategyExemptionHundredMapper;
|
||||||
|
import com.muyu.marketing.service.TeamStrategyExemptionHundredService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("team_strategy_exemption_hundred")
|
||||||
|
@Log4j2
|
||||||
|
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
|
||||||
|
implements TeamStrategyExemptionHundredService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openTeam(Long activityTeamId) {
|
||||||
|
log.info("参加-百人团 -[{}]",activityTeamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTeam(Long teamId, String orderNumber) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void backTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settle(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.marketing.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||||
|
import com.muyu.marketing.mapper.TeamStrategyExemptionOrdinaryMapper;
|
||||||
|
import com.muyu.marketing.service.TeamStrategyExemptionOrdinaryService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("team_strategy_exemption_ordinary")
|
||||||
|
@Log4j2
|
||||||
|
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
|
||||||
|
implements TeamStrategyExemptionOrdinaryService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openTeam(Long activityTeamId) {
|
||||||
|
log.info("参加-普通团 -[{}]",activityTeamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTeam(Long teamId, String orderNumber) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void backTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settle(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.marketing.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||||
|
import com.muyu.marketing.mapper.TeamStrategyExemptionMapper;
|
||||||
|
import com.muyu.marketing.service.TeamStrategyExemptionService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("team_strategy_exemption")
|
||||||
|
@Log4j2
|
||||||
|
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||||
|
implements TeamStrategyExemptionService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openTeam(Long activityTeamId) {
|
||||||
|
log.info("参加-免单团 -[{}]",activityTeamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTeam(Long teamId, String orderNumber) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void backTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settle(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.marketing.strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购活动策略
|
||||||
|
*/
|
||||||
|
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,47 @@
|
||||||
|
package com.muyu.marketing.strategy.impl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
|
import com.muyu.marketing.strategy.ActivityTeamStrategy;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Primary
|
||||||
|
public class ActivityTeamStrategyImpl implements ActivityTeamStrategy {
|
||||||
|
@Override
|
||||||
|
public void openTeam(Long activityTeamId) {
|
||||||
|
String activityTeamType = null;
|
||||||
|
if (activityTeamId==null){
|
||||||
|
throw new ServiceException("activityTeamId 不能为空");
|
||||||
|
}else if (activityTeamId==1){
|
||||||
|
activityTeamType="team_strategy_exemption_hundred";
|
||||||
|
}else if (activityTeamId==2){
|
||||||
|
activityTeamType="team_strategy_exemption_ordinary";
|
||||||
|
}else if (activityTeamId==3){
|
||||||
|
activityTeamType="team_strategy_exemption";
|
||||||
|
}
|
||||||
|
ActivityTeamStrategy activityTeamStrategy = SpringUtils.getBean(activityTeamType);
|
||||||
|
activityTeamStrategy.openTeam(activityTeamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTeam(Long teamId, String orderNumber) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void backTeam(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settle(Long teamId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,175 +0,0 @@
|
||||||
package com.muyu.marketing.util;
|
|
||||||
|
|
||||||
import com.aliyun.oss.OSS;
|
|
||||||
import com.aliyun.oss.OSSClientBuilder;
|
|
||||||
import com.aliyun.oss.model.GetObjectRequest;
|
|
||||||
import com.aliyun.oss.model.PutObjectRequest;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Oss服务调用
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
@Configuration
|
|
||||||
@ConfigurationProperties(prefix = "oss")
|
|
||||||
@Data
|
|
||||||
public class OssUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Endpoint 存储对象概述 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限 访问路径前缀 存储对象概述
|
|
||||||
*/
|
|
||||||
private String endPoint;
|
|
||||||
private String accessKeyId;
|
|
||||||
private String accessKeySecret;
|
|
||||||
private String accessPre;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bucket名称
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String bucketName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建 OSS 对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private OSS initOssClient() {
|
|
||||||
return new OSSClientBuilder().build(
|
|
||||||
endPoint,
|
|
||||||
accessKeyId,
|
|
||||||
accessKeySecret);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认路径上传本地文件
|
|
||||||
*
|
|
||||||
* @param filePath
|
|
||||||
*/
|
|
||||||
public String uploadFile(String filePath) {
|
|
||||||
return uploadFileForBucket(bucketName, getOssFilePath(filePath), filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认路径上传multipartFile文件
|
|
||||||
*
|
|
||||||
* @param multipartFile
|
|
||||||
*/
|
|
||||||
public String uploadMultipartFile(MultipartFile multipartFile) {
|
|
||||||
return uploadMultipartFile(bucketName, getOssFilePath(multipartFile.getOriginalFilename()), multipartFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传 multipartFile 类型文件
|
|
||||||
*
|
|
||||||
* @param bucketName
|
|
||||||
* @param ossPath
|
|
||||||
* @param multipartFile
|
|
||||||
*/
|
|
||||||
public String uploadMultipartFile(String bucketName, String ossPath, MultipartFile multipartFile) {
|
|
||||||
InputStream inputStream = null;
|
|
||||||
try {
|
|
||||||
inputStream = multipartFile.getInputStream();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
|
||||||
return accessPre + ossPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用File上传PutObject上传文件 ** 程序默认使用次方法上传
|
|
||||||
*
|
|
||||||
* @param bucketName 实例名称
|
|
||||||
* @param ossPath oss存储路径
|
|
||||||
* @param filePath 本地文件路径
|
|
||||||
*/
|
|
||||||
public String uploadFileForBucket(String bucketName, String ossPath, String filePath) {
|
|
||||||
// 创建PutObjectRequest对象。
|
|
||||||
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, ossPath, new File(filePath));
|
|
||||||
|
|
||||||
// 上传
|
|
||||||
initOssClient().putObject(putObjectRequest);
|
|
||||||
return accessPre + ossPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用文件流上传到指定的bucket实例
|
|
||||||
*
|
|
||||||
* @param bucketName 实例名称
|
|
||||||
* @param ossPath oss存储路径
|
|
||||||
* @param filePath 本地文件路径
|
|
||||||
*/
|
|
||||||
public String uploadFileInputStreamForBucket(String bucketName, String ossPath, String filePath) {
|
|
||||||
|
|
||||||
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
|
|
||||||
InputStream inputStream = null;
|
|
||||||
try {
|
|
||||||
inputStream = new FileInputStream(filePath);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
|
|
||||||
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
|
|
||||||
return accessPre + ossPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uploadFileInputStreamForBucket(String bucketName, String ossPath, InputStream inputStream) {
|
|
||||||
initOssClient().putObject(bucketName, ossPath, inputStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载
|
|
||||||
*
|
|
||||||
* @param ossFilePath
|
|
||||||
* @param filePath
|
|
||||||
*/
|
|
||||||
public void downloadFile(String ossFilePath, String filePath) {
|
|
||||||
downloadFileForBucket(bucketName, ossFilePath, filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载
|
|
||||||
*
|
|
||||||
* @param bucketName 实例名称
|
|
||||||
* @param ossFilePath oss存储路径
|
|
||||||
* @param filePath 本地文件路径
|
|
||||||
*/
|
|
||||||
public void downloadFileForBucket(String bucketName, String ossFilePath, String filePath) {
|
|
||||||
initOssClient().getObject(new GetObjectRequest(bucketName, ossFilePath), new File(filePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getOssDefaultPath() {
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
String url =
|
|
||||||
now.getYear() + "/" +
|
|
||||||
now.getMonth() + "/" +
|
|
||||||
now.getDayOfMonth() + "/" +
|
|
||||||
now.getHour() + "/" +
|
|
||||||
now.getMinute() + "/";
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对文件进行重新命名
|
|
||||||
* @param filePath
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getOssFilePath(String filePath) {
|
|
||||||
String fileSuf = filePath.substring(filePath.lastIndexOf(".") + 1);
|
|
||||||
return getOssDefaultPath() + UUID.randomUUID().toString() + "." + fileSuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -27,15 +27,4 @@ spring:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.muyu.system.mapper: DEBUG
|
com.muyu.marketing.mapper: DEBUG
|
||||||
mybatis-plus:
|
|
||||||
mapper-locations:
|
|
||||||
- classpath*:mapper/*Mapper.xml
|
|
||||||
# 搜索指定包别名
|
|
||||||
typeAliasesPackage: com.muyu.marketing.domain
|
|
||||||
oss:
|
|
||||||
endPoint: https://oss-cn-shanghai.aliyuncs.com
|
|
||||||
accessKeyId: LTAI5tLMYKdkKFsCqjNMk1GY
|
|
||||||
accessKeySecret: m3Tnb3FWegHh7tnfN1o48vZ2UyJa4l
|
|
||||||
accessPre: https://ccc-demo123123.oss-cn-shanghai.aliyuncs.com/
|
|
||||||
bucketName: lhc-2204a
|
|
||||||
|
|
|
@ -52,18 +52,18 @@ public class RuleInfo extends BaseEntity {
|
||||||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*规格Sku
|
// *规格Sku
|
||||||
*/
|
// */
|
||||||
private String ruleSku;
|
// private String ruleSku;
|
||||||
/**
|
// /**
|
||||||
*拼团库存
|
// *拼团库存
|
||||||
*/
|
// */
|
||||||
private Long teamStock;
|
// private Long teamStock;
|
||||||
/**
|
// /**
|
||||||
* 拼团价格
|
// * 拼团价格
|
||||||
*/
|
// */
|
||||||
private BigDecimal teamPrice;
|
// private BigDecimal teamPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询构造器
|
* 查询构造器
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class TemplateAttributeModel extends BaseEntity {
|
||||||
* 编码
|
* 编码
|
||||||
*/
|
*/
|
||||||
private String code;
|
private String code;
|
||||||
|
private String value;
|
||||||
|
|
||||||
public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){
|
public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){
|
||||||
return TemplateAttributeModel.builder()
|
return TemplateAttributeModel.builder()
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -108,4 +109,16 @@ public class CommentInfoController extends BaseController {
|
||||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
return toAjax(commentInfoService.removeBatchByIds(ids));
|
return toAjax(commentInfoService.removeBatchByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商品Id查询评论
|
||||||
|
*/
|
||||||
|
@GetMapping("/getCommentByProjectId/{projectId}")
|
||||||
|
public Result getCommentByProjectId(@PathVariable Long projectId){
|
||||||
|
//查询条件
|
||||||
|
LambdaQueryWrapper<CommentInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CommentInfo::getProjectId,projectId);
|
||||||
|
//查询
|
||||||
|
return Result.success(commentInfoService.list(lambdaQueryWrapper));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UpdAsCategoryAttributeMapper updAsCategoryAttributeMapper;
|
private UpdAsCategoryAttributeMapper updAsCategoryAttributeMapper;
|
||||||
|
@Autowired
|
||||||
|
private AsProductAttributeInfoService asProductAttributeInfoService;
|
||||||
/**
|
/**
|
||||||
* 查询品类信息列表
|
* 查询品类信息列表
|
||||||
*
|
*
|
||||||
|
@ -452,6 +454,50 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet);
|
attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet);
|
||||||
attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList();
|
attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList();
|
||||||
|
|
||||||
|
// 查询商品属性
|
||||||
|
attributeGroupModelList.forEach(TemplateAttributeGroupModel->{
|
||||||
|
//遍历获取属性值
|
||||||
|
TemplateAttributeGroupModel.getAttributeList().forEach(TemplateAttributeModel->{
|
||||||
|
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 属性ID
|
||||||
|
queryWrapper.eq(AsProductAttributeInfo::getAttributeId,TemplateAttributeModel.getId());
|
||||||
|
//根据商品ID查询属性值
|
||||||
|
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
|
||||||
|
//遍历属性赋值
|
||||||
|
list.forEach(AsProductAttributeInfo->{
|
||||||
|
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 查询未关联的属性
|
||||||
|
templateAttributeModelList.forEach(TemplateAttributeModel->{
|
||||||
|
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 属性ID
|
||||||
|
queryWrapper.eq(AsProductAttributeInfo::getAttributeId,TemplateAttributeModel.getId());
|
||||||
|
//根据商品ID查询属性值
|
||||||
|
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
|
||||||
|
//遍历赋值
|
||||||
|
list.forEach(AsProductAttributeInfo->{
|
||||||
|
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 查询未关联的属性
|
||||||
|
attributeModelList.forEach(TemplateAttributeModel->{
|
||||||
|
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// 属性ID
|
||||||
|
queryWrapper.eq(AsProductAttributeInfo::getAttributeId, TemplateAttributeModel.getId());
|
||||||
|
//根据商品ID查询属性值
|
||||||
|
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
|
||||||
|
//遍历赋值
|
||||||
|
list.forEach(AsProductAttributeInfo -> {
|
||||||
|
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// 返回
|
||||||
return CategoryCommonElementResp.builder()
|
return CategoryCommonElementResp.builder()
|
||||||
.templateAttributeGroupList(attributeGroupModelList)
|
.templateAttributeGroupList(attributeGroupModelList)
|
||||||
.templateAttributeList(templateAttributeModelList)
|
.templateAttributeList(templateAttributeModelList)
|
||||||
|
|
Loading…
Reference in New Issue