拼团添加

cloud-server
刘河平 2024-11-23 09:06:28 +08:00
parent 91ea6b0498
commit 5e137c9f39
42 changed files with 709 additions and 119 deletions

21
market.json 100644
View File

@ -0,0 +1,21 @@
{
"商品id": "Long",
"商品图片": "String",
"活动名称": "String",
"活动简介": "String",
"商品单位": "String",
"商品轮播图": ["String","String","",""],
"活动时间": "Date",
"开始时间": "Date",
"策略id": "Long",
"策略类型": "String",
"商品规格集合": [
{
"规格id": "Long",
"库存": "Long",
"秒杀价": "BigDecimal"
}
],
"排序":"Integer",
"详情": "text"
}

View File

@ -50,6 +50,10 @@
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-product-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -2,8 +2,10 @@ package com.muyu.marketing.domain;
import com.alibaba.ttl.threadpool.agent.internal.javassist.bytecode.AttributeInfo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -13,12 +15,14 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.xmlbeans.impl.xb.xsdschema.AttributeGroup;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
/**
*
@ -31,7 +35,7 @@ import java.util.function.Function;
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "activity_team_info", description = "商品拼团信息")
public class ActivityTeamInfo extends BaseEntity {
/**
/**
*
*/
private Long id;
@ -42,7 +46,7 @@ public class ActivityTeamInfo extends BaseEntity {
/**
* ID
*/
private BigInteger productId;
private Long productId;
/**
*
@ -63,6 +67,8 @@ public class ActivityTeamInfo extends BaseEntity {
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/**
*
@ -83,8 +89,33 @@ public class ActivityTeamInfo extends BaseEntity {
/**
* ID
*/
private BigInteger strategyId;
private Long strategyId;
/**
*
*
* @param activityTeamInfoAddModel
* @return
*/
public static ActivityTeamInfo saveBuildModel(ActivityTeamInfoAddReq activityTeamInfoAddModel, Supplier<String> createBy){
return ActivityTeamInfo.builder()
.id(activityTeamInfoAddModel.getId())
.name(activityTeamInfoAddModel.getName())
.productId(activityTeamInfoAddModel.getProductId())
.productImage(activityTeamInfoAddModel.getProductImage())
.introduction(activityTeamInfoAddModel.getIntroduction())
.unit(activityTeamInfoAddModel.getUnit())
.imageList(activityTeamInfoAddModel.getImageList())
.endTime(activityTeamInfoAddModel.getEndTime())
.sort(activityTeamInfoAddModel.getSort())
.content(activityTeamInfoAddModel.getContent())
.strategyType(activityTeamInfoAddModel.getStrategyType())
.strategyId(activityTeamInfoAddModel.getStrategyId())
.content(activityTeamInfoAddModel.getContent())
.status(activityTeamInfoAddModel.getStatus())
.createBy(createBy.get())
.createTime(new Date())
.build();
}
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.product.domain.ProjectSkuInfo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -54,4 +55,38 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
*
*/
private BigDecimal teamPrice;
// /**
// * 拼团规格信息构建
// * @param projectSkuInfo
// * @param o
// * @return
// */
// public static ActivityTeamProductSkuInfo productSkuModelBuild(ProjectSkuInfo projectSkuInfo, Object o) {
// return ActivityTeamProductSkuInfo.builder()
// .productId(projectSkuInfo.getProjectId())
// .productSku(projectSkuInfo.getSku())
// .teamPrice(projectSkuInfo.getPrice())
// .teamStock(projectSkuInfo.getStock())
// .remainStock(projectSkuInfo.getStock())
// .build();
// }
// /**
// * 拼团规格信息构建
// * @param projectSkuInfo
// * @param id
// * @param o
// * @return
// */
// public static ActivityTeamProductSkuInfo productSkuModelBuild(ProjectSkuInfo projectSkuInfo, Long id, Object o) {
// return ActivityTeamProductSkuInfo.builder()
// .id(id)
// .productId(projectSkuInfo.getProjectId())
// .productSku(projectSkuInfo.getSku())
// .teamPrice(projectSkuInfo.getPrice())
// .teamStock(projectSkuInfo.getStock())
// .remainStock(projectSkuInfo.getStock())
// .build();
// }
}

View File

@ -1,81 +0,0 @@
package com.muyu.marketing.domain.model;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.marketing.domain.ActivityTeamInfo;
import lombok.*;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.Date;
@Data
//@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ActivityTeamInfoAddModel extends BaseEntity {
/**
*
*/
private String name;
/**
*
*/
private String productImage;
/**
*
*/
private String imageList;
/**
*
*/
private Long teamStock;
/**
*
*/
private BigDecimal productPrice;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long attendTeamNumber;
/**
*
*/
private Long addTeamNumber;
/**
*
*/
private Long openTeamNumber;
/**
*
*/
private Long remainStock;
/**
*
*/
private String status;
/**
*
*/
private Date endTime;
// public ActivityTeamInfoAddModel AddBuild(){
// return ActivityTeamInfoAddModel.builder()
// .name(this.name)
// .productImage(this.getProductImage())
// .imageList(this.getImageList())
// .teamStock(this.getTeamStock())
// .productPrice(this.getProductPrice())
// .teamPrice(this.getTeamPrice())
// .attendTeamNumber(this.getAttendTeamNumber())
// .addTeamNumber(this.getAddTeamNumber())
// .openTeamNumber(this.getOpenTeamNumber())
// .remainStock(this.getRemainStock())
// .build();
// }
}

View File

@ -0,0 +1,97 @@
package com.muyu.marketing.domain.req;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.product.domain.RuleInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ActivityTeamInfoAddReq {
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty("主键")
private Long id;
/**
* ID
*/
@NotNull(message = "商品ID不能为空")
private Long productId;
/**
*
*/
private String productImage;
/**
*
*/
@NotNull(message = "商品名称不能为空")
private String name;
/**
*
*/
@NotNull(message = "商品简介不能为空")
private String introduction;
/**
*
*/
private String unit;
/**
*
*/
@NotNull(message = "商品轮播图不能为空")
private String imageList;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/**
* ID
*/
@NotNull(message = "策略ID不能为空")
private Long strategyId;
/**
*
*/
@NotNull(message = "策略类型不能为空")
private String strategyType;
/**
* List
*/
@NotNull(message = "商品规格不能为空")
private List<RuleInfo> ruleInfo;
/**
*
*/
@NotNull(message = "排序不能为空")
private Integer sort;
/**
*
*/
@NotNull(message = "详情不能为空")
private String content;
/**
*
*/
private String status;
/**
* List
*/
private List<RuleInfo> ruleInfoList;
}

View File

@ -0,0 +1,81 @@
//package com.muyu.marketing.domain.resp;
//
//import lombok.AllArgsConstructor;
//import lombok.Builder;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//
//import javax.validation.constraints.NotNull;
//import javax.validation.constraints.Pattern;
//import java.math.BigDecimal;
//import java.util.Date;
//
//@Data
//@AllArgsConstructor
//@NoArgsConstructor
//@Builder
//public class ActivityTeamInfoResp {
// /**
// * 主键
// */
// private Long id;
// /**
// * 拼团名称
// */
// @NotNull(message = "拼团名称不能为空")
// private String name;
// /**
// * 参团人数
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "拼团人数必须为正整数")
// private Long addTeamNumber;
//
// /**
// * 开团人数
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "开团人数必须为正整数")
// private Long openTeamNumber;
// /**
// * 拼团人数
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "拼团人数必须为正整数")
// private Long attendTeamNumber;
// /**
// * 活动结束时间
// */
// private Date endTime;
// /**
// * 图片
// */
// private String productImage;
// /**
// * 拼团价格
// */
// @Pattern(regexp = "^(([1-9][0-9]*)|(([0-9]|[1-9][0-9]*)(\\.[0-9]{1,2})?))$", message = "拼团价格必须为小数")
// private BigDecimal teamPrice;
//
// /**
// * 商品价格
// */
// @Pattern(regexp = "^(([1-9][0-9]*)|(([0-9]|[1-9][0-9]*)(\\.[0-9]{1,2})?))$", message = "商品价格必须为小数")
// private BigDecimal productPrice;
// /**
// * 总库存
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "总库存必须为正整数")
// private Long totalStock;
// /**
// * 团购库存
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "团购库存必须为正整数")
// private Long teamStock;
// /**
// * 剩余库存
// */
// @Pattern(regexp = "^[1-9]\\d*$", message = "剩余库存必须为正整数")
// private Long RemainStock;
// /**
// * 活动状态
// */
// private String Status;
//}

View File

@ -0,0 +1,41 @@
//package com.muyu.marketing.domain.resp;
//
//import com.baomidou.mybatisplus.annotation.IdType;
//import com.baomidou.mybatisplus.annotation.TableId;
//import com.baomidou.mybatisplus.annotation.TableName;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.AllArgsConstructor;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//
//import java.math.BigDecimal;
//
//@Data
//@NoArgsConstructor
//@AllArgsConstructor
//@TableName(value = "activity_team_product_sku_info")
//public class RuleInfo {
//
//
// /**
// * 主键
// */
//
//
// @TableId(value = "id",type = IdType.AUTO)
// @ApiModelProperty("主键")
// private Long id;
// /**
// *规格Sku
// */
// private String ruleSku;
// /**
// *拼团库存
// */
// private Long teamStock;
// /**
// * 拼团价格
// */
// private BigDecimal teamPrice;
//
//}

View File

@ -0,0 +1,25 @@
//package com.muyu.marketing.domain.resp;
//
//import lombok.AllArgsConstructor;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//
//import java.math.BigDecimal;
//
//@Data
//@AllArgsConstructor
//@NoArgsConstructor
//public class Strategy {
// /**
// * 商品规格id
// */
// private Long productSkuId;
// /**
// * 拼团价格
// */
// private BigDecimal price;
// /**
// * 拼团库存
// */
// private Long stock;
//}

View File

@ -17,7 +17,7 @@ import java.util.Date;
@NoArgsConstructor
@Builder
public class TeamInfoListResp {
/**
/**
*
*/
private Long id;

View File

@ -2,7 +2,7 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-marketing</artifactId>
<version>3.6.3</version>
@ -14,7 +14,7 @@
<artifactId>marketing-server</artifactId>
<description>
marketing-server系统模块
marketing-server系统模块
</description>
<dependencies>
@ -90,6 +90,22 @@
<groupId>com.muyu</groupId>
<artifactId>muyu-product-cache</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.15.2</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-file</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-product-server</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>

View File

@ -16,7 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
//@MapperScan("com.muyu.marketing.mapper")
@MapperScan("com.muyu.marketing.mapper")
public class MuYuMarketingApplication {
public static void main (String[] args) {
SpringApplication.run(MuYuMarketingApplication.class, args);

View File

@ -4,21 +4,22 @@ import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
import com.muyu.marketing.domain.resp.TeamInfoListResp;
import com.muyu.marketing.service.ActivityTeamInfoService;
import com.muyu.marketing.util.OssUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import javax.validation.Valid;
@RestController
@RequestMapping("/activity")
@ -26,22 +27,20 @@ public class ActivityTeamInfoController {
@Autowired
private ActivityTeamInfoService activityTeamInfoService;
@PostMapping("list")
public Result<TableDataInfo<TeamInfoListResp>> list(@RequestBody ActivityTeamInfoReq activityTeamInfoReq){
activityTeamInfoService.query(activityTeamInfoReq.buildQueryModel());
return Result.success();
public Result<TableDataInfo<ActivityTeamInfoListModel>> list(@RequestBody ActivityTeamInfoReq activityTeamInfoReq) {
TableDataInfo<ActivityTeamInfoListModel> query = activityTeamInfoService.query(activityTeamInfoReq.buildQueryModel());
return Result.success(query);
}
/**
*
/**
*
*/
@Log(title = "属性组", businessType = BusinessType.INSERT)
@Log(title = "拼团", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("新增拼团")
public Result<String> add(@RequestBody ActivityTeamInfo activityTeamInfo) {
// return toAjax(
// activityTeamInfoService.add(ActivityTeamInfoAddModel.AddBuild(activityTeamInfo))
// );
return null;
public Result add(@RequestBody ActivityTeamInfoAddReq activityTeamInfoAddReq) {
return activityTeamInfoService.insert(activityTeamInfoAddReq);
}
}

View File

@ -0,0 +1,15 @@
package com.muyu.marketing.remote;
import com.muyu.common.core.domain.Result;
import com.muyu.product.domain.ProjectSkuInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@FeignClient(value = "muyu-product")
public interface ProjectRemoteService {
@GetMapping("/sku/list/{projectId}")
public Result<List<ProjectSkuInfo>> listByProjectId(@PathVariable("projectId") Long projectId);
}

View File

@ -1,10 +1,13 @@
package com.muyu.marketing.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -15,4 +18,11 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
* @return
*/
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
/**
*
* @param activityTeamInfoAddReq
* @return
*/
Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq);
}

View File

@ -10,6 +10,7 @@ import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
import com.muyu.marketing.domain.model.TeamProductDisCountPriceModel;
import com.muyu.marketing.domain.model.TeamProductStockModel;
import java.math.BigInteger;
import java.util.List;
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
@ -37,4 +38,5 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
public TeamProductStockModel getStock(Long teamId);
List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId);
}

View File

@ -1,29 +1,28 @@
package com.muyu.marketing.service.impl;
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.utils.StringUtils;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.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.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.model.*;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq;
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
import com.muyu.marketing.service.ActivityTeamInfoService;
import com.muyu.marketing.service.ActivityTeamOpenInfoService;
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
import com.muyu.product.domain.RuleInfo;
import com.muyu.product.service.ProjectInfoService;
import com.muyu.marketing.remote.ProjectRemoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
@Service
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo> implements ActivityTeamInfoService {
@ -34,6 +33,13 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
@Autowired
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
// @Autowired
// private ProjectInfoService projectInfoService;
//
// @Autowired
// private ProjectRemoteService projectRemoteService;
@Override
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
@ -43,7 +49,7 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStates()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStates());
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(
activityTeamInfoListQueryModel.buildPage()
, queryWrapper);
@ -59,12 +65,12 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
TeamProductStockModel productStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
return ActivityTeamInfoListModel.builder()
return ActivityTeamInfoListModel.builder()
.id(activityTeamInfo.getId())
.name(activityTeamInfo.getName())
.addTeamNumber(addTeamNumber)
.openTeamNumber(openTeamNumber)
.attendTeamNumber(openTeamNumber+addTeamNumber)
.attendTeamNumber(openTeamNumber + addTeamNumber)
.endTime(activityTeamInfo.getEndTime())
.productImage(activityTeamInfo.getProductImage())
.teamPrice(discountPrice.getTeamPrice())
@ -78,5 +84,41 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
tableDataInfo.setRows(activityTeamInfoListModels);
return tableDataInfo;
}
/**
*
* @param activityTeamInfoAddReq
* @return
*/
@Override
public Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq) {
//构建活动信息
ActivityTeamInfo activityTeamInfo=ActivityTeamInfo.saveBuildModel(activityTeamInfoAddReq,SecurityUtils::getUsername);
//插入活动信息
this.save(activityTeamInfo);
//构建拼团规则信息
List<RuleInfo> ruleInfoList = activityTeamInfoAddReq.getRuleInfoList();
//构建拼团规则明细
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = ruleInfoList.stream().map(ruleInfo -> {
ActivityTeamProductSkuInfo teamProductSkuInfo = ActivityTeamProductSkuInfo.builder()
.id(ruleInfo.getId())
.teamId(activityTeamInfo.getId())
.productId(activityTeamInfoAddReq.getProductId())
.teamStock(ruleInfo.getTeamStock())
.teamPrice(ruleInfo.getTeamPrice())
.productSku(ruleInfo.getRuleSku())
.createTime(new Date())
.updateTime(new Date())
.createBy(SecurityUtils.getUsername())
.updateBy(SecurityUtils.getUsername())
.remark(ruleInfo.getRemark())
.params(ruleInfo.getParams())
.searchValue(ruleInfo.getSearchValue())
.build();
return teamProductSkuInfo;
}).toList();
//批量插入拼团规则明细
activityTeamProductSkuInfoService.saveBatch(activityTeamProductSkuInfoList);
return Result.success(200,"添加成功");
}
}

View File

@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.rmi.ServerException;
import java.util.Comparator;
import java.util.List;
@ -51,4 +52,16 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
.remainStock(activityTeamProductSkuInfoList.stream().mapToLong(ActivityTeamProductSkuInfo::getRemainStock).sum())
.build();
}
/**
* id
* @param productId
* @return
*/
@Override
public List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId) {
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<ActivityTeamProductSkuInfo>().eq(ActivityTeamProductSkuInfo::getProductId, productId);
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.list(queryWrapper);
return activityTeamProductSkuInfoList;
}
}

View File

@ -0,0 +1,175 @@
package com.muyu.marketing.util;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.PutObjectRequest;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.time.LocalDateTime;
import java.util.UUID;
/**
* Oss
*/
@Log4j2
@Configuration
@ConfigurationProperties(prefix = "oss")
@Data
public class OssUtil {
/**
* Endpoint AccessKeyaccessKeySecretAPI访 访
*/
private String endPoint;
private String accessKeyId;
private String accessKeySecret;
private String accessPre;
/**
* bucket
*
* @return
*/
private String bucketName;
/**
* OSS
* @return
*/
private OSS initOssClient() {
return new OSSClientBuilder().build(
endPoint,
accessKeyId,
accessKeySecret);
}
/**
*
*
* @param filePath
*/
public String uploadFile(String filePath) {
return uploadFileForBucket(bucketName, getOssFilePath(filePath), filePath);
}
/**
* multipartFile
*
* @param multipartFile
*/
public String uploadMultipartFile(MultipartFile multipartFile) {
return uploadMultipartFile(bucketName, getOssFilePath(multipartFile.getOriginalFilename()), multipartFile);
}
/**
* multipartFile
*
* @param bucketName
* @param ossPath
* @param multipartFile
*/
public String uploadMultipartFile(String bucketName, String ossPath, MultipartFile multipartFile) {
InputStream inputStream = null;
try {
inputStream = multipartFile.getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
return accessPre + ossPath;
}
/**
* 使FilePutObject ** 使
*
* @param bucketName
* @param ossPath oss
* @param filePath
*/
public String uploadFileForBucket(String bucketName, String ossPath, String filePath) {
// 创建PutObjectRequest对象。
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, ossPath, new File(filePath));
// 上传
initOssClient().putObject(putObjectRequest);
return accessPre + ossPath;
}
/**
* 使bucket
*
* @param bucketName
* @param ossPath oss
* @param filePath
*/
public String uploadFileInputStreamForBucket(String bucketName, String ossPath, String filePath) {
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
InputStream inputStream = null;
try {
inputStream = new FileInputStream(filePath);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
return accessPre + ossPath;
}
public void uploadFileInputStreamForBucket(String bucketName, String ossPath, InputStream inputStream) {
initOssClient().putObject(bucketName, ossPath, inputStream);
}
/**
*
*
* @param ossFilePath
* @param filePath
*/
public void downloadFile(String ossFilePath, String filePath) {
downloadFileForBucket(bucketName, ossFilePath, filePath);
}
/**
*
*
* @param bucketName
* @param ossFilePath oss
* @param filePath
*/
public void downloadFileForBucket(String bucketName, String ossFilePath, String filePath) {
initOssClient().getObject(new GetObjectRequest(bucketName, ossFilePath), new File(filePath));
}
/**
* @return
*/
public String getOssDefaultPath() {
LocalDateTime now = LocalDateTime.now();
String url =
now.getYear() + "/" +
now.getMonth() + "/" +
now.getDayOfMonth() + "/" +
now.getHour() + "/" +
now.getMinute() + "/";
return url;
}
/**
*
* @param filePath
* @return
*/
public String getOssFilePath(String filePath) {
String fileSuf = filePath.substring(filePath.lastIndexOf(".") + 1);
return getOssDefaultPath() + UUID.randomUUID().toString() + "." + fileSuf;
}
}

View File

@ -33,3 +33,9 @@ mybatis-plus:
- classpath*:mapper/*Mapper.xml
# 搜索指定包别名
typeAliasesPackage: com.muyu.marketing.domain
oss:
endPoint: https://oss-cn-shanghai.aliyuncs.com
accessKeyId: LTAI5tLMYKdkKFsCqjNMk1GY
accessKeySecret: m3Tnb3FWegHh7tnfN1o48vZ2UyJa4l
accessPre: https://ccc-demo123123.oss-cn-shanghai.aliyuncs.com/
bucketName: lhc-2204a

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.muyu.marketing.mapper.ActivityTeamOpenInfoMapper">
</mapper>

View File

@ -16,6 +16,7 @@ import com.muyu.product.domain.req.RuleInfoSaveReq;
import com.muyu.product.domain.req.RuleInfoEditReq;
import com.muyu.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.function.Supplier;
@ -51,6 +52,19 @@ public class RuleInfo extends BaseEntity {
@ApiModelProperty(name = "规格状态", value = "规格状态")
private String status;
/**
*Sku
*/
private String ruleSku;
/**
*
*/
private Long teamStock;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/

View File

@ -3,6 +3,7 @@ package com.muyu.product;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsAttributeGroup;
import com.muyu.product.domain.req.AttributeInfoSaveReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
@ -12,6 +13,7 @@ import org.apache.ibatis.annotations.Param;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsAttributeGroupMapper extends BaseMapper<AsAttributeGroup> {
void shanchu(Long id);

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsBrandProject;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AsBrandProject;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsBrandProjectMapper extends BaseMapper<AsBrandProject> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttributeGroup;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AsCategoryAttributeGroup;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttribute;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AsCategoryAttribute;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsCategoryAttributeMapper extends BaseMapper<AsCategoryAttribute> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryBrand;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AsCategoryBrand;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsCategoryBrandMapper extends BaseMapper<AsCategoryBrand> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsProductAttributeInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AsProductAttributeInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AsProductAttributeInfoMapper extends BaseMapper<AsProductAttributeInfo> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AttributeGroup;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AttributeGroup;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AttributeGroupMapper extends BaseMapper<AttributeGroup> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AttributeInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.AttributeInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface AttributeInfoMapper extends BaseMapper<AttributeInfo> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.BrandInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.BrandInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface BrandInfoMapper extends BaseMapper<BrandInfo> {
String getName(Long brandId);

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.CategoryInfo;
import com.muyu.product.domain.resp.CategoryInfoResp;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -11,6 +12,7 @@ import com.muyu.product.domain.resp.CategoryInfoResp;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> {
int findById(String ids);

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.CommentInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.CommentInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface CommentInfoMapper extends BaseMapper<CommentInfo> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.CommentLikeInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.CommentLikeInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface CommentLikeInfoMapper extends BaseMapper<CommentLikeInfo> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.ProjectInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.ProjectInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
ProjectInfo getProjectName(String name);

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.ProjectSkuInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* SKUMapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.ProjectSkuInfo;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface ProjectSkuInfoMapper extends BaseMapper<ProjectSkuInfo> {
}

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.RuleAttrInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface RuleAttrInfoMapper extends BaseMapper<RuleAttrInfo> {
void shanchu(Long id);

View File

@ -6,6 +6,7 @@ import com.muyu.product.domain.RuleInfo;
import com.muyu.product.domain.req.RuleAttrInfoReq;
import com.muyu.product.domain.req.RuleInfoEditReq;
import com.muyu.product.domain.resp.RuleInfoResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
@ -14,6 +15,7 @@ import org.apache.ibatis.annotations.Param;
* @author DongZeLiang
* @date 2024-02-27
*/
@Mapper
public interface RuleInfoMapper extends BaseMapper<RuleInfo> {
RuleInfoResp getRuleById(Long id);

View File

@ -1,7 +1,9 @@
package com.muyu.product.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UpdAsCategoryAttributeMapper {
void delAsCategoryAttribute(Long id);

View File

@ -20,6 +20,7 @@ import com.muyu.product.service.*;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.ProjectInfoMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -33,6 +34,7 @@ import org.springframework.util.CollectionUtils;
* @date 2024-02-27
*/
@Slf4j
@Component
@Service
public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements ProjectInfoService {

View File

@ -28,3 +28,5 @@ spring:
logging:
level:
com.muyu.product.mapper: DEBUG
mybatis:
mapperLocations: classpath:mapper/*.xml