商品品牌
parent
2d98f71aee
commit
e667f6e461
|
@ -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-group-buy</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-group-buy-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,109 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.product.domain.req.GroupBuyQueryReq;
|
||||
import com.muyu.product.domain.req.GroupBuySaveReq;
|
||||
import com.muyu.product.domain.req.GroupBuyEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 拼团对象 group_buy
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("group_buy")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "GroupBuy", description = "拼团")
|
||||
public class GroupBuy extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 外键,关联商品 */
|
||||
@Excel(name = "外键,关联商品")
|
||||
@ApiModelProperty(name = "外键,关联商品", value = "外键,关联商品")
|
||||
private Long projectId;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "开始时间", value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "结束时间", value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 最小成团人数 */
|
||||
@Excel(name = "最小成团人数")
|
||||
@ApiModelProperty(name = "最小成团人数", value = "最小成团人数")
|
||||
private String minMembers;
|
||||
|
||||
/** 活动状态 */
|
||||
@Excel(name = "活动状态")
|
||||
@ApiModelProperty(name = "活动状态", value = "活动状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static GroupBuy queryBuild( GroupBuyQueryReq groupBuyQueryReq){
|
||||
return GroupBuy.builder()
|
||||
.projectId(groupBuyQueryReq.getProjectId())
|
||||
.startTime(groupBuyQueryReq.getStartTime())
|
||||
.endTime(groupBuyQueryReq.getEndTime())
|
||||
.minMembers(groupBuyQueryReq.getMinMembers())
|
||||
.status(groupBuyQueryReq.getStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static GroupBuy saveBuild(GroupBuySaveReq groupBuySaveReq){
|
||||
return GroupBuy.builder()
|
||||
.projectId(groupBuySaveReq.getProjectId())
|
||||
.startTime(groupBuySaveReq.getStartTime())
|
||||
.endTime(groupBuySaveReq.getEndTime())
|
||||
.minMembers(groupBuySaveReq.getMinMembers())
|
||||
.status(groupBuySaveReq.getStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static GroupBuy editBuild(Long id, GroupBuyEditReq groupBuyEditReq){
|
||||
return GroupBuy.builder()
|
||||
.id(id)
|
||||
.projectId(groupBuyEditReq.getProjectId())
|
||||
.startTime(groupBuyEditReq.getStartTime())
|
||||
.endTime(groupBuyEditReq.getEndTime())
|
||||
.minMembers(groupBuyEditReq.getMinMembers())
|
||||
.status(groupBuyEditReq.getStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 拼团对象 group_buy
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupBuyEditReq", description = "拼团")
|
||||
public class GroupBuyEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 外键,关联商品 */
|
||||
@ApiModelProperty(name = "外键,关联商品", value = "外键,关联商品")
|
||||
private Long projectId;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "开始时间", value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "结束时间", value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 最小成团人数 */
|
||||
@ApiModelProperty(name = "最小成团人数", value = "最小成团人数")
|
||||
private String minMembers;
|
||||
|
||||
/** 活动状态 */
|
||||
@ApiModelProperty(name = "活动状态", value = "活动状态")
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 拼团对象 group_buy
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupBuyQueryReq", description = "拼团")
|
||||
public class GroupBuyQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 外键,关联商品 */
|
||||
@ApiModelProperty(name = "外键,关联商品", value = "外键,关联商品")
|
||||
private Long projectId;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "开始时间", value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "结束时间", value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 最小成团人数 */
|
||||
@ApiModelProperty(name = "最小成团人数", value = "最小成团人数")
|
||||
private String minMembers;
|
||||
|
||||
/** 活动状态 */
|
||||
@ApiModelProperty(name = "活动状态", value = "活动状态")
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 拼团对象 group_buy
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupBuySaveReq", description = "拼团")
|
||||
public class GroupBuySaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 外键,关联商品 */
|
||||
|
||||
@ApiModelProperty(name = "外键,关联商品", value = "外键,关联商品")
|
||||
private Long projectId;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "开始时间", value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "结束时间", value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 最小成团人数 */
|
||||
|
||||
@ApiModelProperty(name = "最小成团人数", value = "最小成团人数")
|
||||
private String minMembers;
|
||||
|
||||
/** 活动状态 */
|
||||
|
||||
@ApiModelProperty(name = "活动状态", value = "活动状态")
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -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-group-buy</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-group-buy-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>
|
||||
<!-- 商品模块 common 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.product.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.remote.factory.RemoteProjectInfoFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格远程调用业务层
|
||||
* @Date 2024-4-7 上午 10:58
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "remoteProjectInfoService",
|
||||
value = ServiceNameConstants.PRODUCT_SERVICE,
|
||||
fallbackFactory = RemoteProjectInfoFactory.class,
|
||||
path = "/info"
|
||||
)
|
||||
public interface RemoteProjectInfoService {
|
||||
/**
|
||||
* 获取商品信息详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) ;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.product.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.remote.factory.RemoteProjectSkuFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 远程调用业务层
|
||||
* @Date 2024-4-7 上午 10:58
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "remoteProjectSkuService",
|
||||
value = ServiceNameConstants.PRODUCT_SERVICE,
|
||||
fallbackFactory = RemoteProjectSkuFactory.class,
|
||||
path = "/sku"
|
||||
)
|
||||
public interface RemoteProjectSkuService {
|
||||
|
||||
/**
|
||||
* 通过商品ID和SKU获取SKU信息
|
||||
* @param projectId 商品ID
|
||||
* @param projectSku 商品SKU
|
||||
* @return 商品SKU信息
|
||||
*/
|
||||
@GetMapping("/info/{projectId}/{projectSku}")
|
||||
public Result<ProjectSkuInfo> getInfoByProjectIdAndSku(@PathVariable("projectId") Long projectId,
|
||||
@PathVariable("projectSku") String projectSku);
|
||||
/**
|
||||
* 通过商品ID和SKU获取SKU信息
|
||||
* @param projectId 商品ID
|
||||
* @return 商品SKU信息
|
||||
*/
|
||||
@GetMapping("/list/{projectId}")
|
||||
public Result<List<ProjectSkuInfo>> listByProjectId(@PathVariable("projectId") Long projectId);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.product.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
import com.muyu.product.remote.factory.RemoteProjectSkuFactory;
|
||||
import com.muyu.product.remote.factory.RemoteRuleAttrFactory;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格信息远程调用业务层
|
||||
* @Date 2024-4-7 上午 10:58
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "remoteRuleAttrService",
|
||||
value = ServiceNameConstants.PRODUCT_SERVICE,
|
||||
fallbackFactory = RemoteRuleAttrFactory.class,
|
||||
path = "/ruleAttr"
|
||||
)
|
||||
public interface RemoteRuleAttrService {
|
||||
/**
|
||||
* 获取规格详情详细信息
|
||||
*/
|
||||
@GetMapping(value = "/list/ruleId/{ruleId}")
|
||||
public Result<List<RuleAttrInfo>> getInfoByRuleId(@PathVariable("ruleId") Long id);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.product.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.remote.factory.RemoteProjectSkuFactory;
|
||||
import com.muyu.product.remote.factory.RemoteRuleFactory;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格远程调用业务层
|
||||
* @Date 2024-4-7 上午 10:58
|
||||
*/
|
||||
@FeignClient(
|
||||
contextId = "remoteRuleService",
|
||||
value = ServiceNameConstants.PRODUCT_SERVICE,
|
||||
fallbackFactory = RemoteRuleFactory.class,
|
||||
path = "/rule"
|
||||
)
|
||||
public interface RemoteRuleService {
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<RuleInfo> getInfo(@PathVariable("id") Long id);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.remote.RemoteProjectInfoService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格远程调熔断器
|
||||
* @Date 2024-4-7 上午 10:59
|
||||
*/
|
||||
public class RemoteProjectInfoFactory implements FallbackFactory<RemoteProjectInfoService> {
|
||||
@Override
|
||||
public RemoteProjectInfoService create (Throwable cause) {
|
||||
return new RemoteProjectInfoService() {
|
||||
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public Result<ProjectInfo> getInfo (Long id) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 远程调熔断器
|
||||
* @Date 2024-4-7 上午 10:59
|
||||
*/
|
||||
public class RemoteProjectSkuFactory implements FallbackFactory<RemoteProjectSkuService> {
|
||||
@Override
|
||||
public RemoteProjectSkuService create (Throwable cause) {
|
||||
return new RemoteProjectSkuService() {
|
||||
@Override
|
||||
public Result<ProjectSkuInfo> getInfoByProjectIdAndSku (Long projectId, String projectSku) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过商品ID和SKU获取SKU信息
|
||||
*
|
||||
* @param projectId 商品ID
|
||||
*
|
||||
* @return 商品SKU信息
|
||||
*/
|
||||
@Override
|
||||
public Result<List<ProjectSkuInfo>> listByProjectId (Long projectId) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import com.muyu.product.remote.RemoteRuleAttrService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格详情远程调熔断器
|
||||
* @Date 2024-4-7 上午 10:59
|
||||
*/
|
||||
public class RemoteRuleAttrFactory implements FallbackFactory<RemoteRuleAttrService> {
|
||||
@Override
|
||||
public RemoteRuleAttrService create (Throwable cause) {
|
||||
return new RemoteRuleAttrService() {
|
||||
|
||||
/**
|
||||
* 获取规格详情详细信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public Result<List<RuleAttrInfo>> getInfoByRuleId (Long id) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.product.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.ProjectSkuInfo;
|
||||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.muyu.product.remote.RemoteProjectSkuService;
|
||||
import com.muyu.product.remote.RemoteRuleService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 规格远程调熔断器
|
||||
* @Date 2024-4-7 上午 10:59
|
||||
*/
|
||||
public class RemoteRuleFactory implements FallbackFactory<RemoteRuleService> {
|
||||
@Override
|
||||
public RemoteRuleService create (Throwable cause) {
|
||||
return new RemoteRuleService() {
|
||||
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public Result<RuleInfo> getInfo (Long id) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
com.muyu.product.remote.factory.RemoteProjectSkuFactory
|
||||
com.muyu.product.remote.factory.RemoteRuleAttrFactory
|
||||
com.muyu.product.remote.factory.RemoteRuleFactory
|
||||
com.muyu.product.remote.factory.RemoteProjectInfoFactory
|
|
@ -0,0 +1,127 @@
|
|||
<?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-group-buy</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-group-buy-server</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>
|
||||
|
||||
|
||||
<!-- 商品模块 common 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-group-buy-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 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.muyu</groupId>
|
||||
<artifactId>muyu-group-buy-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-group-buy-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</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,23 @@
|
|||
package com.muyu.product;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 商品启动类
|
||||
* @Date 2024-2-26 下午 04:07
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuGroupBuyApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuGroupBuyApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.product.domain.GroupBuy;
|
||||
import com.muyu.product.domain.req.GroupBuyQueryReq;
|
||||
import com.muyu.product.domain.req.GroupBuySaveReq;
|
||||
import com.muyu.product.domain.req.GroupBuyEditReq;
|
||||
import com.muyu.product.service.GroupBuyService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 拼团Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Api(tags = "拼团")
|
||||
@RestController
|
||||
@RequestMapping("/buy")
|
||||
public class GroupBuyController extends BaseController {
|
||||
@Autowired
|
||||
private GroupBuyService groupBuyService;
|
||||
|
||||
/**
|
||||
* 查询拼团列表
|
||||
*/
|
||||
@ApiOperation("获取拼团列表")
|
||||
@RequiresPermissions("product:buy:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<GroupBuy>> list(GroupBuyQueryReq groupBuyQueryReq) {
|
||||
startPage();
|
||||
List<GroupBuy> list = groupBuyService.list(GroupBuy.queryBuild(groupBuyQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出拼团列表
|
||||
*/
|
||||
@ApiOperation("导出拼团列表")
|
||||
@RequiresPermissions("product:buy:export")
|
||||
@Log(title = "拼团", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, GroupBuy groupBuy) {
|
||||
List<GroupBuy> list = groupBuyService.list(groupBuy);
|
||||
ExcelUtil<GroupBuy> util = new ExcelUtil<GroupBuy>(GroupBuy.class);
|
||||
util.exportExcel(response, list, "拼团数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼团详细信息
|
||||
*/
|
||||
@ApiOperation("获取拼团详细信息")
|
||||
@RequiresPermissions("product:buy:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<GroupBuy> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(groupBuyService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增拼团
|
||||
*/
|
||||
@RequiresPermissions("product:buy:add")
|
||||
@Log(title = "拼团", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增拼团")
|
||||
public Result<String> add(@RequestBody GroupBuySaveReq groupBuySaveReq) {
|
||||
return toAjax(groupBuyService.save(GroupBuy.saveBuild(groupBuySaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团
|
||||
*/
|
||||
@RequiresPermissions("product:buy:edit")
|
||||
@Log(title = "拼团", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改拼团")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody GroupBuyEditReq groupBuyEditReq) {
|
||||
return toAjax(groupBuyService.updateById(GroupBuy.editBuild(id,groupBuyEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除拼团
|
||||
*/
|
||||
@RequiresPermissions("product:buy:remove")
|
||||
@Log(title = "拼团", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除拼团")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(groupBuyService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.product.domain.GroupBuy;
|
||||
|
||||
/**
|
||||
* 拼团Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
public interface GroupBuyMapper extends BaseMapper<GroupBuy> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.product.domain.GroupBuy;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 拼团Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
public interface GroupBuyService extends IService<GroupBuy> {
|
||||
/**
|
||||
* 查询拼团列表
|
||||
*
|
||||
* @param groupBuy 拼团
|
||||
* @return 拼团集合
|
||||
*/
|
||||
public List<GroupBuy> list(GroupBuy groupBuy);
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.product.mapper.GroupBuyMapper;
|
||||
import com.muyu.product.domain.GroupBuy;
|
||||
import com.muyu.product.service.GroupBuyService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 拼团Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-14
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GroupBuyServiceImpl extends ServiceImpl<GroupBuyMapper, GroupBuy> implements GroupBuyService {
|
||||
|
||||
/**
|
||||
* 查询拼团列表
|
||||
*
|
||||
* @param groupBuy 拼团
|
||||
* @return 拼团
|
||||
*/
|
||||
@Override
|
||||
public List<GroupBuy> list(GroupBuy groupBuy) {
|
||||
LambdaQueryWrapper<GroupBuy> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(groupBuy.getProjectId())){
|
||||
queryWrapper.eq(GroupBuy::getProjectId, groupBuy.getProjectId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(groupBuy.getStartTime())){
|
||||
queryWrapper.eq(GroupBuy::getStartTime, groupBuy.getStartTime());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(groupBuy.getEndTime())){
|
||||
queryWrapper.eq(GroupBuy::getEndTime, groupBuy.getEndTime());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(groupBuy.getMinMembers())){
|
||||
queryWrapper.eq(GroupBuy::getMinMembers, groupBuy.getMinMembers());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(groupBuy.getStatus())){
|
||||
queryWrapper.eq(GroupBuy::getStatus, groupBuy.getStatus());
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9308
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-group-buy
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.10.10.132:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 10.10.10.132:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.product.mapper: DEBUG
|
|
@ -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-product"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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,19 @@
|
|||
<?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.product.mapper.GroupBuyMapper">
|
||||
|
||||
<resultMap type="com.muyu.product.domain.GroupBuy" id="GroupBuyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="minMembers" column="min_members" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGroupBuyVo">
|
||||
select id, project_id, start_time, end_time, min_members, status from group_buy
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,26 @@
|
|||
<?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-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-group-buy</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-group-buy-common</module>
|
||||
<module>muyu-group-buy-remote</module>
|
||||
<module>muyu-group-buy-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,26 @@
|
|||
{ 基本信息: {
|
||||
name: "",
|
||||
introduction: "",
|
||||
mianType: "",
|
||||
parentType: "",
|
||||
type: "",
|
||||
image: "",
|
||||
carouselImages: "",
|
||||
status: "",
|
||||
ruleId: "",
|
||||
branId: "",
|
||||
remark: ""
|
||||
},
|
||||
品类属性: [ {
|
||||
id: "",
|
||||
value: "",
|
||||
} …………
|
||||
],
|
||||
商品规格: [ {
|
||||
SKU: "",(所有的规格属性拼接而成)
|
||||
"images": "",
|
||||
库存: "",
|
||||
价格: "",
|
||||
} …………
|
||||
]
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.product.domain.AttributeInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -36,5 +37,5 @@ public class AttributeGroupEditReq extends BaseEntity {
|
|||
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
||||
private String states;
|
||||
|
||||
private List<Long> attributeIdList ;
|
||||
private List<AttributeInfo> attributeIdList ;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
|
|||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 品类信息对象 category_info
|
||||
*
|
||||
|
@ -38,5 +40,18 @@ public class CategoryInfoEditReq extends TreeEntity {
|
|||
/** 介绍 */
|
||||
@ApiModelProperty(name = "介绍", value = "介绍")
|
||||
private String introduction;
|
||||
/**
|
||||
* 商品属性组关联ID
|
||||
*/
|
||||
private List<Long> attributeGroupIdList;
|
||||
/**
|
||||
* 商品属性关联ID
|
||||
*/
|
||||
private List<Long> attributeIdList;
|
||||
|
||||
/**
|
||||
* 商品品牌组关联ID
|
||||
*/
|
||||
private List<Long> brandIdList;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -8,6 +9,8 @@ import lombok.experimental.SuperBuilder;
|
|||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品规格对象 rule_info
|
||||
*
|
||||
|
@ -31,4 +34,6 @@ public class RuleInfoEditReq extends BaseEntity {
|
|||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||
private String status;
|
||||
|
||||
private List<RuleAttrAddModel> ruleAttrList;
|
||||
|
||||
}
|
||||
|
|
|
@ -112,8 +112,9 @@ public class CategoryInfoController extends BaseController {
|
|||
@Log(title = "品类信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改品类信息")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody CategoryInfoEditReq categoryInfoEditReq) {
|
||||
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq)));
|
||||
public boolean edit(@PathVariable Long id, @RequestBody CategoryInfoEditReq categoryInfoEditReq) {
|
||||
boolean b = categoryInfoService.updateById(id, categoryInfoEditReq);
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,8 +125,9 @@ public class CategoryInfoController extends BaseController {
|
|||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除品类信息")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(categoryInfoService.removeBatchByIds(ids));
|
||||
public int remove(@PathVariable Long ids) {
|
||||
int i = categoryInfoService.removeBatchById(ids);
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,8 +101,9 @@ public class RuleInfoController extends BaseController {
|
|||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改商品规格")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody RuleInfoEditReq ruleInfoEditReq) {
|
||||
return toAjax(ruleInfoService.updateById(RuleInfo.editBuild(id,ruleInfoEditReq)));
|
||||
public boolean edit(@PathVariable Long id, @RequestBody RuleInfoEditReq ruleInfoEditReq) {
|
||||
boolean b = ruleInfoService.updateById(id, ruleInfoEditReq);
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.muyu.product.mapper;
|
|||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.product.domain.CategoryInfo;
|
||||
import com.muyu.product.domain.ProjectInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 品类信息Mapper接口
|
||||
|
@ -12,4 +14,8 @@ import com.muyu.product.domain.CategoryInfo;
|
|||
*/
|
||||
public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> {
|
||||
|
||||
|
||||
List<CategoryInfo> selByParentId(@Param("id") Long id);
|
||||
|
||||
List<ProjectInfo> selectByProjectInfo(@Param("parentId") Long parentId);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.muyu.product.service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import com.muyu.product.domain.AttributeInfo;
|
||||
import com.muyu.product.domain.BrandInfo;
|
||||
import com.muyu.product.domain.CategoryInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||
|
||||
|
@ -69,4 +71,9 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
|
|||
CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId);
|
||||
|
||||
public <T, AS> List<T> getCommon (Long categoryId, IService<AS> iService, IService<T> bsiService);
|
||||
|
||||
boolean updateById(Long id, CategoryInfoEditReq categoryInfoEditReq);
|
||||
|
||||
|
||||
int removeBatchById(Long id);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.product.domain.RuleInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.req.RuleInfoEditReq;
|
||||
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||
import com.muyu.product.domain.resp.RuleAttributeResp;
|
||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||
|
@ -37,4 +38,7 @@ public interface RuleInfoService extends IService<RuleInfo> {
|
|||
|
||||
|
||||
RuleInfoUpdResp getUpdById(Long id);
|
||||
|
||||
boolean updateById(Long id, RuleInfoEditReq ruleInfoEditReq);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.product.mapper.AsCategoryAttributeMapper;
|
||||
import com.muyu.product.domain.AsCategoryAttribute;
|
||||
|
@ -20,7 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
@Slf4j
|
||||
@Service
|
||||
public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttributeMapper, AsCategoryAttribute> implements AsCategoryAttributeService {
|
||||
|
||||
/**
|
||||
* 查询品类属性中间列表
|
||||
*
|
||||
|
|
|
@ -128,8 +128,8 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
|
|||
public void updateByIdList(Long id, AttributeGroupEditReq attributeGroupEditReq) {
|
||||
attributeGroupMapper.deleteId(id);
|
||||
|
||||
|
||||
attributeGroupMapper.install(id,attributeGroupEditReq.getAttributeIdList());
|
||||
List<Long> longs = attributeGroupEditReq.getAttributeIdList().stream().map(AttributeInfo::getId).toList();
|
||||
attributeGroupMapper.install(id,longs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.*;
|
||||
import com.muyu.product.domain.base.CategoryBase;
|
||||
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||
import com.muyu.product.domain.model.TemplateAttributeGroupModel;
|
||||
import com.muyu.product.domain.model.TemplateAttributeModel;
|
||||
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||
import com.muyu.product.mapper.CategoryInfoMapper;
|
||||
|
@ -19,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -57,6 +61,8 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
|
||||
@Autowired
|
||||
private AttributeGroupService attributeGroupService;
|
||||
@Resource
|
||||
private CategoryInfoMapper categoryInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询品类信息列表
|
||||
|
@ -270,6 +276,55 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(Long id, CategoryInfoEditReq categoryInfoEditReq) {
|
||||
boolean b = this.updateById(CategoryInfo.editBuild(id, categoryInfoEditReq));
|
||||
|
||||
if(b) {
|
||||
this.asCategoryAttributeService.remove(new LambdaQueryWrapper<AsCategoryAttribute>().eq(AsCategoryAttribute::getCategoryId, id));
|
||||
this.asCategoryAttributeGroupService.remove(new LambdaQueryWrapper<AsCategoryAttributeGroup>().eq(AsCategoryAttributeGroup::getCategoryId, id));
|
||||
this. asCategoryBrandService.remove(new LambdaQueryWrapper<AsCategoryBrand>().eq(AsCategoryBrand::getCategoryId, id));
|
||||
|
||||
asCategoryAttributeService.saveBatch(
|
||||
categoryInfoEditReq.getAttributeIdList().stream()
|
||||
.map(categoryAttributeId -> AsCategoryAttribute.categoryBuild(categoryAttributeId,id))
|
||||
.toList()
|
||||
);
|
||||
asCategoryAttributeGroupService.saveBatch(
|
||||
categoryInfoEditReq.getAttributeIdList().stream()
|
||||
.map(categoryGoryAttributeGroupId -> AsCategoryAttributeGroup.categoryBuild(categoryGoryAttributeGroupId,id))
|
||||
.toList()
|
||||
);
|
||||
asCategoryBrandService.saveBatch(
|
||||
categoryInfoEditReq.getAttributeIdList().stream()
|
||||
.map(categoryBrandId -> AsCategoryBrand.categoryBuild(categoryBrandId,id))
|
||||
.toList()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int removeBatchById(Long id) {
|
||||
CategoryInfo categoryInfo = categoryInfoMapper.selectById(id);
|
||||
List<CategoryInfo> categoryInfos = categoryInfoMapper.selByParentId(categoryInfo.getId());
|
||||
|
||||
if(categoryInfos.size() != 0){
|
||||
throw new SecurityException("不能删除还有子集");
|
||||
}
|
||||
|
||||
List<ProjectInfo> projectInfos = categoryInfoMapper.selectByProjectInfo(categoryInfo.getParentId());
|
||||
if(projectInfos.size() != 0){
|
||||
throw new SecurityException("不能删除与商品关联");
|
||||
}
|
||||
int i = categoryInfoMapper.deleteById(id);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过品类ID获取父级以上的属性、属性组、品牌集合
|
||||
*
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.product.domain.RuleAttrInfo;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||
import com.muyu.product.domain.req.RuleInfoEditReq;
|
||||
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||
import com.muyu.product.domain.resp.RuleAttributeResp;
|
||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||
|
@ -127,6 +128,23 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
|||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(Long id, RuleInfoEditReq ruleInfoEditReq) {
|
||||
boolean update = this.updateById(RuleInfo.editBuild(id, ruleInfoEditReq));
|
||||
if(update){
|
||||
LambdaQueryWrapper<RuleAttrInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(RuleAttrInfo::getRuleId,id);
|
||||
this.ruleAttrInfoService.remove(queryWrapper);
|
||||
|
||||
ruleAttrInfoService.saveBatch(
|
||||
ruleInfoEditReq.getRuleAttrList().stream()
|
||||
.map(ruleAttrAddModel -> RuleAttrInfo.addModelBuild(ruleAttrAddModel, () -> id, SecurityUtils::getUsername))
|
||||
.toList()
|
||||
);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
|
||||
// RuleInfo byId = this.getById(id);
|
||||
//
|
||||
|
|
|
@ -21,4 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="selectCategoryInfoVo">
|
||||
select id, name, image, parent_id, start, introduction, remark, create_by, create_time, update_by, update_time from category_info
|
||||
</sql>
|
||||
<select id="selByParentId" resultType="com.muyu.product.domain.CategoryInfo">
|
||||
select * from category_info where category_info.parent_id=#{id}
|
||||
</select>
|
||||
<select id="selectByProjectInfo" resultType="com.muyu.product.domain.ProjectInfo">
|
||||
select * from project_info where project_info.parent_type=#{parentId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-file</module>
|
||||
<module>muyu-product</module>
|
||||
<module>muyu-shop-cart</module>
|
||||
<module>muyu-group-buy</module>
|
||||
|
||||
</modules>
|
||||
|
||||
|
|
Loading…
Reference in New Issue