初始化购物车

master
rouchen 2024-03-29 17:21:01 +08:00
parent 6c17b06a7c
commit aed910d491
18 changed files with 667 additions and 83 deletions

View File

@ -33,3 +33,11 @@
自由属性:[]
}
购物车
id
user_id
商品id
sku_id
数量

View File

@ -22,40 +22,44 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
public class ProjectDetailResp {
/**
*
*/
private List<CategoryInfo> categoryInfoList;
/**
*
*/
private ProjectInfo projectInfo;
/**
*
*/
private BrandInfo brandInfo;
/**
*
*/
private List<CategoryInfo> categoryInfoList;
/**
* sku
*/
private List<ProjectSkuInfo> projectSkuInfoList;
/**
*
*/
private ProjectInfo projectInfo;
/**
*
*/
private List<AsProductAttributeInfo> productAttributeInfoList;
/**
*
*/
private BrandInfo brandInfo;
/**
*
*/
private List<RuleAttrAddModel> ruleAttrAddModelList;
/**
*
*/
private List<TemplateAttributeModel> attributeInfoList;
/**
*
*/
private List<TemplateAttributeGroupModel> attributeGroupList;
/**
* Sku
*/
private List<ProjectSkuInfo> projectSkuInfoList;
/**
*
*/
private List<AsProductAttributeInfo> productAttributeInfoList;
/**
*
*/
private List<RuleAttrAddModel> ruleAttrModelList;
/**
*
*/
private List<TemplateAttributeModel> attributeInfoList;
/**
*
*/
private List<TemplateAttributeGroupModel> attributeGroupList;
}

View File

@ -5,6 +5,7 @@ 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;
import org.springframework.context.annotation.ComponentScan;
/**
* @author DongZl

View File

@ -4,7 +4,6 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.product.cache.ProjectInfoCache;
import com.muyu.product.domain.AsProductAttributeInfo;
import com.muyu.product.domain.ProjectSkuInfo;
import com.muyu.product.domain.model.CategoryInfoSaveModel;
@ -98,40 +97,37 @@ public class ProjectInfoController extends BaseController {
public Result<ProjectInfo> getCacheInfo(@PathVariable("id") Long id) {
return Result.success(projectInfoService.getById(id));
}
@Autowired
private ProjectInfoCache projectInfoCache;
@ApiOperation("获取商品信息详细信息")
@RequiresPermissions("product:info:query")
@GetMapping(value = "/{id}")
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) {
return Result.success(projectInfoCache.get(id));
}
// /**
// * 获取商品信息详细信息
// */
// @ApiOperation("获取商品信息详细信息")
// @RequiresPermissions("product:info:query")
// @GetMapping(value = "/{id}")
// @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
// public Result<ProjectAddModel> getInfo(@PathVariable("id") Long id) {
//
// LambdaQueryWrapper<AsProductAttributeInfo> asProductAttributeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
// asProductAttributeInfoLambdaQueryWrapper.eq(AsProductAttributeInfo::getProductId, id);
// List<AsProductAttributeInfo> list = asProductAttributeInfoService.list(asProductAttributeInfoLambdaQueryWrapper);
//
// ProjectInfo projectInfo = projectInfoService.getById(id);
// LambdaQueryWrapper<ProjectSkuInfo> projectSkuInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
// projectSkuInfoLambdaQueryWrapper.eq(ProjectSkuInfo::getProjectId,id);
// List<ProjectSkuInfo> projectSkuInfos = projectSkuInfoService.list(projectSkuInfoLambdaQueryWrapper);
// ProjectAddModel projectAddModel = ProjectAddModel.queryBuild(projectInfo,
// list, projectSkuInfos
// );
// projectAddModel.setId(id);
// return Result.success(projectAddModel);
// public Result<ProjectInfo> getInfo(@PathVariable("id") Long id) {
// return Result.success(projectInfoService.get(id));
// }
/**
*
*/
@ApiOperation("获取商品信息详细信息")
@RequiresPermissions("product:info:query")
@GetMapping(value = "/{id}")
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
public Result<ProjectAddModel> getInfo(@PathVariable("id") Long id) {
LambdaQueryWrapper<AsProductAttributeInfo> asProductAttributeInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
asProductAttributeInfoLambdaQueryWrapper.eq(AsProductAttributeInfo::getProductId, id);
List<AsProductAttributeInfo> list = asProductAttributeInfoService.list(asProductAttributeInfoLambdaQueryWrapper);
ProjectInfo projectInfo = projectInfoService.getById(id);
LambdaQueryWrapper<ProjectSkuInfo> projectSkuInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
projectSkuInfoLambdaQueryWrapper.eq(ProjectSkuInfo::getProjectId,id);
List<ProjectSkuInfo> projectSkuInfos = projectSkuInfoService.list(projectSkuInfoLambdaQueryWrapper);
ProjectAddModel projectAddModel = ProjectAddModel.queryBuild(projectInfo,
list, projectSkuInfos
);
projectAddModel.setId(id);
return Result.success(projectAddModel);
}
/**
*
*/

View File

@ -213,36 +213,39 @@ private AsBrandProjectService asBrandProjectService;
@Override
public ProjectDetailResp getDetailInfo(Long id) {
//商品信息获取
// 商品信息获取
ProjectInfo projectInfo = this.getById(id);
//品牌信息
BrandInfo brandInfo =this.brandInfoService.getById(projectInfo.getBrandId());
//品类集合
// 品牌信息
BrandInfo brandInfo = this.brandInfoService.getById(projectInfo.getBrandId());
// 品类集合
List<CategoryInfo> categoryInfoList = categoryInfoService.listByIds(new ArrayList<>() {{
add(projectInfo.getMianType());
add(projectInfo.getParentType());
add(projectInfo.getType());
}});
//商品sku集合
// 商品Sku集合
List<ProjectSkuInfo> projectSkuInfoList = this.projectSkuInfoService.list(new LambdaQueryWrapper<>() {{
eq(ProjectSkuInfo::getProjectId, id);
}});
//商品和属性集合
List<AsProductAttributeInfo> productAttributeInfoList = this.asProductAttributeInfoService.list(new LambdaQueryWrapper<AsProductAttributeInfo>() {{
// 商品和属性集合
List<AsProductAttributeInfo> productAttributeInfoList = this.asProductAttributeInfoService.list(new LambdaQueryWrapper<>() {{
eq(AsProductAttributeInfo::getProductId, id);
}});
//商品规格
List<RuleAttrAddModel> ruleAttrModelList = this.ruleAttrInfoService.list(new LambdaQueryWrapper<RuleAttrInfo>() {{
// 商品规格
List<RuleAttrAddModel> ruleAttrModelList = ruleAttrInfoService.list(new LambdaQueryWrapper<>() {{
eq(RuleAttrInfo::getRuleId, projectInfo.getRuleId());
}}).stream()
.map(RuleAttrAddModel::infoBuild).toList();
CategoryCommonElementResp templateAttribute = this.categoryInfoService.getTemplateAttributeByCateGoryId(projectInfo.getType());
List<TemplateAttributeGroupModel> templateAttributeGroupList = templateAttribute.getTemplateAttributeGroupList();
ArrayList<TemplateAttributeModel> templateAttributeList = new ArrayList<>() {{
List<TemplateAttributeModel> templateAttributeList = new ArrayList<>(){{
addAll(templateAttribute.getTemplateAttributeList());
}};
//属性组和商品属性的id
ArrayList<Long> notInAttributeIdList = new ArrayList<>();
// 属性组和商品属性的ID
List<Long> notInAttributeIdList = new ArrayList<>();
List<Long> attributeGroupIdList = templateAttributeGroupList.stream()
.flatMap(templateAttributeGroupModel -> templateAttributeGroupModel.getAttributeList().stream())
.map(TemplateAttributeModel::getId)
@ -251,12 +254,12 @@ private AsBrandProjectService asBrandProjectService;
.map(TemplateAttributeModel::getId)
.toList();
if (!attributeGroupIdList.isEmpty()){
notInAttributeIdList.addAll(attributeGroupIdList);
notInAttributeIdList.addAll( attributeGroupIdList );
}
if (!attributeIdList.isEmpty()){
notInAttributeIdList.addAll(attributeIdList);
notInAttributeIdList.addAll( attributeIdList );
}
// 添加上,商品的自有属性
List<AsProductAttributeInfo> productAttributeList = this.asProductAttributeInfoService.list(
new LambdaQueryWrapper<>() {{
eq(AsProductAttributeInfo::getProductId, projectInfo.getId());
@ -265,27 +268,29 @@ private AsBrandProjectService asBrandProjectService;
);
List<TemplateAttributeModel> projectAttributeList = new ArrayList<>();
if (!projectAttributeList.isEmpty()){
if (!productAttributeList.isEmpty()){
List<Long> attrIdList = productAttributeList.stream()
.map(AsProductAttributeInfo::getAttributeId)
.toList();
projectAttributeList = attributeInfoService.list(new LambdaQueryWrapper<>(){{
in(AttributeInfo::getId, attrIdList);
}}).stream()
projectAttributeList = attributeInfoService.list(
new LambdaQueryWrapper<>() {{
in(AttributeInfo::getId, attrIdList);
}}
).stream()
.map(TemplateAttributeModel::attributeInfoBuild)
.toList();
}
//把自由属性添加到商品属性的集合当中,进行合并
// 把自有属性添加到商品属性的集合当中,进行合并
if (!projectAttributeList.isEmpty()){
templateAttributeList.addAll(projectAttributeList);
}
return ProjectDetailResp.builder()
return ProjectDetailResp.builder()
.projectInfo(projectInfo)
.brandInfo(brandInfo)
.categoryInfoList(categoryInfoList)
.projectSkuInfoList(projectSkuInfoList)
.productAttributeInfoList(productAttributeInfoList)
.ruleAttrAddModelList(ruleAttrModelList)
.ruleAttrModelList(ruleAttrModelList)
.attributeInfoList(templateAttributeList)
.attributeGroupList(templateAttributeGroupList)
.build();

View File

@ -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-shop-cart</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-shop-cart-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>

View File

@ -0,0 +1,105 @@
package com.muyu.shop.cart.domain;
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.shop.cart.domain.req.CartInfoQueryReq;
import com.muyu.shop.cart.domain.req.CartInfoSaveReq;
import com.muyu.shop.cart.domain.req.CartInfoEditReq;
import com.muyu.common.core.web.domain.BaseEntity;
/**
* cart_info
*
* @author muyu
* @date 2024-03-29
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("cart_info")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "CartInfo", description = "购物车")
public class CartInfo 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 = "商品", required = true)
private Long projectId;
/** sku */
@Excel(name = "sku")
@ApiModelProperty(name = "sku", value = "sku", required = true)
private String projectSku;
/** 用户 */
@Excel(name = "用户")
@ApiModelProperty(name = "用户", value = "用户", required = true)
private Long userId;
/** 数量 */
@Excel(name = "数量")
@ApiModelProperty(name = "数量", value = "数量", required = true)
private Long num;
/** 是否选中 */
@Excel(name = "是否选中")
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
private String isSelected;
/**
*
*/
public static CartInfo queryBuild( CartInfoQueryReq cartInfoQueryReq){
return CartInfo.builder()
.projectId(cartInfoQueryReq.getProjectId())
.projectSku(cartInfoQueryReq.getProjectSku())
.userId(cartInfoQueryReq.getUserId())
.num(cartInfoQueryReq.getNum())
.isSelected(cartInfoQueryReq.getIsSelected())
.build();
}
/**
*
*/
public static CartInfo saveBuild(CartInfoSaveReq cartInfoSaveReq){
return CartInfo.builder()
.projectId(cartInfoSaveReq.getProjectId())
.projectSku(cartInfoSaveReq.getProjectSku())
.userId(cartInfoSaveReq.getUserId())
.num(cartInfoSaveReq.getNum())
.isSelected(cartInfoSaveReq.getIsSelected())
.build();
}
/**
*
*/
public static CartInfo editBuild(Long id, CartInfoEditReq cartInfoEditReq){
return CartInfo.builder()
.id(id)
.projectId(cartInfoEditReq.getProjectId())
.projectSku(cartInfoEditReq.getProjectSku())
.userId(cartInfoEditReq.getUserId())
.num(cartInfoEditReq.getNum())
.isSelected(cartInfoEditReq.getIsSelected())
.build();
}
}

View File

@ -0,0 +1,46 @@
package com.muyu.shop.cart.domain.req;
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;
/**
* cart_info
*
* @author muyu
* @date 2024-03-29
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "CartInfoEditReq", description = "购物车")
public class CartInfoEditReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 商品 */
@ApiModelProperty(name = "商品", value = "商品", required = true)
private Long projectId;
/** sku */
@ApiModelProperty(name = "sku", value = "sku", required = true)
private String projectSku;
/** 用户 */
@ApiModelProperty(name = "用户", value = "用户", required = true)
private Long userId;
/** 数量 */
@ApiModelProperty(name = "数量", value = "数量", required = true)
private Long num;
/** 是否选中 */
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
private String isSelected;
}

View File

@ -0,0 +1,46 @@
package com.muyu.shop.cart.domain.req;
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;
/**
* cart_info
*
* @author muyu
* @date 2024-03-29
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "CartInfoQueryReq", description = "购物车")
public class CartInfoQueryReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 商品 */
@ApiModelProperty(name = "商品", value = "商品")
private Long projectId;
/** sku */
@ApiModelProperty(name = "sku", value = "sku")
private String projectSku;
/** 用户 */
@ApiModelProperty(name = "用户", value = "用户")
private Long userId;
/** 数量 */
@ApiModelProperty(name = "数量", value = "数量")
private Long num;
/** 是否选中 */
@ApiModelProperty(name = "是否选中", value = "是否选中")
private String isSelected;
}

View File

@ -0,0 +1,56 @@
package com.muyu.shop.cart.domain.req;
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;
/**
* cart_info
*
* @author muyu
* @date 2024-03-29
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "CartInfoSaveReq", description = "购物车")
public class CartInfoSaveReq extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
@ApiModelProperty(name = "主键", value = "主键")
private Long id;
/** 商品 */
@ApiModelProperty(name = "商品", value = "商品", required = true)
private Long projectId;
/** sku */
@ApiModelProperty(name = "sku", value = "sku", required = true)
private String projectSku;
/** 用户 */
@ApiModelProperty(name = "用户", value = "用户", required = true)
private Long userId;
/** 数量 */
@ApiModelProperty(name = "数量", value = "数量", required = true)
private Long num;
/** 是否选中 */
@ApiModelProperty(name = "是否选中", value = "是否选中", required = true)
private String isSelected;
}

View File

@ -0,0 +1,29 @@
<?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-shop-cart</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-shop-cart-remote</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 购物车模块 公共依赖 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-shop-cart-common</artifactId>
<version>${muyu.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,116 @@
<?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-shop-cart</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>muyu-shop-cart-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>
<!-- 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-shop-cart-common</artifactId>
<version>${muyu.version}</version>
</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>

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9506
# Spring
spring:
application:
# 应用名称
name: muyu-shop-cart
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 115.159.211.196:8848
config:
# 配置中心地址
server-addr: 115.159.211.196:8848
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.muyu.shop.cart.mapper: DEBUG

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/muyu-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -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-shop-cart</artifactId>
<packaging>pom</packaging>
<modules>
<module>muyu-shop-cart-common</module>
<module>muyu-shop-cart-remote</module>
<module>muyu-shop-cart-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>

View File

@ -14,6 +14,7 @@
<module>muyu-job</module>
<module>muyu-file</module>
<module>muyu-product</module>
<module>muyu-shop-cart</module>
</modules>
<artifactId>muyu-modules</artifactId>

14
pom.xml
View File

@ -234,6 +234,20 @@
<version>${muyu.version}</version>
</dependency>
<!-- 购物车模块 公共依赖 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-shop-cart-common</artifactId>
<version>${muyu.version}</version>
</dependency>
<!-- 购物车模块 远程客户端 依赖 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-shop-cart-remote</artifactId>
<version>${muyu.version}</version>
</dependency>
</dependencies>
</dependencyManagement>