- 后端:临时解决 Dubbo 内嵌在 Spring Boot 时,对本地的 Dubbo Service 引用报错的问题。
- 前端:完善商品推荐 - 前端:完善优惠劵
This commit is contained in:
@@ -12,6 +12,12 @@
|
||||
<artifactId>promotion-application</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>promotion-service-api</artifactId>
|
||||
@@ -22,13 +28,6 @@
|
||||
<artifactId>promotion-service-impl</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-service-api</artifactId>
|
||||
|
||||
@@ -39,11 +39,11 @@ public class MVCConfiguration implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 用户
|
||||
// registry.addInterceptor(userAccessLogInterceptor).addPathPatterns("/users/**");
|
||||
// registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口
|
||||
registry.addInterceptor(userAccessLogInterceptor).addPathPatterns("/users/**");
|
||||
registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口
|
||||
// 管理员
|
||||
// registry.addInterceptor(adminAccessLogInterceptor).addPathPatterns("/admins/**");
|
||||
// registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**");
|
||||
registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,12 +10,11 @@ import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
@@ -25,8 +24,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
@Api("Banner 模块")
|
||||
public class AdminsBannerController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||
private BannerService bannerService;
|
||||
|
||||
@GetMapping("/page")
|
||||
|
||||
@@ -12,12 +12,11 @@ import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -28,8 +27,7 @@ import java.util.Date;
|
||||
@Api("优惠劵(码)模块")
|
||||
public class AdminsCouponController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||
private CouponService couponService;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@@ -18,7 +18,6 @@ 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;
|
||||
@@ -32,10 +31,9 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
@Api("商品推荐模块")
|
||||
public class AdminsProductRecommendController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||
private ProductRecommendService productRecommendService;
|
||||
@Reference(validation = "true", version = "*", lazy = true)
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/page")
|
||||
|
||||
@@ -7,10 +7,9 @@ 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 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.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;
|
||||
@@ -23,8 +22,7 @@ import java.util.List;
|
||||
@Api("Banner 模块")
|
||||
public class UsersBannerController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||
private BannerService bannerService;
|
||||
|
||||
@GetMapping("/list")
|
||||
|
||||
@@ -13,12 +13,11 @@ import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
|
||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@@ -26,8 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Api("优惠劵(码)模块")
|
||||
public class UsersCouponController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||
private CouponService couponService;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@@ -9,12 +9,11 @@ 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 cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
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.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;
|
||||
@@ -30,11 +29,9 @@ import java.util.stream.Collectors;
|
||||
@Api("商品推荐模块")
|
||||
public class UsersProductRecommendController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||
private ProductRecommendService productRecommendService;
|
||||
|
||||
@Reference(validation = "true", version = "1.0.0")
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/list")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.mall.promotion.api;
|
||||
|
||||
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
||||
@@ -16,12 +17,12 @@ public interface ProductRecommendService {
|
||||
|
||||
ProductRecommendPageBO getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO);
|
||||
|
||||
ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO);
|
||||
ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO) throws ServiceException;
|
||||
|
||||
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO);
|
||||
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO) throws ServiceException;
|
||||
|
||||
Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId,
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status) throws ServiceException;
|
||||
|
||||
Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId);
|
||||
|
||||
|
||||
@@ -7,13 +7,14 @@ import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerAddDTO {
|
||||
public class BannerAddDTO implements Serializable {
|
||||
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||
|
||||
@@ -4,13 +4,14 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerPageDTO {
|
||||
public class BannerPageDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 标题,模糊匹配
|
||||
|
||||
@@ -7,13 +7,14 @@ import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Banner 更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerUpdateDTO {
|
||||
public class BannerUpdateDTO implements Serializable {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
@@ -4,13 +4,14 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardPageDTO {
|
||||
public class CouponCardPageDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -19,7 +20,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateAddDTO {
|
||||
public class CouponCardTemplateAddDTO implements Serializable {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
|
||||
@@ -9,13 +9,14 @@ import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵模板更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCardTemplateUpdateDTO {
|
||||
public class CouponCardTemplateUpdateDTO implements Serializable {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
@@ -3,10 +3,12 @@ package cn.iocoder.mall.promotion.api.dto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠码模板添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCodeTemplateAddDTO {
|
||||
public class CouponCodeTemplateAddDTO implements Serializable {
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package cn.iocoder.mall.promotion.api.dto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠码模板更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponCodeTemplateUpdateDTO {
|
||||
public class CouponCodeTemplateUpdateDTO implements Serializable {
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 优惠劵模板分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CouponTemplatePageDTO {
|
||||
public class CouponTemplatePageDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
@@ -7,13 +7,14 @@ import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐添加 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendAddDTO {
|
||||
public class ProductRecommendAddDTO implements Serializable {
|
||||
|
||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
|
||||
@NotNull(message = "推荐类型不能为空")
|
||||
|
||||
@@ -4,13 +4,14 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendPageDTO {
|
||||
public class ProductRecommendPageDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 推荐类型
|
||||
|
||||
@@ -7,13 +7,14 @@ import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品推荐更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductRecommendUpdateDTO {
|
||||
public class ProductRecommendUpdateDTO implements Serializable {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
@@ -38,9 +38,7 @@ public class CouponTemplateDO extends BaseDO {
|
||||
/**
|
||||
* 优惠码状态
|
||||
*
|
||||
* 1-开启中
|
||||
* 2-禁用中
|
||||
* 3-已过期
|
||||
* {@link cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum}
|
||||
*
|
||||
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||
public class BannerServiceImpl implements BannerService {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -24,7 +24,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 = "${dubbo.provider.CouponService.version}")
|
||||
public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -22,10 +22,10 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||
public class ProductRecommendServiceImpl implements ProductRecommendService {
|
||||
|
||||
@Reference(validation = "true", version = "1.0.0")
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.PromotionActivityService.version}")
|
||||
public class PromotionActivityServiceImpl implements PromotionActivityService {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -23,8 +23,21 @@ dubbo:
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.promotion.biz.service
|
||||
consumer:
|
||||
ProductSpuService:
|
||||
version: 1.0.0
|
||||
provider:
|
||||
BannerService:
|
||||
version: 1.0.0
|
||||
CouponService:
|
||||
version: 1.0.0
|
||||
ProductRecommendService:
|
||||
version: 1.0.0
|
||||
PromotionActivityService:
|
||||
version: 1.0.0
|
||||
|
||||
|
||||
# logging
|
||||
logging:
|
||||
level:
|
||||
cn.iocoder.mall.promotion.dao: debug
|
||||
cn.iocoder.mall.promotion.dao: debug
|
||||
|
||||
Reference in New Issue
Block a user