feat():添加
parent
cb4f6a7f32
commit
80b3a5eef8
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"team": {
|
||||
"商品Id":"Long",
|
||||
"商品图片":"String",
|
||||
"拼团活动名称":"String",
|
||||
"拼团活动简介":"String",
|
||||
"商品单位":"String",
|
||||
"商品轮播图":[
|
||||
"图片路径":"String",
|
||||
],
|
||||
"活动时间":"Date",
|
||||
"策略类型":"String",
|
||||
"策略ID":"Long",
|
||||
"规格":[{
|
||||
规格SKU:"String",
|
||||
"拼团价格":"BigDecimal",
|
||||
"拼团库存":"Long"
|
||||
}],
|
||||
"排序":"Integer",
|
||||
"商品详情":"text"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.common.core.enums;
|
||||
|
||||
/**
|
||||
* @program: cloud-server
|
||||
* @description: 参团类型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-21 15:12
|
||||
**/
|
||||
|
||||
public enum TeamOpenTypeEnums {
|
||||
|
||||
|
||||
OPEN_TEAM("open_team","开团"),
|
||||
IN_TEAM("in_team","参团");
|
||||
private final String code;
|
||||
|
||||
private final String label;
|
||||
|
||||
public String code() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String label() {
|
||||
return label;
|
||||
}
|
||||
|
||||
TeamOpenTypeEnums(String code, String label) {
|
||||
this.code = code;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @program: cloud-server
|
||||
* @description: 列表查询模型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:27
|
||||
**/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class QueryModel<T> {
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
private String orderByColumn;
|
||||
|
||||
/**
|
||||
* 排序的方向desc或者asc
|
||||
*/
|
||||
private Boolean isAsc = true;
|
||||
|
||||
/**
|
||||
* 构建模型分页对象
|
||||
* @param pageDomain 分页参数
|
||||
* @return 返回模型分页参数
|
||||
*/
|
||||
public T domainBuild(PageDomain pageDomain){
|
||||
this.pageNum = pageDomain.getPageNum();
|
||||
this.pageSize = pageDomain.getPageSize();
|
||||
this.orderByColumn = pageDomain.getOrderByColumn();
|
||||
this.isAsc = "ase".equals(pageDomain.getIsAsc());
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询分页对象
|
||||
* @return 查询分页对象
|
||||
*/
|
||||
public <I> Page<I> bulidPage(){
|
||||
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,19 @@
|
|||
package com.muyu.common.core.web.page;
|
||||
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageDomain {
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
|
@ -40,30 +47,6 @@ public class PageDomain {
|
|||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||
}
|
||||
|
||||
public Integer getPageNum () {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum (Integer pageNum) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.muyu.common.core.web.page;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
package com.muyu.common.security.config.mybatisplus;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体类字段填充
|
||||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
public MyMetaObjectHandler () {
|
||||
log.info("mybatis-plus 系统字段填充拦截器 初始化成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("createBy", SecurityUtils.getUsername(), metaObject);
|
||||
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
|
||||
this.setFieldValByName("updateTime", new Date(),metaObject);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.common.security.config.mybatisplus;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 添加分页插件
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||
import com.muyu.domain.resp.ActivityTeamInfoResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityTeaminfo
|
||||
* @Date:2024.11.19 09:25
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamInfo extends Wrapper<ActivityTeamInfo> {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Integer productId;
|
||||
/**
|
||||
* 商品活动图
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 活动介绍
|
||||
*/
|
||||
private Text introduction;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
private Text imageList;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 活动排序
|
||||
*/
|
||||
private String sort;
|
||||
/**
|
||||
* 活动详情
|
||||
*/
|
||||
private Text content;
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
private Integer strategyId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static ActivityTeamInfo queryBuild(ActivityTeamInfoResp activityTeamInfoResp){
|
||||
return ActivityTeamInfo.builder()
|
||||
.name(activityTeamInfoResp.getName())
|
||||
.status(activityTeamInfoResp.getStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ActivityTeamInfo getEntity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MergeSegments getExpression() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSqlSegment() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.domain.resp
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityTeamInfoResp
|
||||
* @Date:2024.11.19 10:00
|
||||
*/
|
||||
|
||||
/**
|
||||
* 商品拼团信息表对象 activity_team_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-19
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "ActivityTeamInfoQueryReq", description = "商品拼团信息表")
|
||||
public class ActivityTeamInfoResp extends ActivityTeamInfo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.resp.ActivityTeamInfoResp;
|
||||
import com.muyu.service.ActivityService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.naming.ldap.PagedResultsControl;
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.controller
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityController
|
||||
* @Date:2024.11.19 09:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/activity")
|
||||
public class ActivityController {
|
||||
@Autowired
|
||||
private ActivityService activityService;
|
||||
|
||||
/**
|
||||
* 查询商品拼团信息表列表
|
||||
*/
|
||||
@ApiOperation("获取商品拼团信息表列表")
|
||||
@RequiresPermissions("activity:activity:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<ActivityTeamInfo>> list(ActivityTeamInfoResp activityTeamInfoResp) {
|
||||
startPage();
|
||||
List<ActivityTeamInfo> list = activityService.list(ActivityTeamInfo.queryBuild(activityTeamInfoResp));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private Result<TableDataInfo<ActivityTeamInfo>> getDataTable(List<ActivityTeamInfo> list) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.mapper
|
||||
* @Project:cloud-server
|
||||
* @name:Activity
|
||||
* @Date:2024.11.19 09:34
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActivityMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.resp.ActivityTeamInfoResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.service
|
||||
* @Project:cloud-server
|
||||
* @name:ActivityService
|
||||
* @Date:2024.11.19 09:38
|
||||
*/
|
||||
public interface ActivityService extends IService<ActivityTeamInfo> {
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.mapper.ActivityMapper;
|
||||
import com.muyu.service.ActivityService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
*@Author:cuifubo
|
||||
*@Package:com.muyu.service.impl
|
||||
*@Project:cloud-server
|
||||
*@name:ActivityServiceImpl
|
||||
*@Date:2024.11.19 09:44
|
||||
*/
|
||||
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, ActivityTeamInfo> implements ActivityService {
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?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.mapper.ActivityMapper">
|
||||
<resultMap type="com.muyu.domain.ActivityTeamInfo" id="ActivityTeamInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productImage" column="product_image" />
|
||||
<result property="introduction" column="introduction" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="imageList" column="image_list" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="content" column="content" />
|
||||
<result property="status" column="status" />
|
||||
<result property="strategyType" column="strategy_type" />
|
||||
<result property="strategyId" column="strategy_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectActivityTeamInfoVo">
|
||||
select id, 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 from activity_team_info
|
||||
</sql>
|
||||
</mapper>
|
|
@ -5,18 +5,17 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-activity</artifactId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-activity-common</artifactId>
|
||||
<artifactId>muyu-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>
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import com.muyu.domain.req.ActivitInfoSkuAddReq;
|
||||
import com.muyu.domain.req.ActivityInfoAddReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拼团规格添加模板
|
||||
*
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-22 20:37
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivitySkuModel {
|
||||
|
||||
List<ActivitInfoSkuAddReq> activityInfoAdd;
|
||||
|
||||
public static ActivitySkuModel activitySkuModel(ActivityInfoAddReq req){
|
||||
return ActivitySkuModel.builder()
|
||||
.activityInfoAdd(req.getSkuList())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.req.ActivityInfoAddReq;
|
||||
import lombok.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Null;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团购活动添加模型
|
||||
*
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-22 16:48
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamInfoAddModel {
|
||||
/**
|
||||
*商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
*活动名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
*活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
*商品单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
*商品的轮番图
|
||||
*/
|
||||
private String imagesList;
|
||||
/**
|
||||
*活动时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
*策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
*策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
/**
|
||||
*排序
|
||||
*/
|
||||
private long sort;
|
||||
/**
|
||||
*详情
|
||||
*/
|
||||
private String content;
|
||||
|
||||
public static ActivityTeamInfoAddModel activityTeamInfoAddModel (ActivityInfoAddReq req){
|
||||
return ActivityTeamInfoAddModel.builder()
|
||||
.productImage(req.getProductImage())
|
||||
.name(req.getName())
|
||||
.introduction(req.getIntroduction())
|
||||
.unit(req.getUnit())
|
||||
.imagesList(req.getImagesList())
|
||||
.endTime(req.getEndTime())
|
||||
.strategyType(req.getStrategyType())
|
||||
.strategyId(req.getStrategyId())
|
||||
.sort(req.getSort())
|
||||
.content(req.getContent())
|
||||
.build();
|
||||
}
|
||||
|
||||
public ActivityTeamInfo activityTeamInfoAdd(){
|
||||
return ActivityTeamInfo.builder()
|
||||
.productImage(this.getProductImage())
|
||||
.name(this.getName())
|
||||
.introduction(this.getIntroduction())
|
||||
.unit(this.getUnit())
|
||||
.imageList(this.getImagesList())
|
||||
.endTime(this.getEndTime())
|
||||
.strategyType(this.getStrategyType())
|
||||
.strategyId(this.getStrategyId())
|
||||
.sort(this.getSort())
|
||||
.content(this.getContent())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* 团购活动列表查询结果模型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 19:59
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityTeamInfoListModel {
|
||||
|
||||
/**
|
||||
* ID 编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
public static ActivityTeamInfoListModel infoBuild(ActivityTeamInfo activityTeamInfo, Function<ActivityTeamInfoListModel.ActivityTeamInfoListModelBuilder , ActivityTeamInfoListModel> function){
|
||||
return function.apply(
|
||||
ActivityTeamInfoListModel.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.endTime(activityTeamInfo.getEndTime())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.status(activityTeamInfo.getStatus())
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.model.QueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 团购活动列表查询模型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:05
|
||||
**/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActivityTeamInfoListQueryModel extends QueryModel<ActivityTeamInfoListQueryModel> {
|
||||
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
private String keyWord;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 团购活动价格模型
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-21 16:07
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TeamDiscountPriceModel {
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 优惠力度
|
||||
*/
|
||||
private Double discount;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @param teamPrice
|
||||
* @return
|
||||
*/
|
||||
public static TeamDiscountPriceModel of(BigDecimal price, BigDecimal teamPrice){
|
||||
return TeamDiscountPriceModel.builder()
|
||||
.productPrice(price)
|
||||
.teamPrice(teamPrice)
|
||||
.discount(price.subtract(teamPrice).divide(price,2, RoundingMode.HALF_EVEN).doubleValue())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 商品库存
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-21 16:54
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TeamProductStockModel {
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品Sku
|
||||
*
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-23 01:18
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
public class ActivitInfoSkuAddReq {
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 拼团库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.muyu.domain.model.ActivitySkuModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoAddModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拼团活动添加
|
||||
*
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-22 20:48
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActivityInfoAddReq {
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
*商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
*活动名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
*活动简介
|
||||
*/
|
||||
private String introduction;
|
||||
/**
|
||||
*商品单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
*商品的轮番图
|
||||
*/
|
||||
private String imagesList;
|
||||
/**
|
||||
*活动时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
*策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
/**
|
||||
*策略ID
|
||||
*/
|
||||
private Long strategyId;
|
||||
/**
|
||||
*排序
|
||||
*/
|
||||
private long sort;
|
||||
/**
|
||||
*详情
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private List<ActivitInfoSkuAddReq> skuList;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import com.muyu.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @Date:2024.11.20 19:49
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.page.PageDomain;
|
||||
import com.muyu.domain.model.ActivityTeamInfoListModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*TeamInfoListResp
|
||||
* @Date:2024.11.20 19:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TeamInfoListResp {
|
||||
/**
|
||||
* ID编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 拼团名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 拼团商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 拼团价格
|
||||
*/
|
||||
private BigDecimal teamPrice;
|
||||
/**
|
||||
* 拼团人数
|
||||
*/
|
||||
private Long attendNumber;
|
||||
/**
|
||||
* 开团人数
|
||||
*/
|
||||
private Long openTeamNumber;
|
||||
/**
|
||||
* 参团人数
|
||||
*/
|
||||
private Long addTeamNumber;
|
||||
/**
|
||||
* 团购库存
|
||||
*/
|
||||
private Long teamStock;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 团购结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 团购状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public static TeamInfoListResp listModerBuild(ActivityTeamInfoListModel activityTeamInfoListModel){
|
||||
return TeamInfoListResp.builder()
|
||||
.id(activityTeamInfoListModel.getId())
|
||||
.name(activityTeamInfoListModel.getName())
|
||||
.productImage(activityTeamInfoListModel.getProductImage())
|
||||
.teamPrice(activityTeamInfoListModel.getTeamPrice())
|
||||
.attendNumber(activityTeamInfoListModel.getAttendNumber())
|
||||
.openTeamNumber(activityTeamInfoListModel.getOpenTeamNumber())
|
||||
.addTeamNumber(activityTeamInfoListModel.getAddTeamNumber())
|
||||
.teamStock(activityTeamInfoListModel.getTeamStock())
|
||||
.remainStock(activityTeamInfoListModel.getRemainStock())
|
||||
.endTime(activityTeamInfoListModel.getEndTime())
|
||||
.status(activityTeamInfoListModel.getStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,11 +5,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-activity</artifactId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-activity-remote</artifactId>
|
||||
<artifactId>muyu-marketing-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
@ -17,12 +17,4 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-activity-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -5,11 +5,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-activity</artifactId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-activity-server</artifactId>
|
||||
<artifactId>muyu-marketing-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
@ -17,6 +17,16 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-marketing-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
@ -48,24 +58,24 @@
|
|||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Quartz -->
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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>
|
||||
|
@ -77,12 +87,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-activity-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -109,4 +119,5 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.system.team;
|
||||
|
||||
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,67 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.model.ActivitySkuModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.domain.req.ActivityInfoAddReq;
|
||||
import com.muyu.domain.req.TeamInfoListReq;
|
||||
import com.muyu.domain.resp.TeamInfoListResp;
|
||||
import com.muyu.system.team.service.ActivityTeamInfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品拼团信息
|
||||
* @program: cloud-server
|
||||
* @description: 商品拼团信息
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:49
|
||||
**/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/team")
|
||||
public class ActivityTeamInfoController {
|
||||
|
||||
@Resource
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
/**
|
||||
* 团购活动列表查询
|
||||
* @param teamInfoListReq 分页
|
||||
* @return 列表数据
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public Result<TableDataInfo<TeamInfoListResp>> list(@RequestBody TeamInfoListReq teamInfoListReq){
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = activityTeamInfoService.query(teamInfoListReq.buildQueryModel());
|
||||
List<TeamInfoListResp> listResp = tableDataInfo.getRows().stream().map(TeamInfoListResp::listModerBuild).toList();
|
||||
return Result.success(
|
||||
new TableDataInfo<>(){{
|
||||
setRows(listResp);
|
||||
setTotal(tableDataInfo.getTotal());
|
||||
}}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团活动添加
|
||||
* @param activityInfoAddReq 拼团活动
|
||||
* @return 拼团活动
|
||||
*/
|
||||
@RequiresPermissions("marketing:marketing:save")
|
||||
@PostMapping("/activityInfoAdd")
|
||||
public Result<ActivityTeamInfoAddModel> activityInfoAdd(@RequestBody ActivityInfoAddReq activityInfoAddReq){
|
||||
activityTeamInfoService.activityAndProductList(ActivityTeamInfoAddModel.activityTeamInfoAddModel(activityInfoAddReq)
|
||||
, ActivitySkuModel.activitySkuModel(activityInfoAddReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
/**
|
||||
* 团购活动执行表
|
||||
* @program: cloud-server
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:50
|
||||
**/
|
||||
|
||||
|
||||
public class ActivityTeamOpenInfoController {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
/**
|
||||
* 商品拼团规格信息表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:50
|
||||
**/
|
||||
|
||||
|
||||
public class ActivityTeamProductSkuInfoController {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
/**
|
||||
* 拼团免单策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:51
|
||||
**/
|
||||
|
||||
|
||||
public class TeamStrategyExemptionController {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
/**
|
||||
* 百人策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:51
|
||||
**/
|
||||
|
||||
|
||||
public class TeamStrategyExemptionHundredController {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.system.team.controller;
|
||||
|
||||
/**
|
||||
* 普通策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:51
|
||||
**/
|
||||
|
||||
|
||||
public class TeamStrategyExemptionOrdinaryController {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import net.minidev.json.writer.BeansMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
商品拼团信息
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:41
|
||||
**/
|
||||
@Mapper
|
||||
public interface ActivityTeamInfoMapper extends BaseMapper<ActivityTeamInfo> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.ActivityTeamOpenInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
团购活动执行表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:44
|
||||
**/
|
||||
|
||||
@Mapper
|
||||
public interface ActivityTeamOpenInfoMapper extends BaseMapper<ActivityTeamOpenInfo> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.ActivityTeamProductSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
商品拼团规格信息表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:45
|
||||
**/
|
||||
@Mapper
|
||||
public interface ActivityTeamProductSkuInfoMapper extends BaseMapper<ActivityTeamProductSkuInfo> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.TeamStrategyExemptionHundred;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
百人策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:47
|
||||
**/
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionHundredMapper extends BaseMapper<TeamStrategyExemptionHundred> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.TeamStrategyExemption;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
拼团免单策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:46
|
||||
**/
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionMapper extends BaseMapper<TeamStrategyExemption> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.TeamStrategyExemptionOrdinary;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 普通策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:48
|
||||
**/
|
||||
@Mapper
|
||||
public interface TeamStrategyExemptionOrdinaryMapper extends BaseMapper<TeamStrategyExemptionOrdinary> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.model.ActivitySkuModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.domain.model.ActivityTeamInfoListQueryModel;
|
||||
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
商品拼团信息
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:49
|
||||
**/
|
||||
public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||
/**
|
||||
* 通过查询模型查询团购活动列表
|
||||
* @param activityTeamInfoListQueryModel 团购活动查询模型
|
||||
* @return 团购活动列表
|
||||
*/
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel);
|
||||
|
||||
|
||||
void activityAndProductList(ActivityTeamInfoAddModel activityTeamInfoAddModel, ActivitySkuModel activitySkuModel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.enums.TeamOpenTypeEnums;
|
||||
import com.muyu.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.system.team.mapper.ActivityTeamOpenInfoMapper;
|
||||
|
||||
/**
|
||||
* 团购活动执行表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:49
|
||||
**/
|
||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
/**
|
||||
* 通过活动Id和开团类型查询开团数量
|
||||
* @param teamId 活动ID
|
||||
* @param teamOpenTypeEnums 开团类型
|
||||
* @return 开团数量
|
||||
*/
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnums teamOpenTypeEnums);
|
||||
|
||||
/**
|
||||
* 根据活动id查询开团数量
|
||||
* @param teamId 活动ID
|
||||
* @return 开团数量
|
||||
*/
|
||||
public default Long getTeamOpenTypeByOpenAndTypeTeam(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnums.OPEN_TEAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据活动Id查询参团数量
|
||||
* @param teamId 活动ID
|
||||
* @return 参团数量
|
||||
*/
|
||||
public default Long getTeamOpenTypeByInAndTypeTeam(Long teamId){
|
||||
return this.getTeamOpenNumberByTeamIdAndType(teamId,TeamOpenTypeEnums.IN_TEAM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.domain.model.TeamDiscountPriceModel;
|
||||
import com.muyu.domain.model.TeamProductStockModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品拼团规格信息表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 20:50
|
||||
**/
|
||||
public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeamProductSkuInfo> {
|
||||
|
||||
public default List<ActivityTeamProductSkuInfo> getActivityTeamProductSkuInfoByActivity(Long teamId) {
|
||||
LambdaQueryWrapper<ActivityTeamProductSkuInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamProductSkuInfo::getTeamId, teamId);
|
||||
return (this.list(queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过活动ID获取商品最优惠的价格
|
||||
* @param teamId 活动Id
|
||||
* @return 优惠价格
|
||||
*/
|
||||
public TeamDiscountPriceModel getDiscountPrice(Long teamId);
|
||||
|
||||
/**
|
||||
* 通过活动ID 获取剩余库存
|
||||
* @param teamId 活动Id
|
||||
* @return 剩余库存
|
||||
*/
|
||||
public TeamProductStockModel getProductStockModer(Long teamId);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.TeamStrategyExemptionHundred;
|
||||
|
||||
/**
|
||||
* 百人策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:38
|
||||
**/
|
||||
public interface TeamStrategyExemptionHundredService extends IService<TeamStrategyExemptionHundred> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.TeamStrategyExemptionOrdinary;
|
||||
|
||||
/**
|
||||
* 普通策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:39
|
||||
**/
|
||||
public interface TeamStrategyExemptionOrdinaryService extends IService<TeamStrategyExemptionOrdinary> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.system.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.TeamStrategyExemption;
|
||||
|
||||
/**
|
||||
* 拼团免单策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:38
|
||||
**/
|
||||
public interface TeamStrategyExemptionService extends IService<TeamStrategyExemption> {
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.muyu.system.team.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.domain.ActivityTeamInfo;
|
||||
import com.muyu.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.domain.model.*;
|
||||
import com.muyu.domain.req.ActivitInfoSkuAddReq;
|
||||
import com.muyu.system.team.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.system.team.service.ActivityTeamInfoService;
|
||||
import com.muyu.system.team.service.ActivityTeamOpenInfoService;
|
||||
import com.muyu.system.team.service.ActivityTeamProductSkuInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
商品拼团信息
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:39
|
||||
**/
|
||||
|
||||
@Service
|
||||
public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMapper, ActivityTeamInfo> implements ActivityTeamInfoService {
|
||||
@Resource
|
||||
private ActivityTeamOpenInfoService activityTeamOpenInfoService;
|
||||
@Resource
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
Page<ActivityTeamInfo> page = new Page<>();
|
||||
|
||||
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> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.bulidPage(), queryWrapper);
|
||||
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
||||
List<ActivityTeamInfoListModel> infoListModels = activityTeamInfoList.stream().map(
|
||||
activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
|
||||
(activityTeamInfoListModelBuilder) -> {
|
||||
TeamDiscountPriceModel discountPrice = activityTeamProductSkuInfoService.getDiscountPrice(activityTeamInfo.getId());
|
||||
TeamProductStockModel productStockModer = activityTeamProductSkuInfoService.getProductStockModer(activityTeamInfo.getId());
|
||||
Long teamOpenTypeByOpenTeam = activityTeamOpenInfoService.getTeamOpenTypeByOpenAndTypeTeam(activityTeamInfo.getId());
|
||||
Long teamOpenTypeByInTeam = activityTeamOpenInfoService.getTeamOpenTypeByInAndTypeTeam(activityTeamInfo.getId());
|
||||
return activityTeamInfoListModelBuilder
|
||||
.addTeamNumber(teamOpenTypeByInTeam)
|
||||
.openTeamNumber(teamOpenTypeByOpenTeam)
|
||||
.attendNumber(teamOpenTypeByInTeam + teamOpenTypeByOpenTeam)
|
||||
.teamPrice(discountPrice.getTeamPrice())
|
||||
.teamStock(productStockModer.getTeamStock())
|
||||
.remainStock(productStockModer.getRemainStock())
|
||||
.build();
|
||||
})).toList();
|
||||
TableDataInfo<ActivityTeamInfoListModel> tableDataInfo = new TableDataInfo<>();
|
||||
tableDataInfo.setTotal(activityTeamInfoPage.getTotal());
|
||||
tableDataInfo.setRows(infoListModels);
|
||||
return tableDataInfo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加拼团活动
|
||||
* @param activityTeamInfoAddModel 拼团活动列表
|
||||
* @param activitySkuModel 商品规格
|
||||
*/
|
||||
@Override
|
||||
public void activityAndProductList(ActivityTeamInfoAddModel activityTeamInfoAddModel, ActivitySkuModel activitySkuModel) {
|
||||
//添加品谈活动列表、
|
||||
ActivityTeamInfo activityTeamInfo = activityTeamInfoAddModel.activityTeamInfoAdd();
|
||||
this.save(activityTeamInfo);
|
||||
|
||||
//添加商品规格表
|
||||
List<ActivitInfoSkuAddReq> activitInfoSkuAdd = activitySkuModel.getActivityInfoAdd();
|
||||
ArrayList<ActivityTeamProductSkuInfo> skuModelsList = new ArrayList<>();
|
||||
|
||||
|
||||
ActivityTeamProductSkuInfo activityTeamProductSkuInfo = new ActivityTeamProductSkuInfo();
|
||||
activitInfoSkuAdd.stream().forEach(activityAndProductId ->{
|
||||
activityTeamProductSkuInfo.setTeamId(activityTeamInfo.getId());
|
||||
activityTeamProductSkuInfo.setProductSku(activityAndProductId.getProductSku());
|
||||
activityTeamProductSkuInfo.setTeamPrice(activityAndProductId.getTeamPrice());
|
||||
activityTeamProductSkuInfo.setTeamStock(activityAndProductId.getTeamStock());
|
||||
skuModelsList.add(activityTeamProductSkuInfo);
|
||||
});
|
||||
activityTeamProductSkuInfoService.saveBatch(skuModelsList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.system.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.enums.TeamOpenTypeEnums;
|
||||
import com.muyu.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
import com.muyu.system.team.mapper.ActivityTeamOpenInfoMapper;
|
||||
import com.muyu.system.team.service.ActivityTeamOpenInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
团购活动执行表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:40
|
||||
**/
|
||||
|
||||
@Service
|
||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo> implements ActivityTeamOpenInfoService {
|
||||
|
||||
|
||||
@Override
|
||||
public Long getTeamOpenNumberByTeamIdAndType(Long teamId, TeamOpenTypeEnums teamOpenTypeEnums) {
|
||||
LambdaQueryWrapper<ActivityTeamOpenInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamId,teamId);
|
||||
queryWrapper.eq(ActivityTeamOpenInfo::getTeamType,teamOpenTypeEnums.code());
|
||||
return count(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.system.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.domain.model.TeamDiscountPriceModel;
|
||||
import com.muyu.domain.model.TeamProductStockModel;
|
||||
import com.muyu.product.cache.ProjectSkuCache;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.system.team.mapper.ActivityTeamProductSkuInfoMapper;
|
||||
import com.muyu.system.team.service.ActivityTeamProductSkuInfoService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.rmi.server.ServerCloneException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
商品拼团规格信息表
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:41
|
||||
**/
|
||||
|
||||
|
||||
@Service
|
||||
public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityTeamProductSkuInfoMapper, ActivityTeamProductSkuInfo> implements ActivityTeamProductSkuInfoService {
|
||||
|
||||
@Resource
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public TeamDiscountPriceModel getDiscountPrice(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> productSkuInfoList = this.getActivityTeamProductSkuInfoByActivity(teamId);
|
||||
if(productSkuInfoList.size()>0){
|
||||
|
||||
|
||||
Optional<TeamDiscountPriceModel> discountPrice = productSkuInfoList.stream()
|
||||
.map(activityTeamProductSkuInfo -> {
|
||||
ProjectSkuInfo productPriceList = projectSkuCache.get(activityTeamProductSkuInfo.getProductId(), activityTeamProductSkuInfo.getProductSku());
|
||||
return TeamDiscountPriceModel.of(productPriceList.getPrice(), activityTeamProductSkuInfo.getTeamPrice());
|
||||
}).min((o1, o2) -> Double.valueOf(o1.getDiscount() * 100 - o2.getDiscount() * 100).intValue());
|
||||
if (discountPrice.isEmpty()) {
|
||||
throw new ServerCloneException("团购活动下没有商品绑定");
|
||||
}
|
||||
return discountPrice.get();
|
||||
}
|
||||
return TeamDiscountPriceModel.builder()
|
||||
.productPrice(BigDecimal.valueOf(0))
|
||||
.teamPrice(BigDecimal.valueOf(0))
|
||||
.discount(0.00)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProductStockModel getProductStockModer(Long teamId) {
|
||||
List<ActivityTeamProductSkuInfo> productSkuInfoList = this.getActivityTeamProductSkuInfoByActivity(teamId);
|
||||
return TeamProductStockModel.builder()
|
||||
.teamStock(productSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getTeamStock).reduce(0L,Long::sum))
|
||||
.remainStock(productSkuInfoList.stream().map(ActivityTeamProductSkuInfo::getProductStock).reduce(0L,Long::sum))
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.system.team.mapper.TeamStrategyExemptionHundredMapper;
|
||||
import com.muyu.system.team.service.TeamStrategyExemptionHundredService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
百人策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:44
|
||||
**/
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionHundredServiceImpl extends ServiceImpl<TeamStrategyExemptionHundredMapper, TeamStrategyExemptionHundred> implements TeamStrategyExemptionHundredService {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.system.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.TeamStrategyExemptionOrdinary;
|
||||
import com.muyu.system.team.mapper.TeamStrategyExemptionOrdinaryMapper;
|
||||
import com.muyu.system.team.service.TeamStrategyExemptionOrdinaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
普通策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:48
|
||||
**/
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionOrdinaryServiceImpl extends ServiceImpl<TeamStrategyExemptionOrdinaryMapper, TeamStrategyExemptionOrdinary> implements TeamStrategyExemptionOrdinaryService {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.system.team.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.TeamStrategyExemption;
|
||||
import com.muyu.domain.TeamStrategyExemptionHundred;
|
||||
import com.muyu.system.team.mapper.TeamStrategyExemptionHundredMapper;
|
||||
import com.muyu.system.team.mapper.TeamStrategyExemptionMapper;
|
||||
import com.muyu.system.team.service.TeamStrategyExemptionHundredService;
|
||||
import com.muyu.system.team.service.TeamStrategyExemptionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
拼团免单策略
|
||||
* @author: CuiFu Bo
|
||||
* @create: 2024-11-20 21:43
|
||||
**/
|
||||
|
||||
@Service
|
||||
public class TeamStrategyExemptionServiceImpl extends ServiceImpl<TeamStrategyExemptionMapper, TeamStrategyExemption> implements TeamStrategyExemptionService {
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9209
|
||||
port: 9219
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-activity
|
||||
name: muyu-marketing
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -23,3 +23,6 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-job"/>
|
||||
<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"/>
|
||||
|
|
@ -9,16 +9,17 @@
|
|||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-activity-common</module>
|
||||
<module>muyu-activity-remote</module>
|
||||
<module>muyu-activity-server</module>
|
||||
<module>muyu-marketing-common</module>
|
||||
<module>muyu-marketing-remote</module>
|
||||
<module>muyu-marketing-server</module>
|
||||
</modules>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>muyu-activity</artifactId>
|
||||
<artifactId>muyu-marketing</artifactId>
|
||||
|
||||
<description>
|
||||
muyu-activity 商品拼团信息任务
|
||||
muyu-modules-marketing营销模块
|
||||
</description>
|
||||
|
||||
|
||||
</project>
|
|
@ -14,8 +14,7 @@ import java.util.List;
|
|||
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 属性组添加模型
|
||||
* 属性组添加模型
|
||||
* @Date 2024-2-28 下午 03:16
|
||||
*/
|
||||
@Data
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:cuifubo
|
||||
* @Package:com.muyu.product.domain.resp
|
||||
* @Project:cloud-server
|
||||
* @name:ProjectInfoResp
|
||||
* @Date:2024.11.20 00:54
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProjectInfoResp {
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 商品名称 */
|
||||
@Excel(name = "商品名称")
|
||||
@ApiModelProperty(name = "商品名称", value = "商品名称")
|
||||
private String name;
|
||||
|
||||
/** 商品描述 */
|
||||
@Excel(name = "商品描述")
|
||||
@ApiModelProperty(name = "商品描述", value = "商品描述")
|
||||
private String introduction;
|
||||
|
||||
/** 主类型 */
|
||||
@Excel(name = "主类型")
|
||||
@ApiModelProperty(name = "主类型", value = "主类型")
|
||||
private Long mianType;
|
||||
|
||||
/** 父类型 */
|
||||
@Excel(name = "父类型")
|
||||
@ApiModelProperty(name = "父类型", value = "父类型")
|
||||
private Long parentType;
|
||||
|
||||
/** 商品类型 */
|
||||
@Excel(name = "商品类型")
|
||||
@ApiModelProperty(name = "商品类型", value = "商品类型")
|
||||
private Long type;
|
||||
|
||||
/** 商品图片 */
|
||||
@Excel(name = "商品图片")
|
||||
@ApiModelProperty(name = "商品图片", value = "商品图片")
|
||||
private String image;
|
||||
|
||||
/** 商品轮播图 */
|
||||
@Excel(name = "商品轮播图")
|
||||
@ApiModelProperty(name = "商品轮播图", value = "商品轮播图")
|
||||
private String carouselImages;
|
||||
|
||||
/** 商品状态 */
|
||||
@Excel(name = "商品状态")
|
||||
@ApiModelProperty(name = "商品状态", value = "商品状态")
|
||||
private String status;
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
@ApiModelProperty(name = "规格", value = "规格")
|
||||
private Long ruleId;
|
||||
|
||||
/** 品牌 */
|
||||
@Excel(name = "品牌")
|
||||
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 主类型名称
|
||||
*/
|
||||
private String mianTypeName;
|
||||
|
||||
/**
|
||||
* 父类型名称
|
||||
*/
|
||||
private String parentTypeName;
|
||||
/**
|
||||
* 商品类型名称
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 规格名称
|
||||
*/
|
||||
private String ruleName;
|
||||
/**
|
||||
* 品牌名称
|
||||
*/
|
||||
private String brandName;
|
||||
}
|
|
@ -90,6 +90,8 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -109,8 +109,8 @@ public class ProjectInfoController extends BaseController {
|
|||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增商品信息")
|
||||
public Result<String> add(@RequestBody ProjectInfoSaveReq projectInfoSaveReq) {
|
||||
return toAjax(projectInfoService.save(projectInfoSaveReq));
|
||||
public Result add(@RequestBody ProjectInfoSaveReq projectInfoSaveReq) {
|
||||
return Result.success(projectInfoSaveReq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,4 +135,6 @@ public class ProjectInfoController extends BaseController {
|
|||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(projectInfoService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.req.ProjectInfoSaveReq;
|
||||
|
@ -26,7 +28,7 @@ public interface ProjectInfoService extends IService<ProjectInfo> {
|
|||
* @param projectInfoSaveReq 请求对象
|
||||
* @return
|
||||
*/
|
||||
boolean save (ProjectInfoSaveReq projectInfoSaveReq);
|
||||
Result save (ProjectInfoSaveReq projectInfoSaveReq);
|
||||
|
||||
/**
|
||||
* 通过商品ID获取商品详情
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.service.impl;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.*;
|
||||
|
@ -100,11 +101,16 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
|||
|
||||
|
||||
|
||||
|
||||
this.getProjectList();
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
private List<String> getProjectList() {
|
||||
List<ProjectInfo> infos = this.list();
|
||||
List<String> stringList = infos.stream().map(ProjectInfo::getName).toList();
|
||||
return stringList;
|
||||
}
|
||||
/**
|
||||
* 保存商品信息
|
||||
*
|
||||
|
@ -113,7 +119,15 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean save (ProjectInfoSaveReq projectInfoSaveReq) {
|
||||
public Result save (ProjectInfoSaveReq projectInfoSaveReq) {
|
||||
|
||||
|
||||
List<String> projectList = getProjectList();
|
||||
if(projectList.contains(projectInfoSaveReq.getProjectAddModel().getName())){
|
||||
return Result.error("名称已存在不允许重复");
|
||||
}
|
||||
|
||||
|
||||
ProjectAddModel projectAddModel = projectInfoSaveReq.getProjectAddModel();
|
||||
ProjectInfo projectInfo = ProjectInfo.saveModelBuild(projectAddModel, SecurityUtils::getUsername);
|
||||
boolean save = this.save(projectInfo);
|
||||
|
@ -135,7 +149,7 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
|
|||
projectSkuInfoService.saveBatch(projectSkuInfoList);
|
||||
}
|
||||
}
|
||||
return save;
|
||||
return Result.success(save);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
<modules>
|
||||
<module>muyu-system</module>
|
||||
<module>muyu-marketing</module>
|
||||
<module>muyu-gen</module>
|
||||
<module>muyu-job</module>
|
||||
<module>muyu-activity</module>
|
||||
<module>muyu-file</module>
|
||||
<module>muyu-product</module>
|
||||
<module>muyu-shop-cart</module>
|
||||
|
|
Loading…
Reference in New Issue