Compare commits
3 Commits
master
...
1127/liuhe
Author | SHA1 | Date |
---|---|---|
|
3aee63815e | |
|
7e256f9a95 | |
|
43a18c95d8 |
|
@ -22,7 +22,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
/**
|
||||
* 商品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
|
||||
*/
|
||||
private long strategyId;
|
||||
private Long strategyId;
|
||||
|
||||
/**
|
||||
* 公共添加模型,转换成添加对象
|
||||
|
|
|
@ -22,11 +22,11 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private long id;
|
||||
private Long id;
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private long teamId;
|
||||
private Long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
|
@ -60,6 +60,6 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
|||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||
.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;
|
||||
}
|
|
@ -44,7 +44,7 @@ public class TeamProductDiscountPriceModel {
|
|||
* @return 优惠力度
|
||||
*/
|
||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
|
||||
TeamProductDiscountPriceModel.builder()
|
||||
return TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(
|
||||
|
|
|
@ -36,7 +36,6 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
|||
/**
|
||||
* 单位
|
||||
*/
|
||||
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
|
@ -51,7 +50,7 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
|||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private Integer sort;
|
||||
private Long sort;
|
||||
/**
|
||||
* 商品SkU集合
|
||||
*/
|
||||
|
@ -72,4 +71,6 @@ public class ActivityTeamInfoSaveReq extends BaseEntity {
|
|||
* 策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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,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;
|
||||
}
|
|
@ -3,9 +3,7 @@ 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.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
|
@ -46,16 +44,4 @@ public class ActivityTeamController {
|
|||
}}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购活动
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
* @return 结果集
|
||||
*/
|
||||
@PostMapping
|
||||
public Result<String> save(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
||||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -24,4 +25,11 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
|||
* @param activityTeamInfoAddModel 团购添加模型
|
||||
*/
|
||||
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
|
||||
|
||||
/**
|
||||
* 通过id查询团购活动详情
|
||||
*/
|
||||
ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,14 +6,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
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.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
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.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
@ -24,13 +29,16 @@ import java.util.function.Consumer;
|
|||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||
implements ActivityTeamInfoService {
|
||||
implements ActivityTeamInfoService {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
// @Autowired
|
||||
// private ActivityTeamInfoMapper activityTeamInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
|
@ -82,4 +90,44 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfo.getId()));
|
||||
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 113.44.45.42:8848
|
||||
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 113.44.45.42:8848
|
||||
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue