Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
709b85e4
提交
709b85e4
authored
8月 25, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Banner 的迁移
商品推荐的迁移
上级
f0999eac
全部展开
显示空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
239 行增加
和
323 行删除
+239
-323
CustomSentryAutoConfiguration.java
...der/mall/sentry/config/CustomSentryAutoConfiguration.java
+1
-0
CommonWebAutoConfiguration.java
...n/iocoder/mall/web/config/CommonWebAutoConfiguration.java
+2
-1
mall_admin.sql
docs/sql/old/mall_admin.sql
+0
-0
mall_product.sql
docs/sql/old/mall_product.sql
+0
-0
mall_promotion.sql
docs/sql/old/mall_promotion.sql
+0
-0
mall_user.sql
docs/sql/old/mall_user.sql
+0
-0
pom.xml
management-web-app/pom.xml
+5
-12
application.yml
management-web-app/src/main/resources/application.yml
+5
-0
BannerListReqDTO.java
...r/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java
+2
-5
pom.xml
promotion/pom.xml
+0
-39
AdminsProductRecommendController.java
...n/controller/admins/AdminsProductRecommendController.java
+0
-103
UsersBannerController.java
...n/application/controller/users/UsersBannerController.java
+0
-38
UsersProductRecommendController.java
...ion/controller/users/UsersProductRecommendController.java
+0
-54
AdminsProductRecommendVO.java
...otion/application/vo/admins/AdminsProductRecommendVO.java
+0
-34
UsersProductRecommendVO.java
...omotion/application/vo/users/UsersProductRecommendVO.java
+0
-34
BannerController.java
...r/mall/shopweb/controller/promotion/BannerController.java
+33
-0
ProductRecommendController.java
...pweb/controller/promotion/ProductRecommendController.java
+34
-0
BannerRespVO.java
...l/shopweb/controller/promotion/vo/brand/BannerRespVO.java
+3
-3
BannerConvert.java
...iocoder/mall/shopweb/convert/promotion/BannerConvert.java
+17
-0
ProductRecommendConvert.java
...ll/shopweb/convert/promotion/ProductRecommendConvert.java
+15
-0
BannerManager.java
...iocoder/mall/shopweb/manager/promotion/BannerManager.java
+37
-0
ProductRecommendManager.java
...ll/shopweb/manager/promotion/ProductRecommendManager.java
+58
-0
application.yml
shop-web-app/src/main/resources/application.yml
+4
-0
pom.xml
user-web-app/pom.xml
+18
-0
application.yml
user-web-app/src/main/resources/application.yml
+5
-0
没有找到文件。
common/mall-spring-boot-starter-sentry/src/main/java/cn/iocoder/mall/sentry/config/CustomSentryAutoConfiguration.java
浏览文件 @
709b85e4
...
@@ -35,4 +35,5 @@ public class CustomSentryAutoConfiguration {
...
@@ -35,4 +35,5 @@ public class CustomSentryAutoConfiguration {
public
SentryExceptionResolver
doNothingExceptionResolver
()
{
public
SentryExceptionResolver
doNothingExceptionResolver
()
{
return
new
DoNothingExceptionResolver
();
return
new
DoNothingExceptionResolver
();
}
}
}
}
common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/config/CommonWebAutoConfiguration.java
浏览文件 @
709b85e4
...
@@ -84,7 +84,8 @@ public class CommonWebAutoConfiguration implements WebMvcConfigurer {
...
@@ -84,7 +84,8 @@ public class CommonWebAutoConfiguration implements WebMvcConfigurer {
// 自定义 FastJson 配置
// 自定义 FastJson 配置
FastJsonConfig
fastJsonConfig
=
new
FastJsonConfig
();
FastJsonConfig
fastJsonConfig
=
new
FastJsonConfig
();
fastJsonConfig
.
setCharset
(
Charset
.
defaultCharset
());
// 设置字符集
fastJsonConfig
.
setCharset
(
Charset
.
defaultCharset
());
// 设置字符集
fastJsonConfig
.
setSerializerFeatures
(
SerializerFeature
.
DisableCircularReferenceDetect
);
// 剔除循环引用
fastJsonConfig
.
setSerializerFeatures
(
SerializerFeature
.
DisableCircularReferenceDetect
,
// 剔除循环引用
SerializerFeature
.
WriteNonStringKeyAsString
);
// 解决 Integer 作为 Key 时,转换为 String 类型,避免浏览器报错
fastJsonHttpMessageConverter
.
setFastJsonConfig
(
fastJsonConfig
);
fastJsonHttpMessageConverter
.
setFastJsonConfig
(
fastJsonConfig
);
// 设置支持的 MediaType
// 设置支持的 MediaType
fastJsonHttpMessageConverter
.
setSupportedMediaTypes
(
Collections
.
singletonList
(
MediaType
.
APPLICATION_JSON
));
fastJsonHttpMessageConverter
.
setSupportedMediaTypes
(
Collections
.
singletonList
(
MediaType
.
APPLICATION_JSON
));
...
...
docs/sql/old/mall_admin.sql
deleted
100644 → 0
浏览文件 @
f0999eac
差异被折叠。
点击展开。
docs/sql/old/mall_product.sql
deleted
100644 → 0
浏览文件 @
f0999eac
差异被折叠。
点击展开。
docs/sql/old/mall_promotion.sql
deleted
100644 → 0
浏览文件 @
f0999eac
差异被折叠。
点击展开。
docs/sql/old/mall_user.sql
deleted
100644 → 0
浏览文件 @
f0999eac
差异被折叠。
点击展开。
management-web-app/pom.xml
浏览文件 @
709b85e4
...
@@ -77,20 +77,13 @@
...
@@ -77,20 +77,13 @@
<dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>nacos-client</artifactId>-->
<!-- <groupId>com.alibaba.nacos</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
</dependency>
<!-- TODO 芋艿 解决 1.3.1 beta 的问题 -->
<!-- 监控相关 -->
<!-- <dependency>-->
<dependency>
<!-- <groupId>com.alibaba.nacos</groupId>-->
<groupId>
org.springframework.boot
</groupId>
<!-- <artifactId>nacos-client</artifactId>-->
<artifactId>
spring-boot-starter-actuator
</artifactId>
<!-- <version>1.3.1</version>-->
</dependency>
<!-- </dependency>-->
<!-- 工具类相关 -->
<!-- 工具类相关 -->
<dependency>
<dependency>
...
...
management-web-app/src/main/resources/application.yml
浏览文件 @
709b85e4
...
@@ -72,3 +72,8 @@ swagger:
...
@@ -72,3 +72,8 @@ swagger:
description
:
提供管理员管理的所有功能
description
:
提供管理员管理的所有功能
version
:
1.0.0
version
:
1.0.0
base-package
:
cn.iocoder.mall.managementweb.controller
base-package
:
cn.iocoder.mall.managementweb.controller
# Actuator 监控配置项
management
:
server.port
:
38087
# 独立端口,避免被暴露出去
endpoints.web.exposure.include
:
'
*'
# 暴露所有监控端点
promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java
浏览文件 @
709b85e4
...
@@ -2,20 +2,17 @@ package cn.iocoder.mall.promotion.api.rpc.banner.dto;
...
@@ -2,20 +2,17 @@ package cn.iocoder.mall.promotion.api.rpc.banner.dto;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.PageParam
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java
x.validation.constraints.NotNull
;
import
java
.io.Serializable
;
/**
/**
* Banner 列表 Request DTO
* Banner 列表 Request DTO
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
BannerListReqDTO
extends
PageParam
{
public
class
BannerListReqDTO
implements
Serializable
{
/**
/**
* 状态
* 状态
...
...
promotion/pom.xml
deleted
100644 → 0
浏览文件 @
f0999eac
<?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"
>
<parent>
<artifactId>
onemall
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
promotion
</artifactId>
<packaging>
pom
</packaging>
<modules>
<module>
promotion-application
</module>
<module>
promotion-biz
</module>
<module>
promotion-biz-api
</module>
<module>
promotion-rpc-api
</module>
<module>
promotion-rpc
</module>
<module>
promotion-rest
</module>
<!-- <module>promotion-service-api</module>-->
<!-- <module>promotion-service-impl</module>-->
<!-- <module>promotion-start</module>-->
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-dependencies
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java
deleted
100644 → 0
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.ProductSpuService
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.promotion.api.ProductRecommendService
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendPageDTO
;
import
cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO
;
import
cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO
;
import
cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO
;
import
cn.iocoder.mall.security.core.context.AdminSecurityContextHolder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"admins/product_recommend"
)
@Api
(
"商品推荐模块"
)
public
class
AdminsProductRecommendController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductRecommendService.version}"
)
private
ProductRecommendService
productRecommendService
;
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.consumer.ProductSpuService.version}"
)
private
ProductSpuService
productSpuService
;
@GetMapping
(
"/page"
)
@ApiOperation
(
value
=
"商品推荐分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"type"
,
value
=
"推荐类型"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 1 开始"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页条数"
,
required
=
true
,
example
=
"10"
),
})
public
CommonResult
<
AdminsProductRecommendPageVO
>
page
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
ProductRecommendPageBO
result
=
productRecommendService
.
getProductRecommendPage
(
new
ProductRecommendPageDTO
().
setType
(
type
).
setPageNo
(
pageNo
).
setPageSize
(
pageSize
));
// 获得商品集合
List
<
ProductSpuBO
>
spus
=
productSpuService
.
getProductSpuList
(
result
.
getList
().
stream
().
map
(
ProductRecommendBO:
:
getProductSpuId
).
collect
(
Collectors
.
toSet
()));
Map
<
Integer
,
ProductSpuBO
>
spuMap
=
spus
.
stream
().
collect
(
Collectors
.
toMap
(
ProductSpuBO:
:
getId
,
account
->
account
));
// 拼装结果
AdminsProductRecommendPageVO
response
=
ProductRecommendConvert
.
INSTANCE
.
convert
(
result
);
response
.
getList
().
forEach
(
recommendVO
->
recommendVO
.
setProductSpuName
(
spuMap
.
get
(
recommendVO
.
getProductSpuId
()).
getName
()));
return
CommonResult
.
success
(
response
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建商品推荐"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"type"
,
value
=
"推荐类型"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"productSpuId"
,
value
=
"商品编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"10"
),
@ApiImplicitParam
(
name
=
"memo"
,
value
=
"备注"
,
example
=
"活动很牛逼"
),
})
public
CommonResult
<
AdminsProductRecommendVO
>
add
(
@RequestParam
(
"type"
)
Integer
type
,
@RequestParam
(
"productSpuId"
)
Integer
productSpuId
,
@RequestParam
(
"sort"
)
Integer
sort
,
@RequestParam
(
value
=
"memo"
,
required
=
false
)
String
memo
)
{
ProductRecommendAddDTO
bannerAddDTO
=
new
ProductRecommendAddDTO
().
setType
(
type
).
setProductSpuId
(
productSpuId
)
.
setSort
(
sort
).
setMemo
(
memo
);
return
success
(
ProductRecommendConvert
.
INSTANCE
.
convert
(
productRecommendService
.
addProductRecommend
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerAddDTO
)));
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新商品推荐"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品推荐编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"推荐类型"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"productSpuId"
,
value
=
"商品编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"10"
),
@ApiImplicitParam
(
name
=
"memo"
,
value
=
"备注"
,
example
=
"活动很牛逼"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"type"
)
Integer
type
,
@RequestParam
(
"productSpuId"
)
Integer
productSpuId
,
@RequestParam
(
"sort"
)
Integer
sort
,
@RequestParam
(
value
=
"memo"
,
required
=
false
)
String
memo
)
{
ProductRecommendUpdateDTO
bannerUpdateDTO
=
new
ProductRecommendUpdateDTO
().
setId
(
id
).
setType
(
type
).
setProductSpuId
(
productSpuId
)
.
setSort
(
sort
).
setMemo
(
memo
);
return
success
(
productRecommendService
.
updateProductRecommend
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
bannerUpdateDTO
));
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除商品推荐"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品推荐编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
success
(
productRecommendService
.
deleteProductRecommend
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
));
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
deleted
100644 → 0
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
controller
.
users
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.BannerService
;
import
cn.iocoder.mall.promotion.api.bo.BannerBO
;
import
cn.iocoder.mall.promotion.application.convert.BannerConvert
;
import
cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Comparator
;
import
java.util.List
;
@RestController
@RequestMapping
(
"users/banner"
)
@Api
(
"Banner 模块"
)
public
class
UsersBannerController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.BannerService.version}"
)
private
BannerService
bannerService
;
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得所有 Banner 列表"
)
public
CommonResult
<
List
<
UsersBannerVO
>>
list
()
{
// 查询 Banner 列表
List
<
BannerBO
>
result
=
bannerService
.
getBannerListByStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
());
// 排序,按照 sort 升序
result
.
sort
(
Comparator
.
comparing
(
BannerBO:
:
getSort
));
// 返回
return
CommonResult
.
success
(
BannerConvert
.
USERS
.
convertList
(
result
));
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
deleted
100644 → 0
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
controller
.
users
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.ProductSpuService
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.promotion.api.ProductRecommendService
;
import
cn.iocoder.mall.promotion.api.bo.ProductRecommendBO
;
import
cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert
;
import
cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.Multimap
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"users/product_recommend"
)
@Api
(
"商品推荐模块"
)
public
class
UsersProductRecommendController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductRecommendService.version}"
)
private
ProductRecommendService
productRecommendService
;
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.consumer.ProductSpuService.version}"
)
private
ProductSpuService
productSpuService
;
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得所有 Banner 列表"
)
public
CommonResult
<
Map
<
Integer
,
Collection
<
UsersProductRecommendVO
>>>
list
()
{
// 查询商品推荐列表
List
<
ProductRecommendBO
>
productRecommends
=
productRecommendService
.
getProductRecommendList
(
null
,
CommonStatusEnum
.
ENABLE
.
getValue
());
// 获得商品集合
List
<
ProductSpuBO
>
spus
=
productSpuService
.
getProductSpuList
(
productRecommends
.
stream
().
map
(
ProductRecommendBO:
:
getProductSpuId
).
collect
(
Collectors
.
toSet
()));
Map
<
Integer
,
ProductSpuBO
>
spuMap
=
spus
.
stream
().
collect
(
Collectors
.
toMap
(
ProductSpuBO:
:
getId
,
account
->
account
));
// 组合结果,返回
Multimap
<
Integer
,
UsersProductRecommendVO
>
result
=
HashMultimap
.
create
();
productRecommends
.
sort
(
Comparator
.
comparing
(
ProductRecommendBO:
:
getSort
));
// 排序,按照 sort 升序
productRecommends
.
forEach
(
productRecommendBO
->
result
.
put
(
productRecommendBO
.
getType
(),
ProductRecommendConvert
.
INSTANCE
.
convert
(
spuMap
.
get
(
productRecommendBO
.
getProductSpuId
()))));
// 将 ProductSpuBO 添加到 results 中
return
CommonResult
.
success
(
result
.
asMap
());
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsProductRecommendVO.java
deleted
100644 → 0
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
@ApiModel
(
"商品推荐 VO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminsProductRecommendVO
{
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"推荐类型"
,
required
=
true
,
example
=
"1"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"商品编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
productSpuId
;
@ApiModelProperty
(
value
=
"排序"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
true
,
example
=
"这个活动很牛逼"
)
private
String
memo
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
private
Date
createTime
;
// ========== 基本信息 =========
@ApiModelProperty
(
value
=
"SPU 名字"
,
required
=
true
,
example
=
"厮大牛逼"
)
private
String
productSpuName
;
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/users/UsersProductRecommendVO.java
deleted
100644 → 0
浏览文件 @
f0999eac
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
vo
.
users
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@ApiModel
(
value
=
"商品推荐 VO"
,
description
=
"不包括 SKU 信息 VO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
UsersProductRecommendVO
{
@ApiModelProperty
(
value
=
"商品 SPU 编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
// ========== 基本信息 =========
@ApiModelProperty
(
value
=
"SPU 名字"
,
required
=
true
,
example
=
"厮大牛逼"
)
private
String
name
;
@ApiModelProperty
(
value
=
"卖点"
,
required
=
true
,
example
=
"各种 MQ 骚操作"
)
private
String
sellPoint
;
@ApiModelProperty
(
value
=
"商品主图地址的数组"
,
required
=
true
,
example
=
"http://www.iocoder.cn"
)
private
List
<
String
>
picUrls
;
// ========== Sku 相关字段 =========
/**
* 价格
*
* 目前的计算方式是,以 Sku 最小价格为准
*/
private
Integer
price
;
}
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/BannerController.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
controller
.
promotion
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.shopweb.controller.promotion.vo.brand.BannerRespVO
;
import
cn.iocoder.mall.shopweb.manager.promotion.BannerManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"/promotion/banner"
)
@Api
(
tags
=
"Banner API"
)
@Validated
public
class
BannerController
{
@Autowired
private
BannerManager
bannerManager
;
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得所有 Banner 列表"
)
public
CommonResult
<
List
<
BannerRespVO
>>
listBanners
()
{
return
success
(
bannerManager
.
listBanners
());
}
}
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/ProductRecommendController.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
controller
.
promotion
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO
;
import
cn.iocoder.mall.shopweb.manager.promotion.ProductRecommendManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Collection
;
import
java.util.Map
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"/promotion/product-recommend"
)
@Api
(
tags
=
"商品推荐 API"
)
@Validated
public
class
ProductRecommendController
{
@Autowired
private
ProductRecommendManager
productRecommendManager
;
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得所有商品推荐列表"
)
public
CommonResult
<
Map
<
Integer
,
Collection
<
ProductSpuRespVO
>>>
list
()
{
return
success
(
productRecommendManager
.
listProductRecommends
());
}
}
promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/users/UsersBanner
VO.java
→
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/vo/brand/BannerResp
VO.java
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
promotion
.
application
.
vo
.
users
;
package
cn
.
iocoder
.
mall
.
shopweb
.
controller
.
promotion
.
vo
.
brand
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
@ApiModel
(
"Banner VO"
)
@ApiModel
(
"Banner
Response
VO"
)
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
UsersBanner
VO
{
public
class
BannerResp
VO
{
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.baidu.com"
)
@ApiModelProperty
(
value
=
"跳转链接"
,
required
=
true
,
example
=
"http://www.baidu.com"
)
private
String
url
;
private
String
url
;
...
...
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/BannerConvert.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
convert
.
promotion
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
cn.iocoder.mall.shopweb.controller.promotion.vo.brand.BannerRespVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
BannerConvert
{
BannerConvert
INSTANCE
=
Mappers
.
getMapper
(
BannerConvert
.
class
);
List
<
BannerRespVO
>
convertList
(
List
<
BannerRespDTO
>
list
);
}
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/ProductRecommendConvert.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
convert
.
promotion
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO
;
import
cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductRecommendConvert
{
ProductRecommendConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductRecommendConvert
.
class
);
ProductSpuRespVO
convert
(
ProductSpuRespDTO
bean
);
}
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/manager/promotion/BannerManager.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
manager
.
promotion
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.promotion.api.rpc.banner.BannerRpc
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerListReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO
;
import
cn.iocoder.mall.shopweb.controller.promotion.vo.brand.BannerRespVO
;
import
cn.iocoder.mall.shopweb.convert.promotion.BannerConvert
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.Comparator
;
import
java.util.List
;
/**
* Banner Manager
*/
@Service
@Validated
public
class
BannerManager
{
@DubboReference
(
version
=
"${dubbo.consumer.BannerRpc.version}"
)
private
BannerRpc
bannerRpc
;
public
List
<
BannerRespVO
>
listBanners
()
{
// 获取 Banner 列表
CommonResult
<
List
<
BannerRespDTO
>>
listBannersResult
=
bannerRpc
.
listBanners
(
new
BannerListReqDTO
().
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
()));
listBannersResult
.
checkError
();
// 排序返回
listBannersResult
.
getData
().
sort
(
Comparator
.
comparing
(
BannerRespDTO:
:
getSort
));
return
BannerConvert
.
INSTANCE
.
convertList
(
listBannersResult
.
getData
());
}
}
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/manager/promotion/ProductRecommendManager.java
0 → 100644
浏览文件 @
709b85e4
package
cn
.
iocoder
.
mall
.
shopweb
.
manager
.
promotion
;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.util.CollectionUtils
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.ProductRecommendRpc
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendListReqDTO
;
import
cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO
;
import
cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO
;
import
cn.iocoder.mall.shopweb.convert.promotion.ProductRecommendConvert
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.Multimap
;
import
org.apache.dubbo.config.annotation.DubboReference
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
/**
* 商品推荐 Manager
*/
@Service
@Validated
public
class
ProductRecommendManager
{
@DubboReference
(
version
=
"${dubbo.consumer.ProductRecommendRpc.version}"
)
private
ProductRecommendRpc
productRecommendRpc
;
@DubboReference
(
version
=
"${dubbo.consumer.ProductSpuRpc.version}"
)
private
ProductSpuRpc
productSpuRpc
;
public
Map
<
Integer
,
Collection
<
ProductSpuRespVO
>>
listProductRecommends
()
{
// 查询商品推荐列表
CommonResult
<
List
<
ProductRecommendRespDTO
>>
listProductRecommendsResult
=
productRecommendRpc
.
listProductRecommends
(
new
ProductRecommendListReqDTO
().
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
()));
listProductRecommendsResult
.
checkError
();
listProductRecommendsResult
.
getData
().
sort
(
Comparator
.
comparing
(
ProductRecommendRespDTO:
:
getSort
));
// 排序,按照 sort 升序
// 获得商品集合
Map
<
Integer
,
ProductSpuRespDTO
>
spuMap
=
this
.
getProductSkuMap
(
listProductRecommendsResult
.
getData
());
// 组合结果,返回
Multimap
<
Integer
,
ProductSpuRespVO
>
result
=
HashMultimap
.
create
();
listProductRecommendsResult
.
getData
().
forEach
(
productRecommendBO
->
result
.
put
(
productRecommendBO
.
getType
(),
ProductRecommendConvert
.
INSTANCE
.
convert
(
spuMap
.
get
(
productRecommendBO
.
getProductSpuId
()))));
return
result
.
asMap
();
}
private
Map
<
Integer
,
ProductSpuRespDTO
>
getProductSkuMap
(
List
<
ProductRecommendRespDTO
>
productRecommends
)
{
CommonResult
<
List
<
ProductSpuRespDTO
>>
listProductSpusResult
=
productSpuRpc
.
listProductSpus
(
CollectionUtils
.
convertSet
(
productRecommends
,
ProductRecommendRespDTO:
:
getProductSpuId
));
listProductSpusResult
.
checkError
();
return
CollectionUtils
.
convertMap
(
listProductSpusResult
.
getData
(),
ProductSpuRespDTO:
:
getId
);
}
}
shop-web-app/src/main/resources/application.yml
浏览文件 @
709b85e4
...
@@ -49,6 +49,10 @@ dubbo:
...
@@ -49,6 +49,10 @@ dubbo:
version
:
1.0.0
version
:
1.0.0
CouponTemplateRpc
:
CouponTemplateRpc
:
version
:
1.0.0
version
:
1.0.0
BannerRpc
:
version
:
1.0.0
ProductRecommendRpc
:
version
:
1.0.0
# Swagger 配置项
# Swagger 配置项
swagger
:
swagger
:
...
...
user-web-app/pom.xml
浏览文件 @
709b85e4
...
@@ -72,6 +72,12 @@
...
@@ -72,6 +72,12 @@
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
</dependency>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<!-- 工具类相关 -->
<!-- 工具类相关 -->
<dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<groupId>
org.projectlombok
</groupId>
...
@@ -89,4 +95,16 @@
...
@@ -89,4 +95,16 @@
</dependencies>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>
${project.artifactId}
</finalName>
<!-- 使用 spring-boot-maven-plugin 插件打包 -->
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
</project>
user-web-app/src/main/resources/application.yml
浏览文件 @
709b85e4
...
@@ -44,3 +44,8 @@ swagger:
...
@@ -44,3 +44,8 @@ swagger:
description
:
提供用户注册、登陆、信息等等 API
description
:
提供用户注册、登陆、信息等等 API
version
:
1.0.0
version
:
1.0.0
base-package
:
cn.iocoder.mall.userweb.controller
base-package
:
cn.iocoder.mall.userweb.controller
# Actuator 监控配置项
management
:
server.port
:
38086
# 独立端口,避免被暴露出去
endpoints.web.exposure.include
:
'
*'
# 暴露所有监控端点
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论