Compare commits
2 Commits
259a7c8c2a
...
f0f772ae89
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0f772ae89 | ||
|
|
e433921abe |
@@ -141,8 +141,8 @@ jobs:
|
|||||||
cd ${{ env.REMOTE_DEPLOY_PATH }}
|
cd ${{ env.REMOTE_DEPLOY_PATH }}
|
||||||
echo "停止旧容器..."
|
echo "停止旧容器..."
|
||||||
docker compose down || true
|
docker compose down || true
|
||||||
echo "清理Docker资源..."
|
# echo "清理Docker资源..."
|
||||||
docker system prune -f
|
# docker system prune -f
|
||||||
echo "构建镜像..."
|
echo "构建镜像..."
|
||||||
docker compose build --no-cache
|
docker compose build --no-cache
|
||||||
echo "启动服务..."
|
echo "启动服务..."
|
||||||
|
|||||||
10
pom.xml
10
pom.xml
@@ -24,7 +24,7 @@
|
|||||||
<maven.compiler.target>21</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
<mybatis-plus.version>3.5.6</mybatis-plus.version>
|
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||||||
<minio.version>8.5.7</minio.version>
|
<minio.version>8.5.7</minio.version>
|
||||||
<jwt.version>0.12.3</jwt.version>
|
<jwt.version>0.12.3</jwt.version>
|
||||||
<hutool.version>5.8.26</hutool.version>
|
<hutool.version>5.8.26</hutool.version>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<scope>runtime</scope>
|
<version>8.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MinIO -->
|
<!-- MinIO -->
|
||||||
@@ -149,12 +149,6 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- ==================== 微服务 ==================== -->
|
<!-- ==================== 微服务 ==================== -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.aida.seller.module.*.mapper")
|
@MapperScan("com.aida.seller.module.*.mapper")
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
|
@ComponentScan(basePackages = "com.aida.seller")
|
||||||
public class AidaSellerApplication {
|
public class AidaSellerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.aida.seller.config;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class MyBatisPlusConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
||||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
|
||||||
return interceptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public MetaObjectHandler metaObjectHandler() {
|
|
||||||
return new MetaObjectHandler() {
|
|
||||||
@Override
|
|
||||||
public void insertFill(MetaObject metaObject) {
|
|
||||||
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFill(MetaObject metaObject) {
|
|
||||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.aida.seller.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("createTime", LocalDateTime.now(), metaObject);
|
||||||
|
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
|
||||||
|
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
|
||||||
|
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.aida.seller.config;
|
package com.aida.seller.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
@@ -14,16 +17,28 @@ import org.springframework.context.ApplicationContext;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableTransactionManagement
|
||||||
@MapperScan(basePackages = "com.aida.seller.module.*.mapper", sqlSessionFactoryRef = "primarySqlSessionFactory")
|
@MapperScan(basePackages = "com.aida.seller.module.*.mapper", sqlSessionFactoryRef = "primarySqlSessionFactory")
|
||||||
public class PrimaryDataSourceConfig {
|
public class PrimaryDataSourceConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MybatisPlusInterceptor mybatisPlusInterceptor;
|
private MybatisPlusInterceptor mybatisPlusInterceptor;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MetaObjectHandler myMetaObjectHandler;
|
||||||
|
|
||||||
@Primary
|
@Primary
|
||||||
@Bean(name = "primaryDataSource")
|
@Bean(name = "primaryDataSource")
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.primary")
|
@ConfigurationProperties(prefix = "spring.datasource.primary")
|
||||||
@@ -42,6 +57,7 @@ public class PrimaryDataSourceConfig {
|
|||||||
|
|
||||||
GlobalConfig globalConfig = new GlobalConfig();
|
GlobalConfig globalConfig = new GlobalConfig();
|
||||||
globalConfig.setBanner(false);
|
globalConfig.setBanner(false);
|
||||||
|
globalConfig.setMetaObjectHandler(myMetaObjectHandler);
|
||||||
bean.setGlobalConfig(globalConfig);
|
bean.setGlobalConfig(globalConfig);
|
||||||
|
|
||||||
bean.setPlugins(mybatisPlusInterceptor);
|
bean.setPlugins(mybatisPlusInterceptor);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.designer.dto;
|
package com.aida.seller.module.designer.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.aida.seller.module.designer.entity;
|
package com.aida.seller.module.designer.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -16,6 +18,7 @@ public class DesignerEntity implements Serializable {
|
|||||||
|
|
||||||
/** 设计师ID */
|
/** 设计师ID */
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 用户ID(关联用户表) */
|
/** 用户ID(关联用户表) */
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.designer.vo;
|
package com.aida.seller.module.designer.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -14,8 +16,6 @@ public class DesignerApplyDetailVo implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "设计师ID")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "店铺名称")
|
@Schema(description = "店铺名称")
|
||||||
private String shopName;
|
private String shopName;
|
||||||
|
|||||||
@@ -68,15 +68,6 @@ public class ListingController {
|
|||||||
return Response.success();
|
return Response.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "批量设置库存", description = "入参为商品ID和库存值列表")
|
|
||||||
@PutMapping("/stock/batch")
|
|
||||||
public Response<Void> batchUpdateStock(
|
|
||||||
@Parameter(description = "库存更新列表") @RequestBody List<ListingStockDTO> list) {
|
|
||||||
Long sellerId = UserContext.getUserId();
|
|
||||||
listingService.batchUpdateStock(list, sellerId);
|
|
||||||
return Response.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "设置弹窗提醒标志", description = "在Redis中设置7天过期的弹窗提醒标志")
|
@Operation(summary = "设置弹窗提醒标志", description = "在Redis中设置7天过期的弹窗提醒标志")
|
||||||
@PostMapping("/popup/set")
|
@PostMapping("/popup/set")
|
||||||
public Response<Void> setPopupReminder() {
|
public Response<Void> setPopupReminder() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.listing.dto;
|
package com.aida.seller.module.listing.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ public class ListingImageDTO implements Serializable {
|
|||||||
|
|
||||||
/** 图片ID,有值则更新,无则新增 */
|
/** 图片ID,有值则更新,无则新增 */
|
||||||
@Schema(description = "图片ID,有值则更新,无则新增")
|
@Schema(description = "图片ID,有值则更新,无则新增")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 图片类别: cover/main_product/product/sketch/apparel */
|
/** 图片类别: cover/main_product/product/sketch/apparel */
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.listing.dto;
|
package com.aida.seller.module.listing.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -17,6 +19,7 @@ public class ListingSaveDTO implements Serializable {
|
|||||||
|
|
||||||
/** 商品ID,无则新建,有则更新 */
|
/** 商品ID,无则新建,有则更新 */
|
||||||
@Schema(description = "商品ID,无则新建,有则更新")
|
@Schema(description = "商品ID,无则新建,有则更新")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 商品标题 */
|
/** 商品标题 */
|
||||||
@@ -31,9 +34,6 @@ public class ListingSaveDTO implements Serializable {
|
|||||||
@Schema(description = "价格")
|
@Schema(description = "价格")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/** 库存 */
|
|
||||||
@Schema(description = "库存")
|
|
||||||
private Integer stock;
|
|
||||||
|
|
||||||
/** 浏览量(更新时传入) */
|
/** 浏览量(更新时传入) */
|
||||||
@Schema(description = "浏览量(更新时传入)")
|
@Schema(description = "浏览量(更新时传入)")
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.aida.seller.module.listing.dto;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量库存更新 DTO
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ListingStockDTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 商品ID */
|
|
||||||
@Schema(description = "商品ID")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 库存值 */
|
|
||||||
@Schema(description = "库存值")
|
|
||||||
private Integer stock;
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,9 @@ package com.aida.seller.module.listing.entity;
|
|||||||
import com.aida.seller.module.listing.enums.ProductCategoryEnum;
|
import com.aida.seller.module.listing.enums.ProductCategoryEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -21,6 +24,7 @@ public class ListingEntity implements Serializable {
|
|||||||
|
|
||||||
/** 商品ID */
|
/** 商品ID */
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 卖家ID */
|
/** 卖家ID */
|
||||||
@@ -35,8 +39,8 @@ public class ListingEntity implements Serializable {
|
|||||||
/** 价格 */
|
/** 价格 */
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/** 库存数量 */
|
/** 销量 */
|
||||||
private Integer stock;
|
private Integer salesVolume;
|
||||||
|
|
||||||
/** 封面图URL(列表页展示用) */
|
/** 封面图URL(列表页展示用) */
|
||||||
private String cover;
|
private String cover;
|
||||||
@@ -48,11 +52,13 @@ public class ListingEntity implements Serializable {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
/** 是否删除:0-否,1-是 */
|
/** 是否删除:0-否,1-是 */
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.aida.seller.module.listing.entity;
|
package com.aida.seller.module.listing.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -17,9 +20,11 @@ public class ListingImageEntity implements Serializable {
|
|||||||
|
|
||||||
/** 图片ID */
|
/** 图片ID */
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 商品ID */
|
/** 商品ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long listingId;
|
private Long listingId;
|
||||||
|
|
||||||
/** 图片类别: cover/main_product/product/sketch/apparel */
|
/** 图片类别: cover/main_product/product/sketch/apparel */
|
||||||
@@ -35,6 +40,7 @@ public class ListingImageEntity implements Serializable {
|
|||||||
private Integer isSelected;
|
private Integer isSelected;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,14 +58,6 @@ public interface ListingService extends IService<ListingEntity> {
|
|||||||
*/
|
*/
|
||||||
void updateStatus(Long id, Integer status, Long sellerId);
|
void updateStatus(Long id, Integer status, Long sellerId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新库存
|
|
||||||
*
|
|
||||||
* @param list 库存列表
|
|
||||||
* @param sellerId 卖家ID
|
|
||||||
*/
|
|
||||||
void batchUpdateStock(java.util.List<ListingStockDTO> list, Long sellerId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置弹窗提醒标志(7天过期)
|
* 设置弹窗提醒标志(7天过期)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class ListingServiceImpl extends ServiceImpl<ListingMapper, ListingEntity
|
|||||||
List<ListingImageDTO> imageDTOs = images.stream().map(img -> {
|
List<ListingImageDTO> imageDTOs = images.stream().map(img -> {
|
||||||
ListingImageDTO imgDto = new ListingImageDTO();
|
ListingImageDTO imgDto = new ListingImageDTO();
|
||||||
BeanUtils.copyProperties(img, imgDto);
|
BeanUtils.copyProperties(img, imgDto);
|
||||||
imgDto.setImageUrl(minioUtil.processMinioResource(imgDto.getImageUrl(),CommonConstants.MINIO_PATH_TIMEOUT));
|
imgDto.setImageUrl(minioUtil.processMinioResource(imgDto.getImageUrl(), CommonConstants.MINIO_PATH_TIMEOUT));
|
||||||
imgDto.setIsSelected(img.getIsSelected() != null && img.getIsSelected() == 1);
|
imgDto.setIsSelected(img.getIsSelected() != null && img.getIsSelected() == 1);
|
||||||
return imgDto;
|
return imgDto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@@ -187,26 +187,6 @@ public class ListingServiceImpl extends ServiceImpl<ListingMapper, ListingEntity
|
|||||||
this.updateById(update);
|
this.updateById(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void batchUpdateStock(List<ListingStockDTO> list, Long sellerId) {
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<Long> ids = list.stream().map(ListingStockDTO::getId).collect(Collectors.toList());
|
|
||||||
List<ListingEntity> existing = this.list(
|
|
||||||
new LambdaQueryWrapper<ListingEntity>()
|
|
||||||
.eq(ListingEntity::getSellerId, sellerId)
|
|
||||||
.in(ListingEntity::getId, ids));
|
|
||||||
if (existing.size() != ids.size()) {
|
|
||||||
throw new BusinessException("部分商品不存在或无权操作");
|
|
||||||
}
|
|
||||||
Map<Long, Integer> stockMap = list.stream()
|
|
||||||
.collect(Collectors.toMap(ListingStockDTO::getId, ListingStockDTO::getStock));
|
|
||||||
existing.forEach(e -> e.setStock(stockMap.get(e.getId())));
|
|
||||||
this.updateBatchById(existing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleImages(Long listingId, List<ListingImageDTO> images) {
|
private void handleImages(Long listingId, List<ListingImageDTO> images) {
|
||||||
Map<String, List<ListingImageDTO>> byCategory = images.stream()
|
Map<String, List<ListingImageDTO>> byCategory = images.stream()
|
||||||
.collect(Collectors.groupingBy(img -> img.getCategory() == null ? "" : img.getCategory()));
|
.collect(Collectors.groupingBy(img -> img.getCategory() == null ? "" : img.getCategory()));
|
||||||
@@ -224,18 +204,21 @@ public class ListingServiceImpl extends ServiceImpl<ListingMapper, ListingEntity
|
|||||||
|
|
||||||
for (int i = 0; i < categoryImages.size(); i++) {
|
for (int i = 0; i < categoryImages.size(); i++) {
|
||||||
ListingImageDTO imgDto = categoryImages.get(i);
|
ListingImageDTO imgDto = categoryImages.get(i);
|
||||||
ListingImageEntity imgEntity = new ListingImageEntity();
|
if (imgDto.getImageUrl() != null && !imgDto.getImageUrl().isEmpty()) {
|
||||||
imgEntity.setListingId(listingId);
|
ListingImageEntity imgEntity = new ListingImageEntity();
|
||||||
imgEntity.setCategory(category);
|
imgEntity.setListingId(listingId);
|
||||||
imgEntity.setImageUrl(minioUtil.convertToLogicalPath(imgDto.getImageUrl()));
|
imgEntity.setCategory(category);
|
||||||
imgEntity.setSortOrder(imgDto.getSortOrder() != null ? imgDto.getSortOrder() : i);
|
|
||||||
|
|
||||||
if (supportsSelection) {
|
imgEntity.setImageUrl(minioUtil.convertToLogicalPath(imgDto.getImageUrl()));
|
||||||
imgEntity.setIsSelected(Boolean.TRUE.equals(imgDto.getIsSelected()) ? 1 : 0);
|
imgEntity.setSortOrder(imgDto.getSortOrder() != null ? imgDto.getSortOrder() : i);
|
||||||
} else {
|
|
||||||
imgEntity.setIsSelected(0);
|
if (supportsSelection) {
|
||||||
|
imgEntity.setIsSelected(Boolean.TRUE.equals(imgDto.getIsSelected()) ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
imgEntity.setIsSelected(0);
|
||||||
|
}
|
||||||
|
listingImageMapper.insert(imgEntity);
|
||||||
}
|
}
|
||||||
listingImageMapper.insert(imgEntity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.listing.vo;
|
package com.aida.seller.module.listing.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -15,6 +17,7 @@ public class ListingPageVO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 商品ID */
|
/** 商品ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 封面图URL(列表页直返,无须关联图片表) */
|
/** 封面图URL(列表页直返,无须关联图片表) */
|
||||||
@@ -26,8 +29,8 @@ public class ListingPageVO implements Serializable {
|
|||||||
/** 价格 */
|
/** 价格 */
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/** 库存 */
|
/** 销量 */
|
||||||
private Integer stock;
|
private Integer salesVolume;
|
||||||
|
|
||||||
/** 浏览量 */
|
/** 浏览量 */
|
||||||
private Integer viewCount;
|
private Integer viewCount;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.aida.seller.module.order.entity;
|
package com.aida.seller.module.order.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -17,6 +19,7 @@ public class OrderInfoEntity implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 卖家ID */
|
/** 卖家ID */
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.aida.seller.module.order.entity;
|
package com.aida.seller.module.order.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -18,12 +20,15 @@ public class OrderItemEntity implements Serializable {
|
|||||||
|
|
||||||
/** 主键ID */
|
/** 主键ID */
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 订单ID(关联 seller_orders) */
|
/** 订单ID(关联 seller_orders) */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
|
|
||||||
/** 商品ID */
|
/** 商品ID */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
/** 商品名称 */
|
/** 商品名称 */
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aida.seller.module.order.vo;
|
package com.aida.seller.module.order.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ public class OrderVO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "订单唯一标识")
|
@Schema(description = "订单唯一标识")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
|
|
||||||
@Schema(description = "商品明细列表")
|
@Schema(description = "商品明细列表")
|
||||||
@@ -36,6 +39,7 @@ public class OrderVO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "商品ID")
|
@Schema(description = "商品ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
@Schema(description = "商品名")
|
@Schema(description = "商品名")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
nacos:
|
nacos:
|
||||||
namespace: ltx
|
namespace: dev
|
||||||
host: 18.167.251.121:28848
|
host: 18.167.251.121:28848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: Aidlab123123!
|
password: Aidlab123123!
|
||||||
@@ -22,7 +22,8 @@ spring:
|
|||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
username: ${nacos.username}
|
username: ${nacos.username}
|
||||||
password: ${nacos.password}
|
password: ${nacos.password}
|
||||||
hostname: master-aida-seller
|
# ip: ${HOSTNAME}
|
||||||
|
# hostname: master-aida-seller
|
||||||
config:
|
config:
|
||||||
server-addr: ${nacos.host}
|
server-addr: ${nacos.host}
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
|
|||||||
Reference in New Issue
Block a user