diff --git a/admin-web/src/pages/Promotion/ProductRecommendList.js b/admin-web/src/pages/Promotion/ProductRecommendList.js
index b4878dcff..ef673dd40 100644
--- a/admin-web/src/pages/Promotion/ProductRecommendList.js
+++ b/admin-web/src/pages/Promotion/ProductRecommendList.js
@@ -79,7 +79,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
},
{
title: '商品',
- dataIndex: 'productSpuId',
+ dataIndex: 'productSpuName',
},
{
title: '排序值',
@@ -103,7 +103,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
},
{
title: '操作',
- width: 360,
+ width: 200,
render: (text, record) => {
const statusText = record.status === 1 ? '禁用' : '开启'; // TODO 芋艿,此处要改
return (
diff --git a/docs/guides/功能列表/功能列表-管理后台.md b/docs/guides/功能列表/功能列表-管理后台.md
index e75d50734..22b0355e9 100644
--- a/docs/guides/功能列表/功能列表-管理后台.md
+++ b/docs/guides/功能列表/功能列表-管理后台.md
@@ -21,7 +21,7 @@
- [ ] 会员资料【待认领】
- TODO 需要补充
- [ ] 营销管理
- - [ ] 广告管理
+ - [x] 首页广告
- [ ] 优惠劵
- [ ] 优惠码【待认领】
- [ ] 商品推荐
diff --git a/pom.xml b/pom.xml
index 639edc5f5..3f0032429 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.1.4.RELEASE
+ 2.1.3.RELEASE
@@ -27,14 +27,15 @@
pom
- 2.1.4.RELEASE
+ 2.1.3.RELEASE
2.7.1
5.1.47
1.3.0.Final
-
2.13.0
+
+
2.9.2
2.0.0
2.0.1
@@ -100,12 +101,23 @@
org.apache.curator
curator-framework
${curator.version}
+
+
+
+
+
+
org.apache.curator
curator-recipes
${curator.version}
+
+
+
+
+
io.springfox
diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java
index fb46f965c..f26380892 100644
--- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java
+++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java
@@ -31,7 +31,7 @@ import java.util.*;
import java.util.stream.Collectors;
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
-@org.apache.dubbo.config.annotation.Service(validation = "true")
+@org.apache.dubbo.config.annotation.Service(validation = "true", version = "1.0.0")
public class ProductSpuServiceImpl implements ProductSpuService {
@Autowired
diff --git a/promotion/promotion-application/pom.xml b/promotion/promotion-application/pom.xml
index bc2afc061..95754bc52 100644
--- a/promotion/promotion-application/pom.xml
+++ b/promotion/promotion-application/pom.xml
@@ -39,7 +39,6 @@
user-sdk
1.0-SNAPSHOT
-
cn.iocoder.mall
system-sdk
@@ -56,20 +55,6 @@
test
-
- org.apache.dubbo
- dubbo
-
-
-
-
-
-
-
- org.apache.curator
- curator-framework
-
-
io.springfox
springfox-swagger2
@@ -78,6 +63,12 @@
io.springfox
springfox-swagger-ui
+
+ cn.iocoder.mall
+ product-service-api
+ 1.0-SNAPSHOT
+ compile
+
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java
index 3ac590887..8febe940d 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java
@@ -2,7 +2,10 @@ package cn.iocoder.mall.promotion.application.controller.admins;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
+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;
@@ -10,14 +13,20 @@ 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 org.apache.dubbo.config.annotation.Reference;
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.beans.factory.annotation.Autowired;
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("商品推荐模块")
@@ -26,6 +35,8 @@ public class AdminsProductRecommendController {
@Reference(validation = "true")
@Autowired
private ProductRecommendService productRecommendService;
+ @Reference(validation = "true", version = "*", lazy = true)
+ private ProductSpuService productSpuService;
@GetMapping("/page")
@ApiOperation(value = "商品推荐分页")
@@ -37,8 +48,15 @@ public class AdminsProductRecommendController {
public CommonResult page(@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
- CommonResult result = productRecommendService.getProductRecommendPage(new ProductRecommendPageDTO().setType(type).setPageNo(pageNo).setPageSize(pageSize));
- return ProductRecommendConvert.INSTANCE.convert(result);
+ ProductRecommendPageBO result = productRecommendService.getProductRecommendPage(new ProductRecommendPageDTO().setType(type).setPageNo(pageNo).setPageSize(pageSize));
+ // 获得商品集合
+ List spus = productSpuService.getProductSpuList(
+ result.getList().stream().map(ProductRecommendBO::getProductSpuId).collect(Collectors.toSet()));
+ Map 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")
@@ -55,7 +73,7 @@ public class AdminsProductRecommendController {
@RequestParam(value = "memo", required = false) String memo) {
ProductRecommendAddDTO bannerAddDTO = new ProductRecommendAddDTO().setType(type).setProductSpuId(productSpuId)
.setSort(sort).setMemo(memo);
- return ProductRecommendConvert.INSTANCE.convert2(productRecommendService.addProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerAddDTO));
+ return success(ProductRecommendConvert.INSTANCE.convert(productRecommendService.addProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerAddDTO)));
}
@PostMapping("/update")
@@ -74,7 +92,7 @@ public class AdminsProductRecommendController {
@RequestParam(value = "memo", required = false) String memo) {
ProductRecommendUpdateDTO bannerUpdateDTO = new ProductRecommendUpdateDTO().setId(id).setType(type).setProductSpuId(productSpuId)
.setSort(sort).setMemo(memo);
- return productRecommendService.updateProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerUpdateDTO);
+ return success(productRecommendService.updateProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerUpdateDTO));
}
@PostMapping("/update_status")
@@ -85,14 +103,14 @@ public class AdminsProductRecommendController {
})
public CommonResult updateStatus(@RequestParam("id") Integer id,
@RequestParam("status") Integer status) {
- return productRecommendService.updateProductRecommendStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status);
+ return success(productRecommendService.updateProductRecommendStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status));
}
@PostMapping("/delete")
@ApiOperation(value = "删除商品推荐")
@ApiImplicitParam(name = "id", value = "商品推荐编号", required = true, example = "1")
public CommonResult delete(@RequestParam("id") Integer id) {
- return productRecommendService.deleteProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), id);
+ return success(productRecommendService.deleteProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), id));
}
}
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
index 537aa46aa..d7ec8ec06 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersBannerController.java
@@ -10,6 +10,7 @@ import cn.iocoder.mall.user.sdk.annotation.PermitAll;
import org.apache.dubbo.config.annotation.Reference;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -23,6 +24,7 @@ import java.util.List;
public class UsersBannerController {
@Reference(validation = "true")
+ @Autowired
private BannerService bannerService;
@GetMapping("/list")
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
index f44dcbcaa..9a86a0ec5 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java
@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class UsersCouponController {
@Reference(validation = "true")
+ @Autowired
private CouponService couponService;
// ========== 优惠劵(码)模板 ==========
diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
index 0dd016e81..8cfe1c5d1 100644
--- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
+++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersProductRecommendController.java
@@ -14,6 +14,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -30,8 +31,10 @@ import java.util.stream.Collectors;
public class UsersProductRecommendController {
@Reference(validation = "true")
+ @Autowired
private ProductRecommendService productRecommendService;
- @Reference(validation = "true")
+
+ @Reference(validation = "true", version = "1.0.0")
private ProductSpuService productSpuService;
@GetMapping("/list")
@@ -40,7 +43,7 @@ public class UsersProductRecommendController {
public CommonResult