拼团列表 添加
parent
cac95799bd
commit
93de1f5c2d
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.common.core.enums.market.team;
|
||||
|
||||
/**
|
||||
* 参团类型枚举类
|
||||
*/
|
||||
public enum TeamOpenTypeEnum {
|
||||
//开团
|
||||
OPEN_TEAM("open_team","开团"),
|
||||
//参团
|
||||
IN_TEAM("in_team","参团")
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
|
||||
TeamOpenTypeEnum(String code, String label) {
|
||||
this.code = code;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String code() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String label() {
|
||||
return label;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.common.core.web.model;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class QueryModel<T> {
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
private String orderByColumn;
|
||||
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
private boolean isAsc = true;
|
||||
|
||||
/**
|
||||
* 分页参数合理化
|
||||
*/
|
||||
private Boolean reasonable = true;
|
||||
|
||||
/**
|
||||
* 构建模型分页对象
|
||||
*/
|
||||
public T domainbuild(PageDomain pageDomain){
|
||||
this.pageNum = pageDomain.getPageNum();
|
||||
this.pageSize = pageDomain.getPageSize();
|
||||
this.orderByColumn = pageDomain.getOrderByColumn();
|
||||
this.isAsc = "asc".equals(pageDomain.getIsAsc());
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建查询分页对象
|
||||
*/
|
||||
public <I> com.baomidou.mybatisplus.extension.plugins.pagination.Page<I> bulidPage(){
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<I> page = Page.of(this.getPageNum(), this.getPageSize());
|
||||
page.setOrders(List.of(this.isAsc()? OrderItem.asc(this.getOrderByColumn())
|
||||
:OrderItem.desc(this.getOrderByColumn())));
|
||||
return page;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,20 @@
|
|||
package com.muyu.common.core.web.page;
|
||||
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class PageDomain {
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
|
@ -48,25 +56,7 @@ public class PageDomain {
|
|||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize () {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize (Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getOrderByColumn () {
|
||||
return orderByColumn;
|
||||
}
|
||||
|
||||
public void setOrderByColumn (String orderByColumn) {
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc () {
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc (String isAsc) {
|
||||
if (StringUtils.isNotEmpty(isAsc)) {
|
||||
|
@ -87,7 +77,4 @@ public class PageDomain {
|
|||
return reasonable;
|
||||
}
|
||||
|
||||
public void setReasonable (Boolean reasonable) {
|
||||
this.reasonable = reasonable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project 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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 系统公共核心包 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,100 @@
|
|||
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 com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* 拼团信息表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "activity_team_info",autoResultMap = true)
|
||||
public class ActivityTeamInfo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private long productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private String imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private long sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private long strategyId;
|
||||
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*/
|
||||
public static ActivityTeamInfo saveActivityTeamInfo(ActivityTeamInfoSaveModel activityTeamInfoSaveModel) {
|
||||
return ActivityTeamInfo.builder()
|
||||
.name(activityTeamInfoSaveModel.getName())
|
||||
.productId(activityTeamInfoSaveModel.getProductId())
|
||||
.productImage(activityTeamInfoSaveModel.getProductImage())
|
||||
.introduction(activityTeamInfoSaveModel.getIntroduction())
|
||||
.unit(activityTeamInfoSaveModel.getUnit())
|
||||
.imageList(activityTeamInfoSaveModel.getProductImage())
|
||||
.endTime((Date) activityTeamInfoSaveModel.getEndTime())
|
||||
.sort(activityTeamInfoSaveModel.getSort())
|
||||
.content(activityTeamInfoSaveModel.getContent())
|
||||
.status(activityTeamInfoSaveModel.getStatus())
|
||||
.strategyType(activityTeamInfoSaveModel.getStrategyType())
|
||||
.strategyId(activityTeamInfoSaveModel.getStrategyId())
|
||||
.build();
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "activity_team_open_info",autoResultMap = true)
|
||||
public class ActivityTeamOpenInfo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 团购活动ID
|
||||
*/
|
||||
private Long teamId;
|
||||
/**
|
||||
* 团购类型
|
||||
*/
|
||||
private String teamType;
|
||||
/**
|
||||
* 团购策略
|
||||
*/
|
||||
private String teamStrategyId;
|
||||
/**
|
||||
* 参团类型
|
||||
*/
|
||||
private String executiveType;
|
||||
/**
|
||||
* 结束团购时间
|
||||
*/
|
||||
private Timestamp endTime;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String productId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 开团标识
|
||||
*/
|
||||
private String key;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 开团状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
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 com.muyu.marketing.domain.model.TeamSkuInfoModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "activity_team_product_sku_info",autoResultMap = true)
|
||||
public class ActivityTeamProductSkuInfo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private Long teamId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 构造函数的方法
|
||||
* TeamSkuInfoModel 商品sku模型
|
||||
*/
|
||||
public static ActivityTeamProductSkuInfo TeamSkuInfoBuild(TeamSkuInfoModel teamSkuInfoModel, Function<ActivityTeamProductSkuInfoBuilder,ActivityTeamProductSkuInfo> function){
|
||||
return function.apply(ActivityTeamProductSkuInfo.builder()
|
||||
.teamPrice(teamSkuInfoModel.getTeamPrice())
|
||||
.teamStock(teamSkuInfoModel.getTeamStock())
|
||||
.productSku(teamSkuInfoModel.getProductSku())
|
||||
.productId(teamSkuInfoModel.getProductId()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@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;
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@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;
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
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.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@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;
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamInfoListModel {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String productImage;
|
||||
private BigDecimal productPrice;
|
||||
private BigDecimal teamPrice;
|
||||
private Long attendNumber;
|
||||
private Long openTeamNumber;
|
||||
private Long addTeamNumber;
|
||||
private Long teamStock;
|
||||
private Long remainStock;
|
||||
private String endTime;
|
||||
private String status;
|
||||
|
||||
public static ActivityTeamInfoListModel domainBuild(ActivityTeamInfo activityTeamInfo, Function<ActivityTeamInfoListModelBuilder,ActivityTeamInfoListModel> function){
|
||||
return function.apply(
|
||||
ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.endTime(String.valueOf(activityTeamInfo.getEndTime()))
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 团购活动列表查询模型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @create: 2024-11-22 16:57
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class ActivityTeamInfoSaveModel {
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
* 商品单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 商品轮播图
|
||||
*/
|
||||
private List<String> imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 拼团类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 拼团id
|
||||
*/
|
||||
private Long strategyId;
|
||||
/**
|
||||
* 商品sku
|
||||
*/
|
||||
private List<TeamSkuInfoModel> projectSkuInfoList;
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class TeamProductDiscountPriceModel {
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
|
||||
/**
|
||||
* 团购优惠价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
|
||||
/**
|
||||
* 优惠力度
|
||||
*/
|
||||
private double discount;
|
||||
|
||||
/**
|
||||
* 通过商品价格 和团购价格 生成优惠力度
|
||||
*/
|
||||
public static TeamProductDiscountPriceModel of(BigDecimal productPrice,BigDecimal teamPrice){
|
||||
return TeamProductDiscountPriceModel.builder()
|
||||
.productPrice(productPrice)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(
|
||||
productPrice.subtract(teamPrice).divide(productPrice,2, RoundingMode.HALF_UP).doubleValue()
|
||||
)
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description: 商品sku模型
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TeamSkuInfoModel {
|
||||
private Long productId;
|
||||
private String productSku;
|
||||
private Long teamStock;
|
||||
private BigDecimal teamPrice;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.marketing.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: 商品库存模型
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class TeamStockModel {
|
||||
private Long teamStock;
|
||||
private Long remainStock;
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel;
|
||||
import com.muyu.marketing.domain.model.TeamSkuInfoModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 添加拼团活动入参
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class ActivityTeamInfoSaveReq {
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@NotNull(message = "商品id不能为空")
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
@NotNull(message = "商品照片不能为空")
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
@NotNull(message = "活动名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 活动简介
|
||||
*/
|
||||
@NotNull(message = "活动简介不能为空")
|
||||
private String introduction;
|
||||
/**
|
||||
* 商品单位
|
||||
*/
|
||||
@NotNull(message = "商品单位不能为空")
|
||||
private String unit;
|
||||
/**
|
||||
* 商品轮播图
|
||||
*/
|
||||
@NotNull(message = "商品轮播图不能为空")
|
||||
private List<String> imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@NotNull(message = "活动结束时间不能为空")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@NotNull(message = "详情不能为空")
|
||||
private String content;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
private String status;
|
||||
/**
|
||||
* 拼团类型
|
||||
*/
|
||||
@NotNull(message = "拼团类型不能为空")
|
||||
private String strategyType;
|
||||
/**
|
||||
* 拼团id
|
||||
*/
|
||||
@NotNull(message = "拼团id不能为空")
|
||||
private Long strategyId;
|
||||
/**
|
||||
* 商品sku
|
||||
*/
|
||||
@NotNull(message = "商品sku不能为空")
|
||||
private List<TeamSkuInfoModel> projectSkuInfoList;
|
||||
|
||||
/**
|
||||
*构造方法
|
||||
*/
|
||||
public ActivityTeamInfoSaveModel saveModel(){
|
||||
return ActivityTeamInfoSaveModel.builder()
|
||||
.productId(productId)
|
||||
.productImage(productImage)
|
||||
.name(name)
|
||||
.introduction(introduction)
|
||||
.unit(unit)
|
||||
.imageList(imageList)
|
||||
.endTime(endTime)
|
||||
.sort(sort)
|
||||
.content(content)
|
||||
.status(status)
|
||||
.strategyType(strategyType)
|
||||
.strategyId(strategyId)
|
||||
.projectSkuInfoList(projectSkuInfoList)
|
||||
// .content(content)
|
||||
// .strategyType(strategyType)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.marketing.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamInfoListReq extends PageDomain {
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=2;
|
||||
|
||||
/**
|
||||
* 通过当前对象查询构建模型
|
||||
*/
|
||||
public ActivityTeamInfoListQueryModel buildModel() {
|
||||
return ActivityTeamInfoListQueryModel.builder()
|
||||
.keyWord(keyWord)
|
||||
.status(status)
|
||||
.pageNum(pageNum)
|
||||
.pageSize(pageSize)
|
||||
.build()
|
||||
.domainbuild(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.muyu.marketing.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TeamInfoResp {
|
||||
|
||||
/**
|
||||
* 拼团活动ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
|
||||
public static TeamInfoResp respBuild(ActivityTeamInfoListModel activityTeamInfoListModel){
|
||||
return TeamInfoResp.builder()
|
||||
.id(activityTeamInfoListModel.getId())
|
||||
.name(activityTeamInfoListModel.getName())
|
||||
.endTime(activityTeamInfoListModel.getEndTime())
|
||||
.productImage(activityTeamInfoListModel.getProductImage())
|
||||
.status(activityTeamInfoListModel.getStatus())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.attendNumber(activityTeamInfoListModel.getAttendNumber())
|
||||
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
|
||||
.productPrice(activityTeamInfoListModel.getProductPrice())
|
||||
.remainStock(activityTeamInfoListModel.getRemainStock())
|
||||
.teamPrice(activityTeamInfoListModel.getTeamPrice())
|
||||
.teamStock(activityTeamInfoListModel.getTeamStock())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project 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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>marketing-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>marketing-server</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</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>muyu-product-cache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.marketing;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 营销模块
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuMarketIngApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuMarketIngApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.marketing.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.PageUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoResp;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/team")
|
||||
@Slf4j
|
||||
//@EnableMyFeignClients(basePackages = "com.muyu")
|
||||
public class ActivityTeamController {
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
/**
|
||||
* 检查404
|
||||
*/
|
||||
public ActivityTeamController() {
|
||||
log.info("商品拼团控制层{}",getClass().getName());
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@PostMapping("list")
|
||||
public Result<TableDataInfo<TeamInfoResp>> list(@RequestBody TeamInfoListReq teamInfoListReq){
|
||||
//分页
|
||||
Page<ActivityTeamInfoListModel> page = PageUtils.startPage(teamInfoListReq.getPageNum(), teamInfoListReq.getPageSize());
|
||||
List<ActivityTeamInfoListModel> rows = activityTeamInfoService.list(teamInfoListReq.buildModel()).getRows();
|
||||
//将数据模型转换为响应模型 利用Stream流把数据转换为响应列表
|
||||
List<TeamInfoResp> activityTeamInfoResps = rows.stream().map(activityTeamInfoListModel -> {
|
||||
return TeamInfoResp.respBuild(activityTeamInfoListModel);
|
||||
}).toList();
|
||||
//创建分页信息对象
|
||||
TableDataInfo<TeamInfoResp> teamInfoRespTableDataInfo = new TableDataInfo<>();
|
||||
teamInfoRespTableDataInfo.setRows(activityTeamInfoResps);
|
||||
teamInfoRespTableDataInfo.setTotal(page.getTotal());
|
||||
return Result.success(teamInfoRespTableDataInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加拼团活动
|
||||
*/
|
||||
@PostMapping("addTeam")
|
||||
public Result addTeam(@Validated @RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq){
|
||||
//判断是否添加成功
|
||||
boolean success = activityTeamInfoService.addTeam(activityTeamInfoSaveReq.saveModel());
|
||||
if (success){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.error("添加失败");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
void add(ActivityTeamInfo activityTeamInfo);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
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> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
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> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.marketing.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper<TeamStrategyExemptionOrdinary> {
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
/**
|
||||
* 通过查询模型查询团购活动列表
|
||||
*/
|
||||
TableDataInfo<ActivityTeamInfoListModel> list(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
|
||||
/**
|
||||
* 添加拼团信息
|
||||
*/
|
||||
boolean addTeam(ActivityTeamInfoSaveModel activityTeamInfoSaveModel);
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
|
||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
|
||||
/**
|
||||
* 开团类型
|
||||
* 开团数量
|
||||
*/
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType);
|
||||
|
||||
/**
|
||||
* 根据活动ID获取开团数量
|
||||
*/
|
||||
public default Long getTeamOpenTypeNumberByTeamId(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnum.OPEN_TEAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动ID获取参团数量
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public default Long getTeamTypeNumberByTeamId(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnum.IN_TEAM);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamStockModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||
/**
|
||||
* 根据团购活动ID获取团购中最优惠的价格
|
||||
*/
|
||||
public default List<ActivityTeamProductSkuInfo> acivitySkuList (Long id){
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,id);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
public TeamProductDiscountPriceModel discountPrice(Long teamId);
|
||||
public TeamStockModel getStock(Long id);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
|
||||
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
|
||||
public interface TeamStrategyExemptionOrdinaryService extends IService<TeamStrategyExemptionOrdinary> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
|
||||
public interface TeamStrategyExemptionService extends IService<TeamStrategyExemption> {
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo>
|
||||
implements ActivityTeamInfoService {
|
||||
@Autowired
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> list(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(
|
||||
activityTeamInfoListQueryModel.getKeyWord()),
|
||||
ActivityTeamInfo::getName,
|
||||
activityTeamInfoListQueryModel.getKeyWord()
|
||||
);
|
||||
queryWrapper.like(StringUtils.isNotEmpty(activityTeamInfoListQueryModel.getStatus()),
|
||||
ActivityTeamInfo::getStatus,
|
||||
activityTeamInfoListQueryModel.getStatus()
|
||||
);
|
||||
Page<ActivityTeamInfo> pages = this.page(activityTeamInfoListQueryModel.bulidPage(), queryWrapper);
|
||||
List<ActivityTeamInfo> records = pages.getRecords();
|
||||
List<ActivityTeamInfoListModel> list = records.stream().map(activityTeamInfo -> ActivityTeamInfoListModel
|
||||
.domainBuild(activityTeamInfo, (activityTeamInfoListModelBuilder -> {
|
||||
Long teamOpenNum = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId());
|
||||
Long teamInNum = activityTeamOpenInfoService.getTeamOpenTypeNumberByTeamId(activityTeamInfo.getId());
|
||||
TeamProductDiscountPriceModel discountPriceModel = activityTeamProductSkuInfoService.discountPrice(activityTeamInfo.getId());
|
||||
TeamStockModel stock = activityTeamProductSkuInfoService.getStock(activityTeamInfo.getId());
|
||||
return activityTeamInfoListModelBuilder
|
||||
.addTeamNumber(teamInNum)
|
||||
.openTeamNumber(teamInNum)
|
||||
.attendNumber(teamOpenNum + teamInNum)
|
||||
.teamPrice(discountPriceModel.getProductPrice())
|
||||
.teamStock(stock.getTeamStock())
|
||||
.remainStock(stock.getRemainStock())
|
||||
.build();
|
||||
}))).toList();
|
||||
return TableDataInfo.<ActivityTeamInfoListModel>builder()
|
||||
.total(pages.getTotal())
|
||||
.rows(list)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加拼团信息
|
||||
*/
|
||||
@Override
|
||||
public boolean addTeam(ActivityTeamInfoSaveModel activityTeamInfoSaveModel) {
|
||||
//调用拼团信息表的构造方法 添加
|
||||
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.saveActivityTeamInfo(activityTeamInfoSaveModel);
|
||||
//调用添加方法
|
||||
boolean save = this.save(activityTeamInfo);
|
||||
//判断添加的时候,添加规格sku列表的数据 调用集合
|
||||
if (save){
|
||||
List<TeamSkuInfoModel> projectSkuInfoList = activityTeamInfoSaveModel.getProjectSkuInfoList();
|
||||
//利用steam流遍历集合,把集合中的数据进行转换,转换成对象 进行批量添加
|
||||
// 批量添加方法
|
||||
activityTeamProductSkuInfoService.saveBatch(projectSkuInfoList.stream().map(projuctSkuInfo -> ActivityTeamProductSkuInfo.TeamSkuInfoBuild(projuctSkuInfo, (activityTeamProductSkuInfoBuilder -> {
|
||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,activityTeamInfo.getId());
|
||||
long count = activityTeamOpenInfoService.count(queryWrapper);
|
||||
return activityTeamProductSkuInfoBuilder
|
||||
//商品表的ID
|
||||
.teamId(activityTeamInfo.getId())
|
||||
//sku的剩余库存
|
||||
.teamStock(projuctSkuInfo.getTeamStock() - count)
|
||||
.build();
|
||||
}))).toList());
|
||||
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamOpenInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper,ActivityTeamOpenInfo>
|
||||
implements ActivityTeamOpenInfoService {
|
||||
@Override
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
|
||||
return null;
|
||||
}
|
||||
// @Autowired
|
||||
// private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
// /**
|
||||
// * 通过活动ID和开团类型查询开团数量
|
||||
// */
|
||||
// @Override
|
||||
// public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnum teamOpenType) {
|
||||
// LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper =new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,teamId);
|
||||
// queryWrapper.eq(ActivityTeamOpenInfo::getTeamType,teamOpenType.code());
|
||||
// return this.count(queryWrapper);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.TeamProductDiscountPriceModel;
|
||||
import com.muyu.marketing.domain.model.TeamStockModel;
|
||||
import com.muyu.marketing.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamProductSkuInfoService;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo>
|
||||
implements ActivityTeamProductSkuInfoService {
|
||||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
@Override
|
||||
public TeamProductDiscountPriceModel discountPrice(Long teamId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamStockModel getStock(Long id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public TeamProductDiscountPriceModel getDiscountPrice(Long teamId) {
|
||||
// LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId,teamId);
|
||||
// List<ActivityTeamProductSkuInfo> teamProductSkuInfoList = this.list(queryWrapper);
|
||||
// //优惠模型集合
|
||||
// Optional<TeamProductDiscountPriceModel> discountPriceModelOptional = teamProductSkuInfoList.stream()
|
||||
// .map(activityTeamProductSkuInfo -> {
|
||||
// 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());
|
||||
//
|
||||
//
|
||||
// if (discountPriceModelOptional.isEmpty()){
|
||||
// throw new ServiceException("团购活动下没有商品绑定");
|
||||
// }
|
||||
// return discountPriceModelOptional.get();
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.mapper.TeamStrategyExemptionHundredMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionHundredService;
|
||||
|
||||
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred>
|
||||
implements TeamStrategyExemptionHundredService {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemptionOrdinary;
|
||||
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.mapper.TeamStrategyExemptionOrdinaryMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionOrdinaryService;
|
||||
|
||||
public class TeamStrategyExemptionOrdinaryImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary>
|
||||
implements TeamStrategyExemptionOrdinaryService {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.marketing.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.TeamStrategyExemption;
|
||||
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.mapper.TeamStrategyExemptionMapper;
|
||||
import com.muyu.marketing.service.ActivityTeamInfoService;
|
||||
import com.muyu.marketing.service.TeamStrategyExemptionService;
|
||||
|
||||
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption>
|
||||
implements TeamStrategyExemptionService {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,32 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9209
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-marketing
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 60.204.152.212:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 60.204.152.212:8848
|
||||
namespace: 634ec632-b03a-48b8-bc95-02b8bdc61e28
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.marketing.mapper: DEBUG
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-system"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,15 @@
|
|||
<?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.ActivityTeamInfoMapper">
|
||||
<insert id="add">
|
||||
INSERT INTO `activity_team_info` (`name`, `product_id`, `product_image`, `introduction`, `unit`, `image_list`, `end_time`, `sort`, `content`, `status`, `strategy_type`, `strategy_id`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`)
|
||||
VALUES (#{name}, #{productId}, #{productImage},#{introduction}, #{unit}, #{imageList}, #{endTime}, #{sort}, #{content}, #{status}, #{strategyType}, #{strategyId}, #{remark}, #{createBy}, now(), #{updateBy}, now())
|
||||
|
||||
</insert>
|
||||
|
||||
<select id="list" resultType="com.muyu.marketing.domain.ActivityTeamInfo">
|
||||
select * from activity_team_info
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,68 @@
|
|||
package com.forest;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.muyu.common.system.domain.SysDistrict;
|
||||
import com.muyu.system.MuYuSystemApplication;
|
||||
import com.muyu.system.forest.gaode.api.GaoDeBaseApi;
|
||||
import com.muyu.system.forest.gaode.api.resp.District;
|
||||
import com.muyu.system.forest.gaode.api.resp.DistrictResult;
|
||||
import com.muyu.system.service.SysDistrictService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 测试
|
||||
* @Date 2024/4/11 上午10:38
|
||||
*/
|
||||
@SpringBootTest(classes = MuYuSystemApplication.class)
|
||||
public class FoRestTest {
|
||||
|
||||
@Resource
|
||||
private GaoDeBaseApi gaoDeBaseApi;
|
||||
|
||||
@Autowired
|
||||
private SysDistrictService sysDistrictService;
|
||||
|
||||
@Test
|
||||
public void district(){
|
||||
DistrictResult districtResult = gaoDeBaseApi.district("广东省","3");
|
||||
List<District> districtList = districtResult.getDistricts();
|
||||
if (districtList.size() == 1 && "中华人民共和国".equals(districtList.get(0).getName())){
|
||||
districtList = districtList.get(0).getDistricts();
|
||||
}
|
||||
conversion(0L, districtList);
|
||||
}
|
||||
|
||||
|
||||
public void conversion(Long parentId, List<District> districtList){
|
||||
if (districtList == null || districtList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
for (District district : districtList) {
|
||||
SysDistrict sysDistrict = SysDistrict.builder()
|
||||
.parentId(parentId)
|
||||
.level(district.getLevel())
|
||||
.code("[]".equals(district.getCode()) ? "-" : district.getCode())
|
||||
.name(district.getName())
|
||||
.center(district.getCenter())
|
||||
.areaCode(district.getAreaCode())
|
||||
.build();
|
||||
sysDistrictService.save(sysDistrict);
|
||||
conversion(sysDistrict.getId(), district.getDistricts());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void weather(){
|
||||
String test = gaoDeBaseApi.weather("310120");
|
||||
System.out.println(test);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>marketing-common</module>
|
||||
<module>marketing-remote</module>
|
||||
<module>marketing-server</module>
|
||||
</modules>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>
|
||||
muyu-marketing营销模块
|
||||
</description>
|
||||
|
||||
|
||||
</project>
|
|
@ -15,6 +15,8 @@
|
|||
<module>muyu-file</module>
|
||||
<module>muyu-product</module>
|
||||
<module>muyu-shop-cart</module>
|
||||
<module>muyu-marketing</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -262,7 +262,19 @@
|
|||
<artifactId>muyu-shop-cart-cache</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
<!--营销服务 公共模块-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>marketing-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--营销服务 远调模块-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>marketing-remote</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue