fix():拼团服务的增删改查

cloud-server
刘河平 2024-12-10 09:28:22 +08:00
parent 5e137c9f39
commit 3ac6928c32
64 changed files with 2085 additions and 919 deletions

View File

@ -31,6 +31,11 @@ public class TokenController {
@Autowired @Autowired
private SysLoginService sysLoginService; private SysLoginService sysLoginService;
/**
*
* @param form
* @return
*/
@PostMapping("login") @PostMapping("login")
public Result<?> login (@RequestBody LoginBody form) { public Result<?> login (@RequestBody LoginBody form) {
// 用户登录 // 用户登录
@ -39,6 +44,11 @@ public class TokenController {
return Result.success(tokenService.createToken(userInfo)); return Result.success(tokenService.createToken(userInfo));
} }
/**
* 退
* @param request
* @return
*/
@DeleteMapping("logout") @DeleteMapping("logout")
public Result<?> logout (HttpServletRequest request) { public Result<?> logout (HttpServletRequest request) {
String token = SecurityUtils.getToken(request); String token = SecurityUtils.getToken(request);
@ -52,6 +62,11 @@ public class TokenController {
return Result.success(); return Result.success();
} }
/**
*
* @param request
* @return
*/
@PostMapping("refresh") @PostMapping("refresh")
public Result<?> refresh (HttpServletRequest request) { public Result<?> refresh (HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request); LoginUser loginUser = tokenService.getLoginUser(request);
@ -63,6 +78,11 @@ public class TokenController {
return Result.success(); return Result.success();
} }
/**
*
* @param registerBody
* @return
*/
@PostMapping("register") @PostMapping("register")
public Result<?> register (@RequestBody RegisterBody registerBody) { public Result<?> register (@RequestBody RegisterBody registerBody) {
// 用户注册 // 用户注册

View File

@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@ -58,6 +59,7 @@ public class QueryModel<T> {
page.setOrders(Arrays.asList(this.isAsc() page.setOrders(Arrays.asList(this.isAsc()
?OrderItem.asc(this.getOrderByColumn()) ?OrderItem.asc(this.getOrderByColumn())
: OrderItem.desc(this.getOrderByColumn()))); : OrderItem.desc(this.getOrderByColumn())));
// page.setOrders(List.of(this.isAsc() ? OrderItem.asc(this.getOrderByColumn()) : OrderItem.desc(this.getOrderByColumn())));
return page; return page;
} }
} }

View File

@ -1,43 +1,31 @@
package com.muyu.marketing.domain; package com.muyu.marketing.domain;
import com.alibaba.ttl.threadpool.agent.internal.javassist.bytecode.AttributeInfo; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; 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.common.core.web.domain.BaseEntity;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq; import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; 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.BigDecimal;
import java.math.BigInteger;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
/**
*
*/
@Data @Data
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("activity_team_info")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "activity_team_info", description = "商品拼团信息") @TableName(value = "activity_team_info", autoResultMap = true)
public class ActivityTeamInfo extends BaseEntity { public class ActivityTeamInfo extends BaseEntity {
/** /**
* *
*/ */
@TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** /**
* *
@ -46,8 +34,7 @@ public class ActivityTeamInfo extends BaseEntity {
/** /**
* ID * ID
*/ */
private Long productId; private Long projectId;
/** /**
* *
*/ */
@ -67,13 +54,11 @@ 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; private Date endTime;
/** /**
* *
*/ */
private Integer sort; private Long sort;
/** /**
* *
*/ */
@ -93,16 +78,14 @@ public class ActivityTeamInfo extends BaseEntity {
/** /**
* *
* * @param activityTeamInfoAddModel
* @param activityTeamInfoAddModel * @return
* @return
*/ */
public static ActivityTeamInfo saveBuildModel(ActivityTeamInfoAddReq activityTeamInfoAddModel, Supplier<String> createBy){ public static ActivityTeamInfo addModelBuild(ActivityTeamInfoAddModel activityTeamInfoAddModel){
return ActivityTeamInfo.builder() return ActivityTeamInfo.builder()
.id(activityTeamInfoAddModel.getId())
.name(activityTeamInfoAddModel.getName()) .name(activityTeamInfoAddModel.getName())
.productId(activityTeamInfoAddModel.getProductId()) .projectId(activityTeamInfoAddModel.getProductId())
.productImage(activityTeamInfoAddModel.getProductImage()) .productImage(activityTeamInfoAddModel.getProductImage())
.introduction(activityTeamInfoAddModel.getIntroduction()) .introduction(activityTeamInfoAddModel.getIntroduction())
.unit(activityTeamInfoAddModel.getUnit()) .unit(activityTeamInfoAddModel.getUnit())
@ -110,12 +93,9 @@ public class ActivityTeamInfo extends BaseEntity {
.endTime(activityTeamInfoAddModel.getEndTime()) .endTime(activityTeamInfoAddModel.getEndTime())
.sort(activityTeamInfoAddModel.getSort()) .sort(activityTeamInfoAddModel.getSort())
.content(activityTeamInfoAddModel.getContent()) .content(activityTeamInfoAddModel.getContent())
.status(activityTeamInfoAddModel.getStatus())
.strategyType(activityTeamInfoAddModel.getStrategyType()) .strategyType(activityTeamInfoAddModel.getStrategyType())
.strategyId(activityTeamInfoAddModel.getStrategyId()) .strategyId(activityTeamInfoAddModel.getStrategyId())
.content(activityTeamInfoAddModel.getContent())
.status(activityTeamInfoAddModel.getStatus())
.createBy(createBy.get())
.createTime(new Date())
.build(); .build();
} }
} }

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -13,26 +12,23 @@ import lombok.experimental.SuperBuilder;
import java.util.Date; import java.util.Date;
/**
*
*/
@Data @Data
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("activity_team_open_info")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "activity_team_open_info", description = "团购活动执行表") @TableName(value = "activity_team_open_info", autoResultMap = true)
public class ActivityTeamOpenInfo extends BaseEntity { public class ActivityTeamOpenInfo 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;
/** /**
* *
*/ */
@ -40,7 +36,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
/** /**
* *
*/ */
private Long teamStrategyId; private String teamStrategyId;
/** /**
* *
*/ */
@ -52,7 +48,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
/** /**
* ID * ID
*/ */
private Long productId; private String productId;
/** /**
* *
*/ */
@ -68,7 +64,7 @@ public class ActivityTeamOpenInfo extends BaseEntity {
/** /**
* ID * ID
*/ */
private Long orderId; private String orderId;
/** /**
* *
*/ */

View File

@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.product.domain.ProjectSkuInfo; import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -14,17 +13,14 @@ import lombok.experimental.SuperBuilder;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
*
*/
@Data @Data
@SuperBuilder @SuperBuilder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@TableName("activity_team_product_sku_info")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "activity_team_product_sku_info", description = "商品拼团规格信息表") @TableName(value = "activity_team_product_sku_info", autoResultMap = true)
public class ActivityTeamProductSkuInfo extends BaseEntity { public class ActivityTeamProductSkuInfo extends BaseEntity {
/** /**
* *
*/ */
@ -46,7 +42,6 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
* *
*/ */
private Long teamStock; private Long teamStock;
/** /**
* *
*/ */
@ -56,37 +51,18 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
*/ */
private BigDecimal teamPrice; private BigDecimal teamPrice;
// /** /**
// * 拼团规格信息构建 *
// * @param projectSkuInfo * @param activityTeamProductSkuAddModel
// * @param o * @return
// * @return */
// */ public static ActivityTeamProductSkuInfo modelBuild(ActivityTeamProductSkuAddModel activityTeamProductSkuAddModel) {
// public static ActivityTeamProductSkuInfo productSkuModelBuild(ProjectSkuInfo projectSkuInfo, Object o) { return ActivityTeamProductSkuInfo.builder()
// return ActivityTeamProductSkuInfo.builder() .productId(activityTeamProductSkuAddModel.getProductId())
// .productId(projectSkuInfo.getProjectId()) .teamId(activityTeamProductSkuAddModel.getTeamId())
// .productSku(projectSkuInfo.getSku()) .teamStock(activityTeamProductSkuAddModel.getTeamStock())
// .teamPrice(projectSkuInfo.getPrice()) .remainStock(activityTeamProductSkuAddModel.getTeamStock())
// .teamStock(projectSkuInfo.getStock()) .teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
// .remainStock(projectSkuInfo.getStock()) .build();
// .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

@ -0,0 +1,58 @@
package com.muyu.marketing.domain;
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "team_strategy_exemption", autoResultMap = true)
public class TeamStrategyExemption extends BaseEntity {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private long id;
/**
*
*/
private long duration;
/**
*
*/
private long exemptionNumber;
/**
*
*/
private long maxBuy;
/**
*
*/
private long oneBuy;
/**
*
*/
private long virtualNumber;
/**
*
*/
private String type;
/**
*
*/
private String ruleInfo;
/**
*
*/
private String status;
}

View File

@ -0,0 +1,50 @@
package com.muyu.marketing.domain;
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "team_strategy_exemption_hundred", autoResultMap = true)
public class TeamStrategyExemptionHundred extends BaseEntity {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private long id;
/**
*
*/
private long duration;
/**
*
*/
private long maxBuy;
/**
*
*/
private long oneBuy;
/**
*
*/
private long virtualNumber;
/**
*
*/
private String status;
/**
*
*/
private String ruleInfo;
}

View File

@ -0,0 +1,50 @@
package com.muyu.marketing.domain;
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "team_strategy_exemption_ordinary", autoResultMap = true)
public class TeamStrategyExemptionOrdinary extends BaseEntity {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
private long id;
/**
*
*/
private long duration;
/**
*
*/
private long teamNumber;
/**
*
*/
private long maxBuy;
/**
*
*/
private long oneBuy;
/**
*
*/
private long virtualNumber;
/**
*
*/
private String status;
}

View File

@ -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;
}

View File

@ -0,0 +1,77 @@
package com.muyu.marketing.domain.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ActivityProductUpdModel {
/**
* 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 Long sort;
/**
* SkU
*/
private ActivityProductUpdResp activityProductUpdResp;
/**
*
*/
private String content;
/**
*
*/
private String status;
/**
*
*/
private String strategyType;
/**
* ID
*/
private Long strategyId;
}

View File

@ -0,0 +1,103 @@
package com.muyu.marketing.domain.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
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 ActivityTeamInfoAddModel {
/**
*
*/
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 Long sort;
/**
* SkU
*/
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList;
/**
*
*/
private String content;
/**
*
*/
private String status;
/**
*
*/
private String strategyType;
/**
* ID
*/
private Long strategyId;
public static ActivityTeamInfoAddModel addBuild(ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
return ActivityTeamInfoAddModel.builder()
.name(activityTeamInfoSaveReq.getName())
.productId(activityTeamInfoSaveReq.getProductId())
.productImage(activityTeamInfoSaveReq.getProductImage())
.introduction(activityTeamInfoSaveReq.getIntroduction())
.unit(activityTeamInfoSaveReq.getUnit())
.imageList(activityTeamInfoSaveReq.getImageList())
.endTime(activityTeamInfoSaveReq.getEndTime())
.sort(activityTeamInfoSaveReq.getSort())
.content(activityTeamInfoSaveReq.getContent())
.status(activityTeamInfoSaveReq.getStatus())
.strategyType(activityTeamInfoSaveReq.getStrategyType())
.strategyId(activityTeamInfoSaveReq.getStrategyId())
.activityTeamProductSkuAddModelList(
activityTeamInfoSaveReq.getProjectSkuInfoAddReqList()
.stream().map(addReq -> ActivityTeamProductSkuAddModel.addReqBuild(addReq,activityTeamInfoSaveReq::getProductId))
.toList()
).build();
}
}

View File

@ -8,17 +8,20 @@ import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.function.Function;
/** /**
* *
* @author DongZeLiang
* @date 2024-11-20 14:18:10
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@Builder @Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivityTeamInfoListModel { public class ActivityTeamInfoListModel {
/** /**
* * ID
*/ */
private Long id; private Long id;
/** /**
@ -29,48 +32,67 @@ public class ActivityTeamInfoListModel {
* *
*/ */
private Long addTeamNumber; private Long addTeamNumber;
/**
*
*/
private Long attendNumber;
/**
*
*/
private Date endTime;
/** /**
* *
*/ */
private Long openTeamNumber; private Long openTeamNumber;
/** /**
* *
*/
private Long attendTeamNumber;
/**
*
*/
private Date endTime;
/**
*
*/ */
private String productImage; private String productImage;
/**
*
*/
private BigDecimal teamPrice;
/** /**
* *
*/ */
private BigDecimal productPrice; private BigDecimal productPrice;
/**
*
*/
private Long remainStock;
/**
*
*/
private String status;
/**
*
*/
private BigDecimal teamPrice;
/** /**
* *
*/ */
private Long teamStock; private Long teamStock;
/**
*
*/
private Long totalStock;
/**
*
*/
private Long RemainStock;
/**
*
*/
private String Status;
public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function<ActivityTeamInfoListModelBuilder, ActivityTeamInfoListModel> function) {
ActivityTeamInfoListModel activityTeamInfoListModel = ActivityTeamInfoListModel.builder()
.id(activityTeamInfo.getId())
.name(activityTeamInfo.getName())
// .openTeamNumber(teamOpenTypeNumber)
// .addTeamNumber(teamInTypeNumber)
// .attendNumber(teamOpenTypeNumber + teamInTypeNumber)
.endTime(activityTeamInfo.getEndTime())
.productImage(activityTeamInfo.getProductImage())
// .teamPrice(discountPrice.getTeamPrice())
// .productPrice(discountPrice.getProductPrice())
// .teamStock(teamProductStockModel.getTeamStock())
// .remainStock(teamProductStockModel.getRemainStock())
.status(activityTeamInfo.getStatus())
.build();
return function.apply(
ActivityTeamInfoListModel.builder()
.id(activityTeamInfo.getId())
.name(activityTeamInfo.getName())
.endTime(activityTeamInfo.getEndTime())
.productImage(activityTeamInfo.getProductImage())
.status(activityTeamInfo.getStatus())
);
}
} }

View File

@ -1,5 +1,7 @@
package com.muyu.marketing.domain.model; package com.muyu.marketing.domain.model;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.muyu.common.core.web.model.QueryModel; import com.muyu.common.core.web.model.QueryModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -7,19 +9,29 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import java.util.Arrays;
/**
*
* @author DongZeLiang
* @date 2024-11-20 14:18:10
*/
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder @SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> { public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
/** /**
* *
*/ */
private String keyWord; private String keyWord;
/** /**
* *
*/ */
private String states; private String status;
} }

View File

@ -0,0 +1,59 @@
package com.muyu.marketing.domain.model;
import com.muyu.marketing.domain.req.ProjectSkuInfoAddReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.function.Supplier;
/**
* spu
*
* @author DongZeLiang
* @date 2024-11-26 09:36
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ActivityTeamProductSkuAddModel {
/**
* ID
*/
private Long teamId;
/**
* ID
*/
private Long productId;
/**
* SKU
*/
private String productSku;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
public static ActivityTeamProductSkuAddModel addReqBuild(ProjectSkuInfoAddReq projectSkuInfoAddReq, Supplier<Long> getProductId) {
return ActivityTeamProductSkuAddModel.builder()
.teamId(projectSkuInfoAddReq.getId())
.productId(getProductId.get())
.productSku(projectSkuInfoAddReq.getSku())
.teamStock(projectSkuInfoAddReq.getTeamStock())
.teamPrice(projectSkuInfoAddReq.getTeamPrice())
.build();
}
}

View File

@ -0,0 +1,32 @@
package com.muyu.marketing.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* sku
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ActivityTeamProductSkuUpdModel {
/**
* id
*/
private Long ProductId;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -0,0 +1,33 @@
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 ProductSkuAddModel {
/**
* ID
*/
private Long productId;
/**
*
*/
private String productSku;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -0,0 +1,33 @@
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 ProductSkuUpdModel {
/**
* ID
*/
private Long productId;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -1,47 +0,0 @@
package com.muyu.marketing.domain.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TeamProductDisCountPriceModel {
/**
*
*/
private BigDecimal productPrice;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private BigDecimal discount;
/**
*
* @param productPrice
* @param teamPrice
* @return
*/
public static TeamProductDisCountPriceModel of(BigDecimal productPrice, BigDecimal teamPrice) {
return TeamProductDisCountPriceModel.builder()
.productPrice(productPrice)
.teamPrice(teamPrice)
.discount(
BigDecimal.valueOf(productPrice.subtract(teamPrice).divide(productPrice, 2, BigDecimal.ROUND_HALF_UP).doubleValue())
)
.build();
}
}

View File

@ -8,17 +8,21 @@ import lombok.NoArgsConstructor;
/** /**
* *
*
* @author DongZeLiang
* @date 2024-11-21 14:04
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@Builder @Builder
@NoArgsConstructor
@AllArgsConstructor
public class TeamProductStockModel { public class TeamProductStockModel {
/** /**
* *
*/ */
private Long teamStock; private Long teamStock;
/** /**
* *
*/ */

View File

@ -0,0 +1,74 @@
package com.muyu.marketing.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ActivityProductUpdReq {
/**
* id
*/
private Long id;
/**
*
*/
private String name;
/**
* ID
*/
private Long projectId;
/**
*
*/
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 Long sort;
/**
* SkU
*/
private ActivityProductUpdResp activityProductUpdResp;
/**
*
*/
private String content;
/**
*
*/
private String status;
/**
*
*/
private String strategyType;
/**
* ID
*/
private Long strategyId;
}

View File

@ -33,7 +33,7 @@ public class ActivityTeamInfoReq extends PageDomain {
public ActivityTeamInfoListQueryModel buildQueryModel(){ public ActivityTeamInfoListQueryModel buildQueryModel(){
return ActivityTeamInfoListQueryModel.builder() return ActivityTeamInfoListQueryModel.builder()
.keyWord(this.keyWord) .keyWord(this.keyWord)
.states(this.states) .status(this.states)
.build() .build()
.domainBuild(this); .domainBuild(this);
} }

View File

@ -0,0 +1,75 @@
package com.muyu.marketing.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
import java.util.List;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ActivityTeamInfoSaveReq extends BaseEntity {
/**
*
*/
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 Long sort;
/**
* SkU
*/
private List<ProjectSkuInfoAddReq> projectSkuInfoAddReqList;
/**
*
*/
private String content;
/**
*
*/
private String status;
/**
*
*/
private String strategyType;
/**
* ID
*/
private Long strategyId;
}

View File

@ -0,0 +1,34 @@
package com.muyu.marketing.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
/**
*
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class ProjectSkuInfoAddReq {
private Long id;
/**
* SKU
*/
private String sku;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -0,0 +1,37 @@
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
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TeamInfoListReq extends PageDomain {
/**
*
*/
private String keyWord;
/**
*
*/
private String status;
/**
*
* @return
*/
public ActivityTeamInfoListQueryModel buildQueryModel() {
return ActivityTeamInfoListQueryModel.builder()
.keyWord(this.keyWord)
.status(this.status)
.build()
.domainBuild(this);
}
}

View File

@ -0,0 +1,33 @@
package com.muyu.marketing.domain.resp;
import com.muyu.marketing.domain.model.ActivityTeamProductSkuAddModel;
import com.muyu.marketing.domain.model.ActivityTeamProductSkuUpdModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ActivityProductUpdResp {
/**
* SkU
*/
private List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuUpdList;
/**
* idList
*/
private List<Long> deleteSkuIdList;
/**
* List
*/
private List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddList;
}

View File

@ -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 projectId;
/**
*
*/
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;
}

View File

@ -1,81 +0,0 @@
//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,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 ProductId;
/**
* SKU
*/
private String sku;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -0,0 +1,32 @@
package com.muyu.marketing.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ProductSkuResp {
/**
* id
*/
private Long ProductId;
/**
*
*/
private BigDecimal teamPrice;
/**
*
*/
private Long teamStock;
}

View File

@ -1,41 +0,0 @@
//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

@ -1,25 +0,0 @@
//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

@ -1,24 +1,22 @@
package com.muyu.marketing.domain.resp; package com.muyu.marketing.domain.resp;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date; import java.util.Date;
/**
*
*/
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@Builder @Builder
@NoArgsConstructor
@AllArgsConstructor
public class TeamInfoListResp { public class TeamInfoListResp {
/** /**
* * ID
*/ */
private Long id; private Long id;
/** /**
@ -29,47 +27,63 @@ public class TeamInfoListResp {
* *
*/ */
private Long addTeamNumber; private Long addTeamNumber;
/**
*
*/
private Long attendNumber;
/**
*
*/
private Date endTime;
/** /**
* *
*/ */
private Long openTeamNumber; private Long openTeamNumber;
/** /**
* *
*/
private Long attendTeamNumber;
/**
*
*/
private Date endTime;
/**
*
*/ */
private String productImage; private String productImage;
/**
*
*/
private BigDecimal teamPrice;
/** /**
* *
*/ */
private BigDecimal productPrice; private BigDecimal productPrice;
/** /**
* *
*/ */
private Long totalStock; private Long remainStock;
/**
*
*/
private String status;
/**
*
*/
private BigDecimal teamPrice;
/** /**
* *
*/ */
private Long teamStock; private Long teamStock;
/**
*
*/
private Long RemainStock;
/**
*
*/
private String Status;
/**
*
* @param activityTeamInfoListModel
* @return
*/
public static TeamInfoListResp listModelBuild(ActivityTeamInfoListModel activityTeamInfoListModel) {
return TeamInfoListResp.builder()
.id(activityTeamInfoListModel.getId())
.name(activityTeamInfoListModel.getName())
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
.attendNumber(activityTeamInfoListModel.getAttendNumber())
.endTime(activityTeamInfoListModel.getEndTime())
.teamPrice(activityTeamInfoListModel.getTeamPrice())
.productImage(activityTeamInfoListModel.getProductImage())
.productPrice(activityTeamInfoListModel.getProductPrice())
.remainStock(activityTeamInfoListModel.getRemainStock())
.status(activityTeamInfoListModel.getStatus())
.teamStock(activityTeamInfoListModel.getTeamStock())
.build();
}
} }

View File

@ -17,4 +17,5 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
</project> </project>

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>muyu-marketing</artifactId> <artifactId>muyu-marketing</artifactId>
<version>3.6.3</version> <version>3.6.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>marketing-server</artifactId> <artifactId>marketing-server</artifactId>
<description> <properties>
marketing-server系统模块 <maven.compiler.source>17</maven.compiler.source>
</description> <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
@ -79,7 +79,27 @@
<artifactId>muyu-common-swagger</artifactId> <artifactId>muyu-common-swagger</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
</dependency>
<!-- 远程调用 -->
<!-- <dependency>-->
<!-- <groupId>com.muyu</groupId>-->
<!-- <artifactId>marketing-remote</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>marketing-remote</artifactId>
<version>3.6.3</version>
</dependency>
<!-- 商品服务 缓存依赖 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-product-cache</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>marketing-common</artifactId> <artifactId>marketing-common</artifactId>
@ -88,18 +108,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>muyu-product-cache</artifactId> <artifactId>marketing-common</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> <version>3.6.3</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>muyu-product-server</artifactId> <artifactId>muyu-product-server</artifactId>
@ -133,5 +146,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

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

View File

@ -0,0 +1,96 @@
package com.muyu.marketing.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
import com.muyu.marketing.domain.req.ActivityProductUpdReq;
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.service.ActivityTeamInfoService;
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author DongZeLiang
* @date 2024-11-20 14:25
*/
@RestController
@RequestMapping("/team")
public class ActivityTeamController {
@Autowired
private ActivityTeamInfoService activityTeamInfoService;
@Autowired
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
/**
*
* @param teamInfoListReq
* @return
*/
@PostMapping("/list")
public Result<TableDataInfo<TeamInfoListResp>> list(@RequestBody TeamInfoListReq teamInfoListReq) {
// 查询活动列表
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel());
// 转换成响应结果
List<TeamInfoListResp> respList = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModelBuild).toList();
// 返回结果
return Result.success(
new TableDataInfo<>(){{
setRows(respList);
setTotal(tableDataInfo.getTotal());
}}
);
}
/**
*
*/
@PostMapping("insert")
public Result<String> insert(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
// 保存活动信息
activityTeamInfoService.save(ActivityTeamInfoAddModel.addBuild(activityTeamInfoSaveReq));
return Result.success();
}
/**
*
*/
@GetMapping("/{teamId}")
public Result<ActivityTeamInfoDetailResp> getTeamInfo(@PathVariable("teamId") Long teamId){
return Result.success(activityTeamInfoService.getActivityByTeamId(teamId));
}
/**
*
*/
@PutMapping("update")
public Result<String> update(@RequestBody ActivityProductUpdReq activityProductUpdReq){
activityTeamInfoService.edit(activityProductUpdReq);
return Result.success();
}
/**
*
*/
@GetMapping("/teamList")
public Result<TableDataInfo<ActivityTeamInfo>> teamList(){
List<ActivityTeamInfo> list = activityTeamInfoService.list();
TableDataInfo<ActivityTeamInfo> tableDataInfo = new TableDataInfo<>();
tableDataInfo.setRows(list);
tableDataInfo.setTotal(list.size());
return Result.success(tableDataInfo);
}
}

View File

@ -1,46 +0,0 @@
package com.muyu.marketing.controller;
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.marketing.domain.ActivityTeamInfo;
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.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 javax.validation.Valid;
@RestController
@RequestMapping("/activity")
public class ActivityTeamInfoController {
@Autowired
private ActivityTeamInfoService activityTeamInfoService;
@PostMapping("list")
public Result<TableDataInfo<ActivityTeamInfoListModel>> list(@RequestBody ActivityTeamInfoReq activityTeamInfoReq) {
TableDataInfo<ActivityTeamInfoListModel> query = activityTeamInfoService.query(activityTeamInfoReq.buildQueryModel());
return Result.success(query);
}
/**
*
*/
@Log(title = "拼团", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody ActivityTeamInfoAddReq activityTeamInfoAddReq) {
return activityTeamInfoService.insert(activityTeamInfoAddReq);
}
}

View File

@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> { public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
} }

View File

@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> { public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
} }

View File

@ -6,4 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> { public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
} }

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
}

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyExemption;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyExemptionMapper extends BaseMapper<TeamStrategyExemption> {
}

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper<TeamStrategyExemptionOrdinary> {
}

View File

@ -1,15 +0,0 @@
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

@ -4,25 +4,39 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
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.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.req.ActivityTeamInfoAddReq; import com.muyu.marketing.domain.req.ActivityProductUpdReq;
import org.springframework.web.multipart.MultipartFile; import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
import java.util.List;
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> { public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
/** /**
* *
* @param activityTeamInfoListQueryModel * @param activityTeamInfoListQueryModel
* @return * @return
*/ */
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel); public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
/** /**
* *
* @param activityTeamInfoAddReq * @param activityTeamInfoAddModel
* @return
*/ */
Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq); public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel);
/**
* id
*/
ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId);
/**
*
* @param activityProductUpdReq
*/
void edit(ActivityProductUpdReq activityProductUpdReq);
} }

View File

@ -5,30 +5,30 @@ import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
import com.muyu.marketing.domain.ActivityTeamOpenInfo; import com.muyu.marketing.domain.ActivityTeamOpenInfo;
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> { public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
/** /**
* id * ID
* @param teamId id * @param teamId ID
* @param teamOpenType * @param teamOpenType
* @return * @return
*/ */
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType); public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType);
/** /**
* id * ID
* @param teamId * @param teamId ID
* @return * @return
*/ */
public default Long getTeamOpenNumberByTeamId(Long teamId) { public default Long getTeamOpenTypeNumberByTeamId(Long teamId){
return getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM); return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.OPEN_TEAM);
} }
/** /**
* id * ID
* @param teamId * @param teamId ID
* @return * @return
*/ */
public default Long getTeamInNumberByTeamId(Long teamId) { public default Long getTeamInTypeNumberByTeamId(Long teamId){
return getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM); return this.getTeamOpenNumberByTeamIdAndType(teamId, TeamOpenTypeEnum.IN_TEAM);
} }
} }

View File

@ -2,15 +2,9 @@ package com.muyu.marketing.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.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel; import com.muyu.marketing.domain.model.*;
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; import java.util.List;
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> { public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
@ -21,22 +15,43 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
return this.list(lambdaQueryWrapper); return this.list(lambdaQueryWrapper);
} }
/**
* id
*
* @param teamId
* @return
*/
public TeamProductDisCountPriceModel getDiscountPrice(Long teamId);
/** /**
* id * ID
* * @param teamId ID
* @param teamId * @return
*/
public TeamProductDiscountPriceModel getDiscountPrice(Long teamId);
/**
* ID
* @param teamId ID
* @return * @return
*/ */
public TeamProductStockModel getStock(Long teamId); public TeamProductStockModel getStock(Long teamId);
List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId); /**
* SKU
* @param activityTeamProductSkuAddModelList SKU
*/
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList);
/**
* id
*/
public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId);
/**
*
*/
public boolean editBatchActivityTeamProductSkuUpdModelList(List<ActivityTeamProductSkuUpdModel> productSkuUpdList);
/**
*
*/
public boolean deleteBatchByTeamIds(List<Long> id);
} }

View File

@ -0,0 +1,9 @@
package com.muyu.marketing.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.strategy.ActivityTeamStrategy;
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred>, ActivityTeamStrategy {
}

View File

@ -0,0 +1,8 @@
package com.muyu.marketing.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
import com.muyu.marketing.strategy.ActivityTeamStrategy;
public interface TeamStrategyExemptionOrdinaryService extends ActivityTeamStrategy,IService<TeamStrategyExemptionOrdinary> {
}

View File

@ -0,0 +1,8 @@
package com.muyu.marketing.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.marketing.domain.TeamStrategyExemption;
import com.muyu.marketing.strategy.ActivityTeamStrategy;
public interface TeamStrategyExemptionService extends ActivityTeamStrategy, IService<TeamStrategyExemption> {
}

View File

@ -4,28 +4,32 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.domain.Result; 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.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.common.security.utils.SecurityUtils;
import com.muyu.marketing.domain.ActivityTeamInfo; import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo; import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.model.*; import com.muyu.marketing.domain.model.*;
import com.muyu.marketing.domain.req.ActivityTeamInfoAddReq; import com.muyu.marketing.domain.req.ActivityProductUpdReq;
import com.muyu.marketing.domain.resp.ActivityProductUpdResp;
import com.muyu.marketing.domain.resp.ActivityTeamInfoDetailResp;
import com.muyu.marketing.domain.resp.ActivityTeamProductSkuResp;
import com.muyu.marketing.mapper.ActivityTeamInfoMapper; import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
import com.muyu.marketing.service.ActivityTeamInfoService; import com.muyu.marketing.service.ActivityTeamInfoService;
import com.muyu.marketing.service.ActivityTeamOpenInfoService; import com.muyu.marketing.service.ActivityTeamOpenInfoService;
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo> implements ActivityTeamInfoService { public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
implements ActivityTeamInfoService {
@Autowired @Autowired
private ActivityTeamOpenInfoService activityTeamOpenInfoService; private ActivityTeamOpenInfoService activityTeamOpenInfoService;
@ -34,91 +38,180 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService; private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
// @Autowired // @Autowired
// private ProjectInfoService projectInfoService; // private ActivityTeamInfoMapper activityTeamInfoMapper;
//
// @Autowired
// private ProjectRemoteService projectRemoteService;
@Override @Override
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) { public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
// 查询条件
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
// 关键字查询
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord()); queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getKeyWord()), ActivityTeamInfo::getName, activityTeamInfoListQueryModel.getKeyWord());
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStates()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStates()); queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()), ActivityTeamInfo::getStatus, activityTeamInfoListQueryModel.getStatus());
/**
Page<ActivityTeamInfo> activityTeamInfoPage = this.page( * Object<T> ->
activityTeamInfoListQueryModel.buildPage() * <T> Result<T>
, queryWrapper); */
// 分页查询
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo(); Page<ActivityTeamInfo> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(), queryWrapper);
// 查询数据列表
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords(); List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
// 数据转换
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream() List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
.map(activityTeamInfo -> { .map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
Long addTeamNumber = activityTeamOpenInfoService.getTeamOpenNumberByTeamId(activityTeamInfo.getId()); (activityTeamInfoListModelBuilder) -> {
//获取折扣价
Long openTeamNumber = activityTeamOpenInfoService.getTeamInNumberByTeamId(activityTeamInfo.getId()); TeamProductDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
//根据活动id获取库存模型
TeamProductDisCountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId()); TeamProductStockModel teamProductStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
//获取已开团和已参团人数
TeamProductStockModel productStockModel = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId()); Long teamOpenTypeNumber = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId());
Long teamInTypeNumber = activityTeamOpenInfoService.getTeamInTypeNumberByTeamId(activityTeamInfo.getId());
return ActivityTeamInfoListModel.builder() //封装活动详情
.id(activityTeamInfo.getId()) return activityTeamInfoListModelBuilder
.name(activityTeamInfo.getName()) .openTeamNumber(teamOpenTypeNumber)
.addTeamNumber(addTeamNumber) .addTeamNumber(teamInTypeNumber)
.openTeamNumber(openTeamNumber) .attendNumber(teamOpenTypeNumber + teamInTypeNumber)
.attendTeamNumber(openTeamNumber + addTeamNumber)
.endTime(activityTeamInfo.getEndTime())
.productImage(activityTeamInfo.getProductImage())
.teamPrice(discountPrice.getTeamPrice()) .teamPrice(discountPrice.getTeamPrice())
.productPrice(discountPrice.getProductPrice()) .productPrice(discountPrice.getProductPrice())
.teamStock(productStockModel.getTeamStock()) .teamStock(teamProductStockModel.getTeamStock())
.RemainStock(productStockModel.getRemainStock()) .remainStock(teamProductStockModel.getRemainStock())
.Status(activityTeamInfo.getStatus())
.build(); .build();
}).toList(); })).toList();
// 封装分页数据
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo<>();
tableDataInfo.setTotal(activityTeamInfoPage.getTotal()); tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
tableDataInfo.setRows(activityTeamInfoListModels); tableDataInfo.setRows(activityTeamInfoListModels);
return tableDataInfo; return tableDataInfo;
} }
/** /**
* *
* @param activityTeamInfoAddReq *
* @param activityTeamInfoAddModel
*/
@Override
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel) {
// 添加团购活动
boolean save = this.save(ActivityTeamInfo.addModelBuild(activityTeamInfoAddModel));
//判断是否添加成功
if (!save) {
throw new ServiceException(
StringUtils.format("团购活动添加失败:[{}]", activityTeamInfoAddModel)
);
}
//拼团活动添加后添加商品SKU
this.activityTeamProductSkuInfoService.batchSave(
activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList()
);
}
/**
* id
*
* @param teamId
* @return * @return
*/ */
@Override @Override
public Result insert(ActivityTeamInfoAddReq activityTeamInfoAddReq) { public ActivityTeamInfoDetailResp getActivityByTeamId(Long teamId) {
//构建活动信息 //根据id查询活动详情
ActivityTeamInfo activityTeamInfo=ActivityTeamInfo.saveBuildModel(activityTeamInfoAddReq,SecurityUtils::getUsername); ActivityTeamInfo activityTeamInfo = getById(teamId);
//插入活动信息 //封装活动详情
this.save(activityTeamInfo); ActivityTeamInfoDetailResp activityTeamInfoDetailResp = new ActivityTeamInfoDetailResp();
//构建拼团规则信息 //根据活动id查询活动商品SKU集合
List<RuleInfo> ruleInfoList = activityTeamInfoAddReq.getRuleInfoList(); List<ActivityProductSkuListModel> teamProductSkuInfoList = activityTeamProductSkuInfoService.getTeamProductSkuInfoListByTeamId(teamId);
//构建拼团规则明细 if (teamProductSkuInfoList != null) {
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = ruleInfoList.stream().map(ruleInfo -> { //定义一个空集合
ActivityTeamProductSkuInfo teamProductSkuInfo = ActivityTeamProductSkuInfo.builder() ArrayList<ActivityTeamProductSkuResp> activityProductSkuList = new ArrayList<>();
.id(ruleInfo.getId()) for (ActivityProductSkuListModel activityProductSkuListModel : teamProductSkuInfoList) {
.teamId(activityTeamInfo.getId()) Long id = activityProductSkuListModel.getId();
.productId(activityTeamInfoAddReq.getProductId()) //根据id查询
.teamStock(ruleInfo.getTeamStock()) ActivityTeamProductSkuInfo activityTeamProductSkuInfo = activityTeamProductSkuInfoService.getById(id);
.teamPrice(ruleInfo.getTeamPrice()) //添加到集合中
.productSku(ruleInfo.getRuleSku()) activityProductSkuList.add(
.createTime(new Date()) ActivityTeamProductSkuResp.builder()
.updateTime(new Date()) .ProductId(activityTeamProductSkuInfo.getProductId())
.createBy(SecurityUtils.getUsername()) .sku(activityTeamProductSkuInfo.getProductSku())
.updateBy(SecurityUtils.getUsername()) .teamPrice(activityTeamProductSkuInfo.getTeamPrice())
.remark(ruleInfo.getRemark()) .teamStock(activityTeamProductSkuInfo.getTeamStock())
.params(ruleInfo.getParams()) .build()
.searchValue(ruleInfo.getSearchValue()) );
.build();
return teamProductSkuInfo;
}).toList();
//批量插入拼团规则明细
activityTeamProductSkuInfoService.saveBatch(activityTeamProductSkuInfoList);
return Result.success(200,"添加成功");
} }
//赋值
activityTeamInfoDetailResp.setActivityTeamProductSkuList(activityProductSkuList);
//克隆到activityTeamInfo
BeanUtils.copyBeanProp(activityTeamInfoDetailResp, activityTeamInfo);
}
return activityTeamInfoDetailResp;
} }
/**
*
* @param activityProductUpdReq
*/
@Transactional
@Override
public void edit(ActivityProductUpdReq activityProductUpdReq) {
//获取活动商品SKU
ActivityProductUpdResp activityProductUpdResp = activityProductUpdReq.getActivityProductUpdResp();
//获取需要删除的SKU集合
List<Long> deleteSkuIdList = activityProductUpdResp.getDeleteSkuIdList();
//判断是否为空
if (deleteSkuIdList != null){
activityTeamProductSkuInfoService.deleteBatchByTeamIds(deleteSkuIdList);
}
//获取需要修改的SKU集合
List<ActivityTeamProductSkuUpdModel> activityTeamProductSkuList = activityProductUpdResp.getActivityTeamProductSkuUpdList();
//判断是否为空
if (activityTeamProductSkuList != null){
activityTeamProductSkuList.stream().map(productSkuUpdModel -> {
return ProductSkuUpdModel.builder()
.productId(productSkuUpdModel.getProductId())
.teamPrice(productSkuUpdModel.getTeamPrice())
.teamStock(productSkuUpdModel.getTeamStock())
.build();
}).toList();
//批量修改SKU集合
activityTeamProductSkuInfoService.editBatchActivityTeamProductSkuUpdModelList(activityTeamProductSkuList);
}
//获取要添加的SKU集合
List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddList = activityProductUpdResp.getActivityTeamProductSkuAddList();
//判断是否为空
if (activityTeamProductSkuAddList != null){
activityTeamProductSkuAddList.stream().map(productSkuAddModel -> {
return ProductSkuAddModel.builder()
.productId(productSkuAddModel.getProductId())
.teamPrice(productSkuAddModel.getTeamPrice())
.teamStock(productSkuAddModel.getTeamStock())
.productSku(productSkuAddModel.getProductSku())
.build();
}).toList();
//批量添加SKU集合
activityTeamProductSkuInfoService.batchSave(activityTeamProductSkuAddList);
}
//修改活动信息
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.builder()
.id(activityProductUpdReq.getId())
.name(activityProductUpdReq.getName())
.projectId(activityProductUpdReq.getProjectId())
.productImage(activityProductUpdReq.getProductImage())
.introduction(activityProductUpdReq.getIntroduction())
.unit(activityProductUpdReq.getUnit())
.imageList(activityProductUpdReq.getImageList())
.endTime(activityProductUpdReq.getEndTime())
.sort(activityProductUpdReq.getSort())
.content(activityProductUpdReq.getContent())
.status(activityProductUpdReq.getStatus())
.strategyType(activityProductUpdReq.getStrategyType())
.strategyId(activityProductUpdReq.getStrategyId())
.build();
//修改拼团活动
updateById(activityTeamInfo);
}
}

View File

@ -9,8 +9,16 @@ import com.muyu.marketing.service.ActivityTeamOpenInfoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo> implements ActivityTeamOpenInfoService { public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
implements ActivityTeamOpenInfoService {
/**
* ID
*
* @param teamId ID
* @param teamOpenType
* @return
*/
@Override @Override
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) { public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();

View File

@ -1,67 +1,155 @@
package com.muyu.marketing.service.impl; package com.muyu.marketing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.marketing.domain.ActivityTeamProductSkuInfo; import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
import com.muyu.marketing.domain.model.*;
import com.muyu.marketing.domain.model.TeamProductDisCountPriceModel;
import com.muyu.marketing.domain.model.TeamProductStockModel;
import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper; import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper;
import com.muyu.marketing.service.ActivityTeamInfoService;
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService; import com.muyu.marketing.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 lombok.SneakyThrows;
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.util.ArrayList;
import java.math.BigInteger;
import java.rmi.ServerException;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@Service @Service
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo> implements ActivityTeamProductSkuInfoService { public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
implements ActivityTeamProductSkuInfoService {
@Autowired @Autowired
private ProjectSkuCache projectSkuCache; private ProjectSkuCache projectSkuCache;
@Autowired
private @Lazy ActivityTeamInfoService activityTeamInfoService;
@Autowired
private ActivityTeamProductSkuInfoMapper activityTeamProductSkuInfoMapper;
@SneakyThrows /**
* ID
* @param teamId ID
* @return
*/
@Override @Override
public TeamProductDisCountPriceModel getDiscountPrice(Long teamId) { public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) {
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId); List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
// 优惠模型集合
Optional<TeamProductDisCountPriceModel> disCountPriceModelOptional = activityTeamProductSkuInfoList.stream().map( Optional<TeamProductDiscountPriceModel> discountPriceModelOptional = teamProductSkuInfoList.stream()
activityTeamProductSkuInfo -> { .map(activityTeamProductSkuInfo -> {
// 根据商品ID和商品SKU查询商品信息
ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku()); ProjectSkuInfo projectSkuInfo = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
return TeamProductDiscountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
return TeamProductDisCountPriceModel.of(projectSkuInfo.getPrice(), activityTeamProductSkuInfo.getTeamPrice()); if (discountPriceModelOptional.isEmpty()) {
}).sorted(Comparator.comparing(TeamProductDisCountPriceModel::getDiscount)) throw new ServiceException("团购活动下没有商品绑定");
.findFirst();
if (disCountPriceModelOptional.isEmpty()) {
throw new ServerException("没有找到商品拼团信息");
} }
return disCountPriceModelOptional.get(); return discountPriceModelOptional.get();
} }
/**
* ID
*
* @param teamId ID
* @return
*/
@Override @Override
public TeamProductStockModel getStock(Long teamId) { public TeamProductStockModel getStock(Long teamId) {
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId); //根据活动id查询团购商品SKU集合
List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
//封装返回对象
return TeamProductStockModel.builder() return TeamProductStockModel.builder()
.teamStock(activityTeamProductSkuInfoList.stream().mapToLong(ActivityTeamProductSkuInfo::getTeamStock).sum()) .teamStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L, Long::sum))
.remainStock(activityTeamProductSkuInfoList.stream().mapToLong(ActivityTeamProductSkuInfo::getRemainStock).sum()) .remainStock(teamProductSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getRemainStock).reduce(0L, Long::sum))
.build(); .build();
} }
/** /**
* id * SKU
* @param productId *
* @param activityTeamProductSkuAddModelList SKU
*/
@Override
public void batchSave(List<ActivityTeamProductSkuAddModel> activityTeamProductSkuAddModelList) {
//判空
if (activityTeamProductSkuAddModelList == null || activityTeamProductSkuAddModelList.isEmpty()) {
throw new ServiceException("入参添加商品规格模型,不可为空");
}
//批量保存
this.saveBatch(
activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList()
);
}
/**
* IDSKU
*
* @param teamId
* @return * @return
*/ */
@Override @Override
public List<ActivityTeamProductSkuInfo> getSkuList(BigInteger productId) { public List<ActivityProductSkuListModel> getTeamProductSkuInfoListByTeamId(Long teamId) {
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<ActivityTeamProductSkuInfo>().eq(ActivityTeamProductSkuInfo::getProductId, productId); //根据活动id查询团购商品SKU集合
List<ActivityTeamProductSkuInfo> activityTeamProductSkuInfoList = this.list(queryWrapper); List<ActivityTeamProductSkuInfo> activityTeamProductSkuList = this.getActivityTeamProductSkuInfoByTeamId(teamId);
return activityTeamProductSkuInfoList; //封装返回对象
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;
}
/**
* SKU
*
* @param productSkuUpdList
* @return
*/
@Override
public boolean editBatchActivityTeamProductSkuUpdModelList(List<ActivityTeamProductSkuUpdModel> productSkuUpdList) {
//创建updateWrapper
LambdaUpdateWrapper<ActivityTeamProductSkuInfo> updateWrapper = new LambdaUpdateWrapper<>();
//遍历集合
for (ActivityTeamProductSkuUpdModel activityTeamProductSkuUpdModel : productSkuUpdList) {
//赋值
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamPrice, activityTeamProductSkuUpdModel.getTeamPrice());
updateWrapper.set(ActivityTeamProductSkuInfo::getTeamStock, activityTeamProductSkuUpdModel.getTeamStock());
updateWrapper.eq(ActivityTeamProductSkuInfo::getProductId, activityTeamProductSkuUpdModel.getProductId());
}
//返回
return this.update(updateWrapper);
}
/**
*
* @param id
* @return
*/
@Override
public boolean deleteBatchByTeamIds(List<Long> id) {
//创建updateWrapper
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//根据id查询
List<Long> productIdList = activityTeamProductSkuInfoMapper.selectList(lambdaQueryWrapper).stream().map(ActivityTeamProductSkuInfo::getProductId).toList();
//判断集合是否为空
if (productIdList == null && productIdList.isEmpty()) {
throw new ServiceException("该团购下没有商品");
}
return this.removeByIds(productIdList);
}
} }

View File

@ -0,0 +1,39 @@
package com.muyu.marketing.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
import com.muyu.marketing.mapper.TeamStrategyExemptionHundredMapper;
import com.muyu.marketing.service.TeamStrategyExemptionHundredService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@Service("team_strategy_exemption_hundred")
@Log4j2
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
implements TeamStrategyExemptionHundredService {
@Override
public void openTeam(Long activityTeamId) {
log.info("参加-百人团 -[{}]",activityTeamId);
}
@Override
public void applyTeam(Long teamId) {
}
@Override
public void addTeam(Long teamId, String orderNumber) {
}
@Override
public void backTeam(Long teamId) {
}
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,39 @@
package com.muyu.marketing.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
import com.muyu.marketing.mapper.TeamStrategyExemptionOrdinaryMapper;
import com.muyu.marketing.service.TeamStrategyExemptionOrdinaryService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@Service("team_strategy_exemption_ordinary")
@Log4j2
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
implements TeamStrategyExemptionOrdinaryService {
@Override
public void openTeam(Long activityTeamId) {
log.info("参加-普通团 -[{}]",activityTeamId);
}
@Override
public void applyTeam(Long teamId) {
}
@Override
public void addTeam(Long teamId, String orderNumber) {
}
@Override
public void backTeam(Long teamId) {
}
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,39 @@
package com.muyu.marketing.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.marketing.domain.TeamStrategyExemption;
import com.muyu.marketing.mapper.TeamStrategyExemptionMapper;
import com.muyu.marketing.service.TeamStrategyExemptionService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@Service("team_strategy_exemption")
@Log4j2
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
implements TeamStrategyExemptionService {
@Override
public void openTeam(Long activityTeamId) {
log.info("参加-免单团 -[{}]",activityTeamId);
}
@Override
public void applyTeam(Long teamId) {
}
@Override
public void addTeam(Long teamId, String orderNumber) {
}
@Override
public void backTeam(Long teamId) {
}
@Override
public void settle(Long teamId) {
}
}

View File

@ -0,0 +1,38 @@
package com.muyu.marketing.strategy;
/**
*
*/
public interface ActivityTeamStrategy {
/**
*
* @param activityTeamId id
*/
public void openTeam(Long activityTeamId);
/**
*
* @param teamId id
*/
public void applyTeam(Long teamId);
/**
*
* @param teamId id
* @param orderNumber
*/
public void addTeam(Long teamId, String orderNumber);
/**
* 退
* @param teamId id
*/
public void backTeam(Long teamId);
/**
*
* @param teamId id
*/
public void settle(Long teamId);
}

View File

@ -0,0 +1,47 @@
package com.muyu.marketing.strategy.impl;
import com.muyu.common.core.exception.ServiceException;
import com.muyu.common.core.utils.SpringUtils;
import com.muyu.marketing.strategy.ActivityTeamStrategy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@Service
@Primary
public class ActivityTeamStrategyImpl implements ActivityTeamStrategy {
@Override
public void openTeam(Long activityTeamId) {
String activityTeamType = null;
if (activityTeamId==null){
throw new ServiceException("activityTeamId 不能为空");
}else if (activityTeamId==1){
activityTeamType="team_strategy_exemption_hundred";
}else if (activityTeamId==2){
activityTeamType="team_strategy_exemption_ordinary";
}else if (activityTeamId==3){
activityTeamType="team_strategy_exemption";
}
ActivityTeamStrategy activityTeamStrategy = SpringUtils.getBean(activityTeamType);
activityTeamStrategy.openTeam(activityTeamId);
}
@Override
public void applyTeam(Long teamId) {
}
@Override
public void addTeam(Long teamId, String orderNumber) {
}
@Override
public void backTeam(Long teamId) {
}
@Override
public void settle(Long teamId) {
}
}

View File

@ -1,175 +0,0 @@
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

@ -27,15 +27,4 @@ spring:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging: logging:
level: level:
com.muyu.system.mapper: DEBUG com.muyu.marketing.mapper: DEBUG
mybatis-plus:
mapper-locations:
- 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

@ -52,18 +52,18 @@ public class RuleInfo extends BaseEntity {
@ApiModelProperty(name = "规格状态", value = "规格状态") @ApiModelProperty(name = "规格状态", value = "规格状态")
private String status; private String status;
/** // /**
*Sku // *规格Sku
*/ // */
private String ruleSku; // private String ruleSku;
/** // /**
* // *拼团库存
*/ // */
private Long teamStock; // private Long teamStock;
/** // /**
* // * 拼团价格
*/ // */
private BigDecimal teamPrice; // private BigDecimal teamPrice;
/** /**
* *

View File

@ -34,6 +34,7 @@ public class TemplateAttributeModel extends BaseEntity {
* *
*/ */
private String code; private String code;
private String value;
public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){ public static TemplateAttributeModel attributeInfoBuild(AttributeInfo attributeInfo){
return TemplateAttributeModel.builder() return TemplateAttributeModel.builder()

View File

@ -3,6 +3,7 @@ package com.muyu.product.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -108,4 +109,16 @@ public class CommentInfoController extends BaseController {
public Result<String> remove(@PathVariable List<Long> ids) { public Result<String> remove(@PathVariable List<Long> ids) {
return toAjax(commentInfoService.removeBatchByIds(ids)); return toAjax(commentInfoService.removeBatchByIds(ids));
} }
/**
* Id
*/
@GetMapping("/getCommentByProjectId/{projectId}")
public Result getCommentByProjectId(@PathVariable Long projectId){
//查询条件
LambdaQueryWrapper<CommentInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CommentInfo::getProjectId,projectId);
//查询
return Result.success(commentInfoService.list(lambdaQueryWrapper));
}
} }

View File

@ -70,6 +70,8 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Autowired @Autowired
private UpdAsCategoryAttributeMapper updAsCategoryAttributeMapper; private UpdAsCategoryAttributeMapper updAsCategoryAttributeMapper;
@Autowired
private AsProductAttributeInfoService asProductAttributeInfoService;
/** /**
* *
* *
@ -452,6 +454,50 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet); attributeInfoLambdaQueryWrapper.notIn(!attributeIdSet.isEmpty(), AttributeInfo::getId, attributeIdSet);
attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList(); attributeModelList = attributeInfoService.list(attributeInfoLambdaQueryWrapper).stream().map(AttributeInfo::buildTemplateModel).toList();
// 查询商品属性
attributeGroupModelList.forEach(TemplateAttributeGroupModel->{
//遍历获取属性值
TemplateAttributeGroupModel.getAttributeList().forEach(TemplateAttributeModel->{
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
// 属性ID
queryWrapper.eq(AsProductAttributeInfo::getAttributeId,TemplateAttributeModel.getId());
//根据商品ID查询属性值
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
//遍历属性赋值
list.forEach(AsProductAttributeInfo->{
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
});
});
});
// 查询未关联的属性
templateAttributeModelList.forEach(TemplateAttributeModel->{
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
// 属性ID
queryWrapper.eq(AsProductAttributeInfo::getAttributeId,TemplateAttributeModel.getId());
//根据商品ID查询属性值
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
//遍历赋值
list.forEach(AsProductAttributeInfo->{
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
});
});
// 查询未关联的属性
attributeModelList.forEach(TemplateAttributeModel->{
LambdaQueryWrapper<AsProductAttributeInfo> queryWrapper = new LambdaQueryWrapper<>();
// 属性ID
queryWrapper.eq(AsProductAttributeInfo::getAttributeId, TemplateAttributeModel.getId());
//根据商品ID查询属性值
List<AsProductAttributeInfo> list = this.asProductAttributeInfoService.list(queryWrapper);
//遍历赋值
list.forEach(AsProductAttributeInfo -> {
TemplateAttributeModel.setValue(AsProductAttributeInfo.getValue());
});
});
// 返回
return CategoryCommonElementResp.builder() return CategoryCommonElementResp.builder()
.templateAttributeGroupList(attributeGroupModelList) .templateAttributeGroupList(attributeGroupModelList)
.templateAttributeList(templateAttributeModelList) .templateAttributeList(templateAttributeModelList)