fix():新增了查看活动详情功能
parent
a04925eab4
commit
d9f50a2718
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"id":"Long",
|
||||
"name":"String",
|
||||
"productId":"Long",
|
||||
"productName":"String",
|
||||
"productImage":"String",
|
||||
"introduction":"String",
|
||||
"unit":"String",
|
||||
"imageList":[
|
||||
"轮播图":"String"],
|
||||
"endTime":"Date",
|
||||
"sort":"String",
|
||||
"content":"String",
|
||||
"status":"String",
|
||||
"strategyType":"String",
|
||||
"strategyId":"Long",
|
||||
"SkuList":[
|
||||
{
|
||||
"id":"Long"
|
||||
"sku":"String",
|
||||
"库存":"Long",
|
||||
"价格":"BigDecimal"
|
||||
}]
|
||||
}
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -33,7 +33,7 @@ spring:
|
|||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -60,6 +60,7 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||
.build()
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.resp.TeamProjectSkuResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/26 14:29
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoDetailModel {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long teamId;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/** 商品名称 */
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
|
||||
/** 活动结束时间 */
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
/** 团购商品sku集合 */
|
||||
private List<TeamProjectSkuResp> skuList;
|
||||
|
||||
public static ActivityTeamInfoDetailModel getTeamDetailBuild(ActivityTeamInfo activityTeamInfo, String productName, List<TeamProjectSkuResp> skus) {
|
||||
return ActivityTeamInfoDetailModel.builder()
|
||||
.teamId(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.productId(activityTeamInfo.getProductId())
|
||||
.productName(productName)
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.introduction(activityTeamInfo.getIntroduction())
|
||||
.unit(activityTeamInfo.getUnit())
|
||||
.imageList(activityTeamInfo.getImageList())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.sort(activityTeamInfo.getSort())
|
||||
.content(activityTeamInfo.getContent())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
.strategyId(activityTeamInfo.getStrategyId())
|
||||
.strategyType(activityTeamInfo.getStrategyType())
|
||||
.skuList(skus)
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.resp.TeamProjectSkuResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/26 16:29
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamProjectSkuModel {
|
||||
|
||||
private Long id;
|
||||
private String sku;
|
||||
private BigDecimal teamPrice;
|
||||
private Long teamStock;
|
||||
}
|
|
@ -43,8 +43,8 @@ public class TeamProductDiscountPriceModel {
|
|||
* @param teamPrice 团购加
|
||||
* @return 优惠力度
|
||||
*/
|
||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||
TeamProductDiscountPriceModel.builder()
|
||||
public static TeamProductDiscountPriceModel buildTeamProductDiscountPrice(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||
return TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(
|
||||
|
@ -52,4 +52,5 @@ public class TeamProductDiscountPriceModel {
|
|||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@ 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
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoDetailModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/26 15:20
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ActivityTeamInfoDetailResp {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/** 商品名称 */
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Long sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
/** 团购商品sku集合 */
|
||||
private List<TeamProjectSkuResp> skuList;
|
||||
|
||||
public static ActivityTeamInfoDetailResp modelBuild(ActivityTeamInfoDetailModel activityTeamInfoDetailModel) {
|
||||
return ActivityTeamInfoDetailResp.builder()
|
||||
.teamId(activityTeamInfoDetailModel.getTeamId())
|
||||
.teamName(activityTeamInfoDetailModel.getName())
|
||||
.productId(activityTeamInfoDetailModel.getProductId())
|
||||
.productName(activityTeamInfoDetailModel.getProductName())
|
||||
.productImage(activityTeamInfoDetailModel.getProductImage())
|
||||
.introduction(activityTeamInfoDetailModel.getIntroduction())
|
||||
.unit(activityTeamInfoDetailModel.getUnit())
|
||||
.imageList(activityTeamInfoDetailModel.getImageList())
|
||||
.endTime(activityTeamInfoDetailModel.getEndTime())
|
||||
.sort(activityTeamInfoDetailModel.getSort())
|
||||
.content(activityTeamInfoDetailModel.getContent())
|
||||
.status(activityTeamInfoDetailModel.getStatus())
|
||||
.strategyId(activityTeamInfoDetailModel.getStrategyId())
|
||||
.strategyType(activityTeamInfoDetailModel.getStrategyType())
|
||||
.skuList(activityTeamInfoDetailModel.getSkuList())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProjectSkuModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author 夜は眠れるかい?
|
||||
* @Date 2024/11/26 16:23
|
||||
* 好好学习,天天向上
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class TeamProjectSkuResp {
|
||||
|
||||
private Long id;
|
||||
private String sku;
|
||||
private BigDecimal teamPrice;
|
||||
private Long teamStock;
|
||||
|
||||
public static TeamProjectSkuResp buildModel(ActivityTeamProjectSkuModel sku) {
|
||||
return TeamProjectSkuResp.builder()
|
||||
.id(sku.getId())
|
||||
.sku(sku.getSku())
|
||||
.teamPrice(sku.getTeamPrice())
|
||||
.teamStock(sku.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -121,4 +121,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -4,16 +4,16 @@ package com.muyu.marketing.team.controller;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoDetailModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
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.domain.resp.TeamProjectSkuResp;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
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.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,10 +28,12 @@ import java.util.List;
|
|||
public class ActivityTeamController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;;
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
;
|
||||
|
||||
/**
|
||||
* 查询营销团购活动列表
|
||||
*
|
||||
* @param teamInfoListReq 活动查询入参
|
||||
* @return 活动响应结果
|
||||
*/
|
||||
|
@ -40,7 +42,7 @@ public class ActivityTeamController {
|
|||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList();
|
||||
return Result.success(
|
||||
new TableDataInfo<>(){{
|
||||
new TableDataInfo<>() {{
|
||||
setRows(respList);
|
||||
setTotal(tableDataInfo.getTotal());
|
||||
}}
|
||||
|
@ -50,6 +52,7 @@ public class ActivityTeamController {
|
|||
|
||||
/**
|
||||
* 添加团购活动
|
||||
*
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
* @return 结果集
|
||||
*/
|
||||
|
@ -58,4 +61,16 @@ public class ActivityTeamController {
|
|||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动id查询活动详情
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("getTeamInfoById/{teamId}")
|
||||
public Result<ActivityTeamInfoDetailResp> getTeamInfoById(@PathVariable Long teamId) {
|
||||
ActivityTeamInfoDetailModel detailModel = activityTeamInfoService.getTeamInfoById(teamId);
|
||||
ActivityTeamInfoDetailResp detailResp = ActivityTeamInfoDetailResp.modelBuild(detailModel);
|
||||
return Result.success(detailResp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,21 @@ 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.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoDetailModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuyufeng
|
||||
*/
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 通过查询模型查询团购活动列表
|
||||
*
|
||||
* @param activityTeamInfoListQueryModel 团购活动查询模型
|
||||
* @return 团购活动列表
|
||||
*/
|
||||
|
@ -21,7 +26,16 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
|||
|
||||
/**
|
||||
* 通过添加模型,去进行商品拼团活动的操作
|
||||
*
|
||||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||
|
||||
/**
|
||||
* 根据活动id查询活动详情
|
||||
*
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public ActivityTeamInfoDetailModel getTeamInfoById(Long teamId);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProjectSkuModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
|
||||
|
@ -41,4 +42,12 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
*/
|
||||
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
|
||||
|
||||
/**
|
||||
* 根据团购活动id查询
|
||||
*
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public List<ActivityTeamProjectSkuModel> getTeamProjectSkuByTeamId(Long teamId);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,15 +4,23 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
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.domain.Result;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.marketing.domain.resp.TeamProjectSkuResp;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.cache.ProjectInfoCache;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.domain.resp.ProjectDetailResp;
|
||||
import com.muyu.product.remote.RemoteProjectInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -20,11 +28,12 @@ import org.springframework.util.Assert;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||
implements ActivityTeamInfoService {
|
||||
implements ActivityTeamInfoService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
@ -32,6 +41,9 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
|
||||
@Autowired
|
||||
private RemoteProjectInfoService remoteProjectInfoService;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
|
||||
|
@ -82,4 +94,23 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfo.getId()));
|
||||
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动id获取活动详情
|
||||
*
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ActivityTeamInfoDetailModel getTeamInfoById(Long teamId) {
|
||||
//先查询活动信息
|
||||
ActivityTeamInfo activityTeamInfo = this.getById(teamId);
|
||||
//再查询绑定的商品名称
|
||||
// Result<ProjectInfo> productInfo = remoteProjectInfoService.getInfo(activityTeamInfo.getId());
|
||||
String productName = "123456";
|
||||
//再查询商品sku信息
|
||||
List<ActivityTeamProjectSkuModel> skus = activityTeamProductSkuInfoService.getTeamProjectSkuByTeamId(teamId);
|
||||
return ActivityTeamInfoDetailModel.getTeamDetailBuild(activityTeamInfo,productName,
|
||||
skus.stream().map(TeamProjectSkuResp::buildModel).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamProjectSkuModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamProductStockModel;
|
||||
import com.muyu.marketing.domain.resp.TeamProjectSkuResp;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
|
@ -14,16 +16,12 @@ import com.muyu.product.domain.ProjectSkuInfo;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
@ -42,10 +40,10 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
Optional<TeamProductDiscountPriceModel> discountPriceModelOptional = teamProductSkuInfoList.stream()
|
||||
.map(activityTeamProductSkuInfo -> {
|
||||
ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
|
||||
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||
return TeamProductDiscountPriceModel.buildTeamProductDiscountPrice(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||
|
||||
if (discountPriceModelOptional.isEmpty()){
|
||||
if (discountPriceModelOptional.isEmpty()) {
|
||||
throw new ServiceException("团购活动下没有商品绑定");
|
||||
}
|
||||
return discountPriceModelOptional.get();
|
||||
|
@ -80,4 +78,27 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据团购活动id获取团购商品SKU列表
|
||||
*
|
||||
* @param teamId 入参
|
||||
* @return 返回团购商品SKU列表
|
||||
*/
|
||||
@Override
|
||||
public List<ActivityTeamProjectSkuModel> getTeamProjectSkuByTeamId(Long teamId) {
|
||||
//根据活动ID查询团购商品SKU
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
List<ActivityTeamProductSkuInfo> list = this.list(queryWrapper);
|
||||
// 将团购商品SKU集合转换成团购商品SKU模型集合
|
||||
return list.stream()
|
||||
.map(activityTeamProductSkuInfo -> ActivityTeamProjectSkuModel.builder()
|
||||
.id(activityTeamProductSkuInfo.getId())
|
||||
.sku(activityTeamProductSkuInfo.getProductSku())
|
||||
.teamPrice(activityTeamProductSkuInfo.getTeamPrice())
|
||||
.teamStock(activityTeamProductSkuInfo.getTeamStock())
|
||||
.build())
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ server:
|
|||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-marketing
|
||||
name: muyu-team
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -22,6 +22,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
public interface RemoteProjectInfoService {
|
||||
/**
|
||||
* 获取商品信息详细信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) ;
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 101.35.234.240:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue