优惠改造
This commit is contained in:
@@ -7,7 +7,8 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.payservice.rpc"})
|
||||
@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.payservice.rpc"
|
||||
,"cn.iocoder.mall.promotion.api.rpc"})
|
||||
public class ManagementWebApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO;
|
||||
import cn.iocoder.mall.managementweb.convert.promotion.PromotionActivityConvert;
|
||||
import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityRpc;
|
||||
import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityFeign;
|
||||
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -17,11 +17,12 @@ import org.springframework.validation.annotation.Validated;
|
||||
@Validated
|
||||
public class PromotionActivityManager {
|
||||
|
||||
@DubboReference(version = "${dubbo.consumer.PromotionActivityRpc.version}")
|
||||
private PromotionActivityRpc promotionActivityRpc;
|
||||
|
||||
@Autowired
|
||||
private PromotionActivityFeign promotionActivityFeign;
|
||||
|
||||
public PageResult<PromotionActivityRespDTO> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) {
|
||||
CommonResult<PageResult<PromotionActivityRespDTO>> pagePromotionActivityResult = promotionActivityRpc.pagePromotionActivity(
|
||||
CommonResult<PageResult<PromotionActivityRespDTO>> pagePromotionActivityResult = promotionActivityFeign.pagePromotionActivity(
|
||||
PromotionActivityConvert.INSTANCE.convert(pageReqVO));
|
||||
pagePromotionActivityResult.checkError();
|
||||
return pagePromotionActivityResult.getData();
|
||||
|
||||
@@ -7,9 +7,9 @@ import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReq
|
||||
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO;
|
||||
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO;
|
||||
import cn.iocoder.mall.managementweb.convert.promotion.BannerConvert;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.BannerRpc;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.BannerFeign;
|
||||
import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -18,8 +18,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class BannerManager {
|
||||
|
||||
@DubboReference(version = "${dubbo.consumer.BannerRpc.version}")
|
||||
private BannerRpc bannerRpc;
|
||||
@Autowired
|
||||
private BannerFeign bannerFeign;
|
||||
|
||||
/**
|
||||
* 创建 Banner
|
||||
@@ -28,7 +28,7 @@ public class BannerManager {
|
||||
* @return Banner
|
||||
*/
|
||||
public Integer createBanner(BannerCreateReqVO createVO) {
|
||||
CommonResult<Integer> createBannerResult = bannerRpc.createBanner(BannerConvert.INSTANCE.convert(createVO));
|
||||
CommonResult<Integer> createBannerResult = bannerFeign.createBanner(BannerConvert.INSTANCE.convert(createVO));
|
||||
createBannerResult.checkError();
|
||||
return createBannerResult.getData();
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class BannerManager {
|
||||
* @param updateVO 更新 Banner VO
|
||||
*/
|
||||
public void updateBanner(BannerUpdateReqVO updateVO) {
|
||||
CommonResult<Boolean> updateBannerResult = bannerRpc.updateBanner(BannerConvert.INSTANCE.convert(updateVO));
|
||||
CommonResult<Boolean> updateBannerResult = bannerFeign.updateBanner(BannerConvert.INSTANCE.convert(updateVO));
|
||||
updateBannerResult.checkError();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class BannerManager {
|
||||
* @param bannerId Banner 编号
|
||||
*/
|
||||
public void deleteBanner(Integer bannerId) {
|
||||
CommonResult<Boolean> deleteBannerResult = bannerRpc.deleteBanner(bannerId);
|
||||
CommonResult<Boolean> deleteBannerResult = bannerFeign.deleteBanner(bannerId);
|
||||
deleteBannerResult.checkError();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class BannerManager {
|
||||
* @return Banner 分页结果
|
||||
*/
|
||||
public PageResult<BannerRespVO> pageBanner(BannerPageReqVO pageVO) {
|
||||
CommonResult<PageResult<BannerRespDTO>> pageBannerResult = bannerRpc.pageBanner(BannerConvert.INSTANCE.convert(pageVO));
|
||||
CommonResult<PageResult<BannerRespDTO>> pageBannerResult = bannerFeign.pageBanner(BannerConvert.INSTANCE.convert(pageVO));
|
||||
pageBannerResult.checkError();
|
||||
return BannerConvert.INSTANCE.convertPage(pageBannerResult.getData());
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.Cou
|
||||
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO;
|
||||
import cn.iocoder.mall.managementweb.convert.promotion.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateRpc;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateFeign;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO;
|
||||
import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -18,20 +18,20 @@ import org.springframework.validation.annotation.Validated;
|
||||
@Validated
|
||||
public class CouponTemplateManager {
|
||||
|
||||
@DubboReference(version = "${dubbo.consumer.CouponTemplateRpc.version}")
|
||||
private CouponTemplateRpc couponTemplateRpc;
|
||||
|
||||
@Autowired
|
||||
private CouponTemplateFeign couponTemplateFeign;
|
||||
// ========== 通用逻辑 =========
|
||||
|
||||
public PageResult<CouponTemplateRespVO> pageCouponTemplate(CouponTemplatePageReqVO pageVO) {
|
||||
CommonResult<PageResult<CouponTemplateRespDTO>> pageCouponTemplateResult =
|
||||
couponTemplateRpc.pageCouponTemplate(CouponTemplateConvert.INSTANCE.convert(pageVO));
|
||||
couponTemplateFeign.pageCouponTemplate(CouponTemplateConvert.INSTANCE.convert(pageVO));
|
||||
pageCouponTemplateResult.checkError();
|
||||
return CouponTemplateConvert.INSTANCE.convertPage(pageCouponTemplateResult.getData());
|
||||
}
|
||||
|
||||
public void updateCouponTemplateStatus(Integer id, Integer status) {
|
||||
CommonResult<Boolean> updateCouponTemplateStatusResult = couponTemplateRpc.updateCouponTemplateStatus(
|
||||
CommonResult<Boolean> updateCouponTemplateStatusResult = couponTemplateFeign.updateCouponTemplateStatus(
|
||||
new CouponCardTemplateUpdateStatusReqDTO().setId(id).setStatus(status));
|
||||
updateCouponTemplateStatusResult.checkError();
|
||||
}
|
||||
@@ -39,14 +39,14 @@ public class CouponTemplateManager {
|
||||
// ========== 优惠劵模板 ==========
|
||||
|
||||
public Integer createCouponCardTemplate(CouponTemplateCardCreateReqVO createVO) {
|
||||
CommonResult<Integer> createCouponCardTemplateResult = couponTemplateRpc.createCouponCardTemplate(
|
||||
CommonResult<Integer> createCouponCardTemplateResult = couponTemplateFeign.createCouponCardTemplate(
|
||||
CouponTemplateConvert.INSTANCE.convert(createVO));
|
||||
createCouponCardTemplateResult.checkError();
|
||||
return createCouponCardTemplateResult.getData();
|
||||
}
|
||||
|
||||
public void updateCouponCardTemplate(CouponTemplateCardUpdateReqVO updateVO) {
|
||||
CommonResult<Boolean> updateCouponCardTemplateResult = couponTemplateRpc.updateCouponCardTemplate(
|
||||
CommonResult<Boolean> updateCouponCardTemplateResult = couponTemplateFeign.updateCouponCardTemplate(
|
||||
CouponTemplateConvert.INSTANCE.convert(updateVO));
|
||||
updateCouponCardTemplateResult.checkError();
|
||||
}
|
||||
|
||||
@@ -10,9 +10,8 @@ import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRe
|
||||
import cn.iocoder.mall.managementweb.convert.promotion.ProductRecommendConvert;
|
||||
import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign;
|
||||
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.ProductRecommendFeign;
|
||||
import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -27,8 +26,8 @@ import java.util.Map;
|
||||
@Validated
|
||||
public class ProductRecommendManager {
|
||||
|
||||
@DubboReference(version = "${dubbo.consumer.ProductRecommendRpc.version}")
|
||||
private ProductRecommendRpc productRecommendRpc;
|
||||
@Autowired
|
||||
private ProductRecommendFeign productRecommendFeign;
|
||||
@Autowired
|
||||
private ProductSpuFeign productSpuFeign;
|
||||
/**
|
||||
@@ -38,7 +37,7 @@ public class ProductRecommendManager {
|
||||
* @return 商品推荐
|
||||
*/
|
||||
public Integer createProductRecommend(ProductRecommendCreateReqVO createVO) {
|
||||
CommonResult<Integer> createProductRecommendResult = productRecommendRpc.createProductRecommend(
|
||||
CommonResult<Integer> createProductRecommendResult = productRecommendFeign.createProductRecommend(
|
||||
ProductRecommendConvert.INSTANCE.convert(createVO));
|
||||
createProductRecommendResult.checkError();
|
||||
return createProductRecommendResult.getData();
|
||||
@@ -50,7 +49,7 @@ public class ProductRecommendManager {
|
||||
* @param updateVO 更新商品推荐 VO
|
||||
*/
|
||||
public void updateProductRecommend(ProductRecommendUpdateReqVO updateVO) {
|
||||
CommonResult<Boolean> updateProductRecommendResult = productRecommendRpc.updateProductRecommend(
|
||||
CommonResult<Boolean> updateProductRecommendResult = productRecommendFeign.updateProductRecommend(
|
||||
ProductRecommendConvert.INSTANCE.convert(updateVO));
|
||||
updateProductRecommendResult.checkError();
|
||||
}
|
||||
@@ -61,7 +60,7 @@ public class ProductRecommendManager {
|
||||
* @param productRecommendId 商品推荐编号
|
||||
*/
|
||||
public void deleteProductRecommend(Integer productRecommendId) {
|
||||
CommonResult<Boolean> deleteProductRecommendResult = productRecommendRpc.deleteProductRecommend(productRecommendId);
|
||||
CommonResult<Boolean> deleteProductRecommendResult = productRecommendFeign.deleteProductRecommend(productRecommendId);
|
||||
deleteProductRecommendResult.checkError();
|
||||
}
|
||||
|
||||
@@ -72,7 +71,7 @@ public class ProductRecommendManager {
|
||||
* @return 商品推荐分页结果
|
||||
*/
|
||||
public PageResult<ProductRecommendDetailVO> pageProductRecommend(ProductRecommendPageReqVO pageVO) {
|
||||
CommonResult<PageResult<ProductRecommendRespDTO>> pageProductRecommendResult = productRecommendRpc.pageProductRecommend(ProductRecommendConvert.INSTANCE.convert(pageVO));
|
||||
CommonResult<PageResult<ProductRecommendRespDTO>> pageProductRecommendResult = productRecommendFeign.pageProductRecommend(ProductRecommendConvert.INSTANCE.convert(pageVO));
|
||||
pageProductRecommendResult.checkError();
|
||||
// 拼接结果
|
||||
PageResult<ProductRecommendDetailVO> pageResult = ProductRecommendConvert.INSTANCE.convertPage(pageProductRecommendResult.getData());
|
||||
|
||||
Reference in New Issue
Block a user