feat():营销团购活动的添加和活动的详情
parent
43a18c95d8
commit
7e256f9a95
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"团购活动id":"Long"
|
||||||
|
"商品ID":"Long",
|
||||||
|
"活动名称":"String",
|
||||||
|
"活动简介":"String",
|
||||||
|
"商品图片":"String",
|
||||||
|
"商品单位":"String",
|
||||||
|
"商品的轮播图":[
|
||||||
|
"String","String"
|
||||||
|
],
|
||||||
|
"活动时间":"date",
|
||||||
|
"策略类型":"String",
|
||||||
|
"策略ID":"Long",
|
||||||
|
"商品规格List":[
|
||||||
|
{
|
||||||
|
"规格id":"Long",
|
||||||
|
"规格SKU":"String",
|
||||||
|
"拼团价格":"BigDecimal",
|
||||||
|
"拼团库存":"Long"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"排序":"Integer",
|
||||||
|
"详情":"String"
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 拼团名称
|
* 拼团名称
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +30,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 商品ID
|
* 商品ID
|
||||||
*/
|
*/
|
||||||
private long productId;
|
private Long productId;
|
||||||
/**
|
/**
|
||||||
* 商品活动图
|
* 商品活动图
|
||||||
*/
|
*/
|
||||||
|
@ -54,7 +54,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 活动排序
|
* 活动排序
|
||||||
*/
|
*/
|
||||||
private long sort;
|
private Long sort;
|
||||||
/**
|
/**
|
||||||
* 活动详情
|
* 活动详情
|
||||||
*/
|
*/
|
||||||
|
@ -70,7 +70,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 策略ID
|
* 策略ID
|
||||||
*/
|
*/
|
||||||
private long strategyId;
|
private Long strategyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公共添加模型,转换成添加对象
|
* 公共添加模型,转换成添加对象
|
||||||
|
|
|
@ -22,11 +22,11 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 活动ID
|
* 活动ID
|
||||||
*/
|
*/
|
||||||
private long teamId;
|
private Long teamId;
|
||||||
/**
|
/**
|
||||||
* 商品ID
|
* 商品ID
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,6 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
||||||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||||
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||||
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||||
.build()
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ActivityTeamInfoAddModel {
|
public class ActivityTeamInfoAddModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团名称
|
* 拼团名称
|
||||||
*/
|
*/
|
||||||
|
@ -43,12 +42,10 @@ public class ActivityTeamInfoAddModel {
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 单位
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private String unit;
|
private String unit;
|
||||||
/**
|
/**
|
||||||
* 轮播图
|
* 轮播图
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private String imageList;
|
private String imageList;
|
||||||
/**
|
/**
|
||||||
* 活动结束时间
|
* 活动结束时间
|
||||||
|
@ -58,7 +55,7 @@ public class ActivityTeamInfoAddModel {
|
||||||
/**
|
/**
|
||||||
* 活动排序
|
* 活动排序
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Long sort;
|
||||||
/**
|
/**
|
||||||
* 商品SkU集合
|
* 商品SkU集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ActivityTeamProductSkuAddModel {
|
||||||
/**
|
/**
|
||||||
* 规格SKU
|
* 规格SKU
|
||||||
*/
|
*/
|
||||||
private String sku;
|
private String productSku;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团价格
|
* 拼团价格
|
||||||
|
@ -50,8 +50,9 @@ public class ActivityTeamProductSkuAddModel {
|
||||||
|
|
||||||
public static ActivityTeamProductSkuAddModel addReqBuild(ProjectSkuInfoAddReq projectSkuInfoAddReq, Supplier<Long> getProductId) {
|
public static ActivityTeamProductSkuAddModel addReqBuild(ProjectSkuInfoAddReq projectSkuInfoAddReq, Supplier<Long> getProductId) {
|
||||||
return ActivityTeamProductSkuAddModel.builder()
|
return ActivityTeamProductSkuAddModel.builder()
|
||||||
|
.teamId(projectSkuInfoAddReq.getId())
|
||||||
.productId(getProductId.get())
|
.productId(getProductId.get())
|
||||||
.sku(projectSkuInfoAddReq.getSku())
|
.productSku(projectSkuInfoAddReq.getSku())
|
||||||
.teamStock(projectSkuInfoAddReq.getTeamStock())
|
.teamStock(projectSkuInfoAddReq.getTeamStock())
|
||||||
.teamPrice(projectSkuInfoAddReq.getTeamPrice())
|
.teamPrice(projectSkuInfoAddReq.getTeamPrice())
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TeamProductDiscountPriceModel {
|
||||||
* @return 优惠力度
|
* @return 优惠力度
|
||||||
*/
|
*/
|
||||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||||
TeamProductDiscountPriceModel.builder()
|
return TeamProductDiscountPriceModel.builder()
|
||||||
.productPrice(productPrice)
|
.productPrice(productPrice)
|
||||||
.teamPrice(teamPrice)
|
.teamPrice(teamPrice)
|
||||||
.discount(
|
.discount(
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 单位
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private String unit;
|
private String unit;
|
||||||
/**
|
/**
|
||||||
* 轮播图
|
* 轮播图
|
||||||
|
@ -51,7 +50,7 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 活动排序
|
* 活动排序
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Long sort;
|
||||||
/**
|
/**
|
||||||
* 商品SkU集合
|
* 商品SkU集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.math.BigDecimal;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ProjectSkuInfoAddReq {
|
public class ProjectSkuInfoAddReq {
|
||||||
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格SKU
|
* 规格SKU
|
||||||
|
|
|
@ -3,9 +3,10 @@ package com.muyu.marketing.domain.req;
|
||||||
import com.muyu.common.core.web.page.PageDomain;
|
import com.muyu.common.core.web.page.PageDomain;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
|
|
@ -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 productId;
|
||||||
|
/**
|
||||||
|
* 商品活动图
|
||||||
|
*/
|
||||||
|
private String productImage;
|
||||||
|
/**
|
||||||
|
* 活动简介
|
||||||
|
*/
|
||||||
|
private String introduction;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
/**
|
||||||
|
* 轮播图
|
||||||
|
*/
|
||||||
|
private String imageList;
|
||||||
|
/**
|
||||||
|
* 活动结束时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||||
|
private Date endTime;
|
||||||
|
/**
|
||||||
|
* 活动排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 商品SkU集合
|
||||||
|
*/
|
||||||
|
private List<ActivityTeamProductSkuResp> ActivityTeamProductSkuList;
|
||||||
|
/**
|
||||||
|
* 活动详情
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 活动状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 策略类型
|
||||||
|
*/
|
||||||
|
private String strategyType;
|
||||||
|
/**
|
||||||
|
* 策略ID
|
||||||
|
*/
|
||||||
|
private Long strategyId;
|
||||||
|
}
|
|
@ -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 id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格SKU
|
||||||
|
*/
|
||||||
|
private String sku;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团价格
|
||||||
|
*/
|
||||||
|
private BigDecimal teamPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团库存
|
||||||
|
*/
|
||||||
|
private Long teamStock;
|
||||||
|
}
|
|
@ -7,13 +7,11 @@ 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.req.ActivityTeamInfoSaveReq;
|
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
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.domain.resp.TeamInfoListResp;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -55,4 +53,13 @@ public class ActivityTeamController {
|
||||||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addBuild(activityTeamInfoSaveReq));
|
activityTeamInfoService.save(ActivityTeamInfoAddModel.addBuild(activityTeamInfoSaveReq));
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营销团购活动信息
|
||||||
|
*/
|
||||||
|
@GetMapping("getById/{teamId}")
|
||||||
|
public Result<ActivityTeamInfoDetailResp> getTeamInfo(@PathVariable Long teamId){
|
||||||
|
return Result.success(activityTeamInfoService.getActivityByTeamId(teamId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.marketing.team.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityProductSkuListModel;
|
||||||
|
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sku")
|
||||||
|
public class ActivityTeamProductSkuController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回显
|
||||||
|
*/
|
||||||
|
@GetMapping("getById/{teamId}")
|
||||||
|
public Result<List<ActivityProductSkuListModel>> getById(@PathVariable Long teamId){
|
||||||
|
return Result.success(activityTeamProductSkuInfoService.getTeamProductSkuInfoListByTeamId(teamId));
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
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.resp.ActivityTeamInfoDetailResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -24,4 +25,11 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||||
* @param activityTeamInfoAddModel 团购添加模型
|
* @param activityTeamInfoAddModel 团购添加模型
|
||||||
*/
|
*/
|
||||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询团购活动详情
|
||||||
|
*/
|
||||||
|
ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.muyu.marketing.team.service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
import com.muyu.marketing.domain.model.ActivityProductSkuListModel;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||||
|
@ -41,4 +41,8 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
||||||
*/
|
*/
|
||||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过活动id查询活动商品规格信息
|
||||||
|
*/
|
||||||
|
public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,19 @@ 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.exception.ServiceException;
|
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.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamProductSkuResp;
|
||||||
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||||
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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -30,6 +35,9 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||||
|
// @Autowired
|
||||||
|
// private ActivityTeamInfoMapper activityTeamInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||||
|
@ -85,6 +93,44 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
||||||
activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList()
|
activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//添加接口文档
|
|
||||||
//回显
|
/**
|
||||||
|
* 根据id查询活动详情
|
||||||
|
*
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId) {
|
||||||
|
//根据id查询活动详情
|
||||||
|
ActivityTeamInfo activityTeamInfo = getById(teamId);
|
||||||
|
//封装活动详情
|
||||||
|
ActivityTeamInfoDetailResp activityTeamInfoDetailResp = new ActivityTeamInfoDetailResp();
|
||||||
|
List<ActivityTeamProductSkuResp> activityTeamProductSkuList = activityTeamInfoDetailResp.getActivityTeamProductSkuList();
|
||||||
|
//根据活动id查询活动商品SKU集合
|
||||||
|
List<ActivityProductSkuListModel> teamProductSkuInfoList = activityTeamProductSkuInfoService.getTeamProductSkuInfoListByTeamId(teamId);
|
||||||
|
if (teamProductSkuInfoList != null) {
|
||||||
|
//定义一个空集合
|
||||||
|
ArrayList<ActivityTeamProductSkuResp> activityProductSkuList = new ArrayList<>();
|
||||||
|
for (ActivityProductSkuListModel activityProductSkuListModel : teamProductSkuInfoList) {
|
||||||
|
Long id = activityProductSkuListModel.getId();
|
||||||
|
//根据id查询
|
||||||
|
ActivityTeamProductSkuInfo activityTeamProductSkuInfo = activityTeamProductSkuInfoService.getById(id);
|
||||||
|
//添加到集合中
|
||||||
|
activityProductSkuList.add(
|
||||||
|
ActivityTeamProductSkuResp.builder()
|
||||||
|
.id(activityTeamProductSkuInfo.getId())
|
||||||
|
.sku(activityTeamProductSkuInfo.getProductSku())
|
||||||
|
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||||
|
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
activityTeamInfoDetailResp.setActivityTeamProductSkuList(activityProductSkuList);
|
||||||
|
BeanUtils.copyBeanProp(activityTeamInfoDetailResp, activityTeamInfo);
|
||||||
|
}
|
||||||
|
return activityTeamInfoDetailResp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
package com.muyu.marketing.team.service.impl;
|
package com.muyu.marketing.team.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.common.core.exception.ServiceException;
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
|
import com.muyu.marketing.domain.model.ActivityProductSkuListModel;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamProductSkuResp;
|
||||||
import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper;
|
import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper;
|
||||||
|
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
import com.muyu.marketing.team.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 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.math.RoundingMode;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectSkuCache projectSkuCache;
|
private ProjectSkuCache projectSkuCache;
|
||||||
|
@Autowired
|
||||||
|
private @Lazy ActivityTeamInfoService activityTeamInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过团购活动ID获取团购中最优惠的价格
|
* 通过团购活动ID获取团购中最优惠的价格
|
||||||
|
@ -45,7 +48,7 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
||||||
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||||
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||||
|
|
||||||
if (discountPriceModelOptional.isEmpty()){
|
if (discountPriceModelOptional.isEmpty()) {
|
||||||
throw new ServiceException("团购活动下没有商品绑定");
|
throw new ServiceException("团购活动下没有商品绑定");
|
||||||
}
|
}
|
||||||
return discountPriceModelOptional.get();
|
return discountPriceModelOptional.get();
|
||||||
|
@ -80,4 +83,48 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
||||||
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
|
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据团购ID获取团购商品SKU列表
|
||||||
|
*
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId) {
|
||||||
|
//根据活动id查询团购商品SKU集合
|
||||||
|
List<ActivityTeamProductSkuInfo> activityTeamProductSkuList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
|
||||||
|
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;
|
||||||
|
// //根据活动id查询活动相关信息
|
||||||
|
// ActivityTeamInfoDetailResp activityTeamInfoDetailResp=activityTeamInfoService.getActivityByTeamId(teamId);
|
||||||
|
// //获取到活动商品SKU集合
|
||||||
|
// List<ActivityTeamProductSkuResp> activityTeamProductSkuList = activityTeamInfoDetailResp.getActivityTeamProductSkuList();
|
||||||
|
// //定义一个空集合
|
||||||
|
// ArrayList<ActivityProductSkuListModel> activityProductSkuList = new ArrayList<>();
|
||||||
|
// //遍历SKU集合
|
||||||
|
// for (ActivityTeamProductSkuResp activityTeamProductSkuResp : activityTeamProductSkuList) {
|
||||||
|
// //获取到SKU的id
|
||||||
|
// Long id = activityTeamProductSkuResp.getId();
|
||||||
|
// //根据id查询
|
||||||
|
// ActivityTeamProductSkuInfo activityTeamProductSkuInfo = this.getById(id);
|
||||||
|
// //添加到集合中
|
||||||
|
// activityProductSkuList.add(ActivityProductSkuListModel.builder()
|
||||||
|
// .productId(activityTeamProductSkuInfo.getProductId())
|
||||||
|
// .sku(activityTeamProductSkuInfo.getProductSku())
|
||||||
|
// .teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||||
|
// .teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||||
|
// .build());
|
||||||
|
// }
|
||||||
|
// return activityProductSkuList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 113.44.45.42:8848
|
||||||
|
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 113.44.45.42:8848
|
||||||
|
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue