拼团列表优化
parent
59e961dba0
commit
7063e0f6c6
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.common.core.enums.market.team;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
public enum TeamOpenTypeEnum {
|
||||
OPEN_TEAM("open_team","开团"),
|
||||
|
||||
IN_TEAM("in_team","参团");
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
|
||||
|
||||
TeamOpenTypeEnum(String code, String label) {
|
||||
this.code = code;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String Code() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String Label() {
|
||||
return label;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.common.core.web.model;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -7,6 +9,8 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
@ -34,7 +38,6 @@ public class QueryModel<T> {
|
|||
private boolean isAsc = true;
|
||||
|
||||
|
||||
|
||||
public T domainBuild(PageDomain pageDomain){
|
||||
this.pageNum=pageDomain.getPageNum();
|
||||
this.pageSize=pageDomain.getPageSize();
|
||||
|
@ -42,4 +45,14 @@ public class QueryModel<T> {
|
|||
this.isAsc="asc".equals(pageDomain.getIsAsc()) ? true : false;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public <T> Page<T> buildPage(){
|
||||
Page<T> page = Page.of(this.getPageNum(), this.getPageSize());
|
||||
page.setOrders(List.of(this.isAsc()
|
||||
? OrderItem.asc(this.getOrderByColumn()) : OrderItem.desc(this.getOrderByColumn())));
|
||||
return page;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
*/
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
private Integer id;
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
|
|
|
@ -8,18 +8,26 @@ import java.io.Serializable;
|
|||
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 团购活动执行表
|
||||
* @TableName activity_team_open_info
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamOpenInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message="[主键]不能为空")
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
private Integer id;
|
||||
/**
|
||||
|
@ -31,86 +39,78 @@ public class ActivityTeamOpenInfo implements Serializable {
|
|||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
@NotBlank(message="[团购类型]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("团购类型")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String teamType;
|
||||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
@NotBlank(message="[团购策略]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("团购策略")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String teamStrategyId;
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
@NotBlank(message="[参团类型]不能为空")
|
||||
@Size(max= 32,message="编码长度不能超过32")
|
||||
|
||||
@ApiModelProperty("参团类型")
|
||||
@Length(max= 32,message="编码长度不能超过32")
|
||||
|
||||
private String executiveType;
|
||||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
@NotNull(message="[结束团购时间]不能为空")
|
||||
|
||||
@ApiModelProperty("结束团购时间")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@NotBlank(message="[商品ID]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("商品ID")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String productId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@NotBlank(message="[商品名称]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("商品名称")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String productName;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
@NotBlank(message="[商品规格]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("商品规格")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String productSku;
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
@NotBlank(message="[开团标识]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("开团标识")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String key;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("订单ID")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String orderId;
|
||||
/**
|
||||
* 开团状态
|
||||
*/
|
||||
@NotBlank(message="[开团状态]不能为空")
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("开团状态")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
|
||||
private String status;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Size(max= 32,message="编码长度不能超过32")
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Length(max= 32,message="编码长度不能超过32")
|
||||
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
|
@ -120,9 +120,9 @@ public class ActivityTeamOpenInfo implements Serializable {
|
|||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Size(max= 32,message="编码长度不能超过32")
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Length(max= 32,message="编码长度不能超过32")
|
||||
|
||||
private String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
|
@ -132,248 +132,9 @@ public class ActivityTeamOpenInfo implements Serializable {
|
|||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Size(max= 900,message="编码长度不能超过900")
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Length(max= 900,message="编码长度不能超过900")
|
||||
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private void setId(Integer id){
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private void setTeamId(Long teamId){
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
private void setTeamType(String teamType){
|
||||
this.teamType = teamType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
private void setTeamStrategyId(String teamStrategyId){
|
||||
this.teamStrategyId = teamStrategyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
private void setExecutiveType(String executiveType){
|
||||
this.executiveType = executiveType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
private void setEndTime(Date endTime){
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private void setProductId(String productId){
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private void setProductName(String productName){
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private void setProductSku(String productSku){
|
||||
this.productSku = productSku;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
private void setKey(String key){
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private void setOrderId(String orderId){
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开团状态
|
||||
*/
|
||||
private void setStatus(String status){
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private void setCreateBy(String createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private void setCreateTime(Date createTime){
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private void setUpdateBy(String updateBy){
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private void setUpdateTime(Date updateTime){
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private void setRemark(String remark){
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private Long getTeamId(){
|
||||
return this.teamId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
private String getTeamType(){
|
||||
return this.teamType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
private String getTeamStrategyId(){
|
||||
return this.teamStrategyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
private String getExecutiveType(){
|
||||
return this.executiveType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
private Date getEndTime(){
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String getProductId(){
|
||||
return this.productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String getProductName(){
|
||||
return this.productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private String getProductSku(){
|
||||
return this.productSku;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
private String getKey(){
|
||||
return this.key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private String getOrderId(){
|
||||
return this.orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开团状态
|
||||
*/
|
||||
private String getStatus(){
|
||||
return this.status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String getCreateBy(){
|
||||
return this.createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date getCreateTime(){
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String getUpdateBy(){
|
||||
return this.updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date getUpdateTime(){
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String getRemark(){
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,62 +6,76 @@ import javax.validation.constraints.NotNull;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 商品拼团规格信息表
|
||||
* @TableName activity_team_product_sku_info
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamProductSkuInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message="[主键]不能为空")
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
private Integer id;
|
||||
private Long id;
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
@NotNull(message="[活动ID]不能为空")
|
||||
|
||||
@ApiModelProperty("活动ID")
|
||||
private Long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("商品ID")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
private String productId;
|
||||
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("商品SKU")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
private String productSku;
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("拼团库存")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
private String teamStock;
|
||||
|
||||
private Long teamStock;
|
||||
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
@Size(max= 255,message="编码长度不能超过255")
|
||||
|
||||
@ApiModelProperty("拼团价格")
|
||||
@Length(max= 255,message="编码长度不能超过255")
|
||||
private String teamPrice;
|
||||
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Size(max= 32,message="编码长度不能超过32")
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Length(max= 32,message="编码长度不能超过32")
|
||||
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
|
@ -71,9 +85,9 @@ public class ActivityTeamProductSkuInfo implements Serializable {
|
|||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Size(max= 32,message="编码长度不能超过32")
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Length(max= 32,message="编码长度不能超过32")
|
||||
|
||||
private String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
|
@ -83,164 +97,11 @@ public class ActivityTeamProductSkuInfo implements Serializable {
|
|||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Size(max= 900,message="编码长度不能超过900")
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Length(max= 900,message="编码长度不能超过900")
|
||||
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private void setId(Integer id){
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private void setTeamId(Long teamId){
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private void setProductId(String productId){
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
private void setProductSku(String productSku){
|
||||
this.productSku = productSku;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private void setTeamStock(String teamStock){
|
||||
this.teamStock = teamStock;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private void setTeamPrice(String teamPrice){
|
||||
this.teamPrice = teamPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private void setCreateBy(String createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private void setCreateTime(Date createTime){
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private void setUpdateBy(String updateBy){
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private void setUpdateTime(Date updateTime){
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private void setRemark(String remark){
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private Long getTeamId(){
|
||||
return this.teamId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String getProductId(){
|
||||
return this.productId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
private String getProductSku(){
|
||||
return this.productSku;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private String getTeamStock(){
|
||||
return this.teamStock;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private String getTeamPrice(){
|
||||
return this.teamPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String getCreateBy(){
|
||||
return this.createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date getCreateTime(){
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String getUpdateBy(){
|
||||
return this.updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date getUpdateTime(){
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String getRemark(){
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,94 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoListModel {
|
||||
private Integer id;
|
||||
/**
|
||||
* 主建
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*拼团名称
|
||||
*/
|
||||
private String name;
|
||||
private String addTeamNumber;
|
||||
private String attendNumber;
|
||||
/**
|
||||
*参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
*开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
*拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
*结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
*图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
*拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
*商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
*团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
*剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
*活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function<ActivityTeamInfoListModel.ActivityTeamInfoListModelBuilder,ActivityTeamInfoListModel> function){
|
||||
ActivityTeamInfoListModel builder = ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
// .addTeamNumber("00")
|
||||
// .openTeamNumber("00")
|
||||
// .attendNumber("00")
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
// .teamPrice("0")
|
||||
// .productPrice("0")
|
||||
// .remainStock("0")
|
||||
// .teamStock("0")
|
||||
.status(activityTeamInfo.getStatus())
|
||||
.build();
|
||||
return function.apply(
|
||||
ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoL
|
|||
/**
|
||||
* 活动转态
|
||||
*/
|
||||
private Integer status;
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class TeamProductDiscountPriceModel {
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 团购优惠价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 优惠力度
|
||||
*/
|
||||
private Double disCount;
|
||||
|
||||
|
||||
public static TeamProductStockModel of(BigDecimal productPrice,BigDecimal teamPrice){
|
||||
TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.disCount(productPrice.subtract(teamPrice).divide(productPrice,2, RoundingMode.HALF_UP).doubleValue())
|
||||
.build();
|
||||
return of(productPrice, teamPrice);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TeamProductStockModel {
|
||||
private Long teamStock;
|
||||
private Long remainStock;
|
||||
|
||||
}
|
|
@ -24,20 +24,28 @@ public class TeamInfoReqListReq extends PageDomain {
|
|||
/**
|
||||
* 活动转态
|
||||
*/
|
||||
private Integer status;
|
||||
private String status;
|
||||
|
||||
public ActivityTeamInfoListQueryModel activityTeamInfoListModel (){
|
||||
ActivityTeamInfoListQueryModel build = ActivityTeamInfoListQueryModel.builder()
|
||||
.keyWord(this.keyWord)
|
||||
.status(this.status)
|
||||
.build();
|
||||
build.domainBuild(this);
|
||||
|
||||
public ActivityTeamInfoListQueryModel buildQueryModel() {
|
||||
return ActivityTeamInfoListQueryModel.builder()
|
||||
.keyWord(this.keyWord)
|
||||
.status(this.status)
|
||||
.build()
|
||||
.domainBuild(this);
|
||||
|
||||
}
|
||||
// public ActivityTeamInfoListQueryModel activityTeamInfoListModel (){
|
||||
// ActivityTeamInfoListQueryModel build = ActivityTeamInfoListQueryModel.builder()
|
||||
// .keyWord(this.keyWord)
|
||||
// .status(this.status)
|
||||
// .build();
|
||||
// build.domainBuild(this);
|
||||
// return ActivityTeamInfoListQueryModel.builder()
|
||||
// .keyWord(this.keyWord)
|
||||
// .status(this.status)
|
||||
// .build()
|
||||
// .domainBuild(this);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,16 @@ package com.muyu.marketing.domain.resp;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
@ -16,7 +21,7 @@ public class TeamInfoListResp {
|
|||
/**
|
||||
* 拼团活动Id
|
||||
*/
|
||||
private String id;
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
|
@ -28,34 +33,53 @@ public class TeamInfoListResp {
|
|||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private String productPrice;
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private String teamPrice;
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private String openTeamNumber;
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private String addTeamBumber;
|
||||
private Long addTeamBumber;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private String teamStock;
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private String remainStock;
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
private Date endTime;
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
private Long attendNumber;
|
||||
|
||||
|
||||
public static TeamInfoListResp listModelBuild(ActivityTeamInfoListModel activityTeamInfoListModel){
|
||||
return TeamInfoListResp.builder()
|
||||
.id(activityTeamInfoListModel.getId())
|
||||
.name(activityTeamInfoListModel.getName())
|
||||
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
|
||||
.addTeamBumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.endTime(activityTeamInfoListModel.getEndTime())
|
||||
.teamPrice(activityTeamInfoListModel.getTeamPrice())
|
||||
.productimage(activityTeamInfoListModel.getProductImage())
|
||||
.productPrice(activityTeamInfoListModel.getProductPrice())
|
||||
.remainStock(activityTeamInfoListModel.getRemainStock())
|
||||
.status(activityTeamInfoListModel.getStatus())
|
||||
.teamStock(activityTeamInfoListModel.getTeamStock())
|
||||
.attendNumber(activityTeamInfoListModel.getAttendNumber())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
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.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.marketing.domain.req.TeamInfoReqListReq;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -11,18 +13,23 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/team")
|
||||
public class ActivityTeamController {
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
@PostMapping("list")
|
||||
public Result list(@RequestBody TeamInfoReqListReq teamInfoReqListReq){
|
||||
ActivityTeamInfoListQueryModel queryModel = new ActivityTeamInfoListQueryModel();
|
||||
queryModel.domainBuild(teamInfoReqListReq);
|
||||
queryModel.setKeyWord(teamInfoReqListReq.getKeyWord());
|
||||
queryModel.setStatus(teamInfoReqListReq.getStatus());
|
||||
activityTeamInfoService.query(queryModel);
|
||||
return Result.success();
|
||||
public Result<TableDataInfo<TeamInfoListResp>> list(@RequestBody TeamInfoReqListReq teamInfoReqListReq){
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoReqListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList();
|
||||
return Result.success(
|
||||
new TableDataInfo<>(){{
|
||||
setRows(respList);
|
||||
setTotal(tableDataInfo.getTotal());
|
||||
}}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
|
||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
|
||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||
}
|
|
@ -1,4 +1,20 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
public interface ActivityOpenInfoService {
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
|
||||
public interface ActivityOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
/**
|
||||
* 查询开团数量
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId);
|
||||
/**
|
||||
* 查询参团数量
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public Long getTeamInNumberByTeamIdAndType(Long teamId);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,17 @@ package com.muyu.marketing.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
|
||||
|
||||
public TableDataInfo<ActivityTeamInfo> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
/**
|
||||
* 拼团订单列表
|
||||
* @param activityTeamInfoListQueryModel
|
||||
* @return
|
||||
*/
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,22 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
public interface ActivityTeamProductSkuInfoService {
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo>{
|
||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByTeamId(Long teamId){
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId);
|
||||
public TeamProductStockModel getStock(Long teamId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.marketing.service.ActivityOpenInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public class ActivityOpenInfoServiceImpl implements ActivityOpenInfoService {
|
||||
@Service
|
||||
public class ActivityOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo> implements ActivityOpenInfoService {
|
||||
@Override
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,teamId);
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamType,TeamOpenTypeEnum.OPEN_TEAM.Code());
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getTeamInNumberByTeamIdAndType(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,teamId);
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamType,TeamOpenTypeEnum.IN_TEAM.Code());
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,44 +6,64 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
import com.muyu.marketing.mapper.ActivityInfoMapper;
|
||||
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.service.ActivityOpenInfoService;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityInfoMapper,ActivityTeamInfo> implements ActivityTeamInfoService {
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper,ActivityTeamInfo> implements ActivityTeamInfoService {
|
||||
|
||||
public TableDataInfo<ActivityTeamInfo> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
Page<ActivityTeamInfo> page = new Page<>();
|
||||
page.setCurrent(activityTeamInfoListQueryModel.getPageNum());
|
||||
page.setSize(activityTeamInfoListQueryModel.getPageSize());
|
||||
activityTeamInfoListQueryModel.getOrderByColumn();
|
||||
activityTeamInfoListQueryModel.isAsc();
|
||||
page.setOrders(Arrays.asList(new OrderItem()));
|
||||
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(new Page<ActivityTeamInfo>(), new LambdaQueryWrapper<ActivityTeamInfo>());
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
|
||||
ArrayList<ActivityTeamInfo> list = new ArrayList<>();
|
||||
for (ActivityTeamInfo activityTeamInfo : list) {
|
||||
ActivityTeamInfoListModel activityTeamInfoListModel = new ActivityTeamInfoListModel();
|
||||
activityTeamInfoListModel.setId(activityTeamInfo.getId());
|
||||
activityTeamInfoListModel.setName(activityTeamInfo.getName());
|
||||
activityTeamInfoListModel.setAddTeamNumber("00");
|
||||
activityTeamInfoListModel.setAttendNumber("00");
|
||||
activityTeamInfoListModel.setEndTime(activityTeamInfo.getEndTime());
|
||||
activityTeamInfoListModel.setStatus(activityTeamInfo.getStatus());
|
||||
}
|
||||
@Autowired
|
||||
private ActivityOpenInfoService activityOpenInfoService;
|
||||
|
||||
TableDataInfo<ActivityTeamInfo> tableDataInfo = new TableDataInfo<>();
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query (ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()),ActivityTeamInfo::getName , activityTeamInfoListQueryModel.getKeyWord());
|
||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()),ActivityTeamInfo::getStatus , activityTeamInfoListQueryModel.getStatus());
|
||||
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(),queryWrapper);
|
||||
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
||||
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
|
||||
.map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
|
||||
(activityTeamInfoListModelBuilder) -> {
|
||||
Long openNumberByTeamIdAndType = activityOpenInfoService.getTeamOpenNumberByTeamIdAndType(activityTeamInfo.getId());
|
||||
Long inNumberByTeamIdAndType = activityOpenInfoService.getTeamInNumberByTeamIdAndType(activityTeamInfo.getId());
|
||||
TeamProductDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
|
||||
TeamProductStockModel teamProductStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
|
||||
|
||||
return activityTeamInfoListModelBuilder
|
||||
.openTeamNumber(openNumberByTeamIdAndType)
|
||||
.addTeamNumber(inNumberByTeamIdAndType)
|
||||
.attendNumber(openNumberByTeamIdAndType + inNumberByTeamIdAndType)
|
||||
.teamPrice(discountPrice.getTeamPrice())
|
||||
.productPrice(discountPrice.getProductPrice())
|
||||
.teamStock(teamProductStockModel.getTeamStock())
|
||||
.remainStock(teamProductStockModel.getRemainStock())
|
||||
.build();
|
||||
|
||||
})).toList();
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo<>();
|
||||
tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
|
||||
tableDataInfo.setRows(activityTeamInfoPage.getRecords());
|
||||
tableDataInfo.setRows(activityTeamInfoListModels);
|
||||
|
||||
return tableDataInfo;
|
||||
|
||||
|
|
|
@ -1,6 +1,63 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
import com.muyu.marketing.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
import com.muyu.product.cache.datasource.ProjectSkuData;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public class ActivityTeamProductSkuInfoServiceImpl implements ActivityTeamProductSkuInfoService {
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper,ActivityTeamProductSkuInfo> implements ActivityTeamProductSkuInfoService {
|
||||
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
@Override
|
||||
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
List<ActivityTeamProductSkuInfo> productSkuInfos = this.list(queryWrapper);
|
||||
ArrayList<TeamProductDiscountPriceModel> teamProductDiscountPriceModels = new ArrayList<>();
|
||||
for (ActivityTeamProductSkuInfo productSkuInfo : productSkuInfos) {
|
||||
ProjectSkuInfo skuInfo = projectSkuCache.get(productSkuInfo.getProductId(), productSkuInfo.getProductSku());
|
||||
BigDecimal price = skuInfo.getPrice();
|
||||
BigDecimal teamPrice = productSkuInfo.getTeamPrice();
|
||||
TeamProductDiscountPriceModel priceModel = new TeamProductDiscountPriceModel();
|
||||
priceModel.setProductPrice(price);
|
||||
priceModel.setTeamPrice(teamPrice);
|
||||
priceModel.setDisCount(price.subtract(teamPrice).divide(price,2, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
teamProductDiscountPriceModels.add(priceModel);
|
||||
}
|
||||
TeamProductDiscountPriceModel teamProductDiscountPriceModel = teamProductDiscountPriceModels.get(0);
|
||||
for (TeamProductDiscountPriceModel productDiscountPriceModel : teamProductDiscountPriceModels) {
|
||||
if(teamProductDiscountPriceModel.getDisCount() < productDiscountPriceModel.getDisCount()){
|
||||
teamProductDiscountPriceModel = productDiscountPriceModel;
|
||||
}
|
||||
}
|
||||
return teamProductDiscountPriceModel;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProductStockModel getStock(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> teamProductSkuInfosList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||
|
||||
return TeamProductStockModel.builder()
|
||||
.teamStock(teamProductSkuInfosList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L,Long::sum))
|
||||
.remainStock(teamProductSkuInfosList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L,Long::sum))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionHundredService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionHundredServiceImpl implements TeamStrategyExemptionHundredService {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionOrdinaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionOrdinaryServiceImpl implements TeamStrategyExemptionOrdinaryService {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionServiceImpl implements TeamStrategyExemptionService {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue