解决 product 报错的问题,修改成 product 服务依赖 user 服务

This commit is contained in:
YunaiV 2020-04-14 07:48:08 +08:00
parent 4dc0e6aead
commit 90391664cc
14 changed files with 47 additions and 38 deletions

View File

@ -2,8 +2,8 @@ package cn.iocoder.mall.product.application.controller.users;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.product.api.UserProductSpuCollectionsService;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.user.sdk.annotation.RequiresLogin;
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
import io.swagger.annotations.Api;

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.product.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsUpdateDTO;
/**
* UserProductSpuCollectionsService

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.user.api.bo;
package cn.iocoder.mall.product.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.user.api.bo;
package cn.iocoder.mall.product.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.user.api.dto;
package cn.iocoder.mall.product.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.user.api.dto;
package cn.iocoder.mall.product.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.user.api.dto;
package cn.iocoder.mall.product.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -18,6 +18,11 @@
<artifactId>product-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- DB 相关 -->
<dependency>

View File

@ -1,10 +1,10 @@
package cn.iocoder.mall.product.convert;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.product.api.message.ProductSpuCollectionMessage;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO;
import cn.iocoder.mall.product.dataobject.UserProductSpuCollectionsDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

View File

@ -1,6 +1,6 @@
package cn.iocoder.mall.product.dao;
import cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO;
import cn.iocoder.mall.product.dataobject.UserProductSpuCollectionsDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

View File

@ -2,16 +2,17 @@ package cn.iocoder.mall.product.message;
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.mall.product.api.UserProductSpuCollectionsService;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.product.api.message.ProductSpuCollectionMessage;
import cn.iocoder.mall.user.api.UserProductSpuCollectionsService;
import cn.iocoder.mall.product.convert.UserProductSpuCollectionsConvert;
import cn.iocoder.mall.user.api.UserService;
import cn.iocoder.mall.user.api.bo.UserBO;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.user.api.constant.UserErrorCodeEnum;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.user.biz.convert.UserProductSpuCollectionsConvert;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +34,7 @@ public class UserProductSpuCollectionsConsumer implements RocketMQListener<Produ
@Autowired
private UserProductSpuCollectionsService userProductSpuCollectionsService;
@Autowired
@Reference(validation = "true", version = "${dubbo.consumer.UserService.version}")
private UserService userService;
@Override

View File

@ -2,15 +2,15 @@ package cn.iocoder.mall.product.service;
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.user.api.UserProductSpuCollectionsService;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.user.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.user.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.user.biz.convert.UserProductSpuCollectionsConvert;
import cn.iocoder.mall.user.biz.dao.UserProductSpuCollectionsMapper;
import cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO;
import cn.iocoder.mall.product.api.UserProductSpuCollectionsService;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsPageBO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsPageDTO;
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsUpdateDTO;
import cn.iocoder.mall.product.convert.UserProductSpuCollectionsConvert;
import cn.iocoder.mall.product.dao.UserProductSpuCollectionsMapper;
import cn.iocoder.mall.product.dataobject.UserProductSpuCollectionsDO;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -44,7 +44,7 @@ dubbo:
address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
# Spring Cloud Alibaba Dubbo 专属配置
cloud:
subscribed-services: admin-application # 设置订阅的应用列表,默认为 * 订阅所有应用
subscribed-services: admin-application, user-application # 设置订阅的应用列表,默认为 * 订阅所有应用
# Dubbo 提供者的协议
protocol:
name: dubbo
@ -69,6 +69,9 @@ dubbo:
version: 1.0.0
UserProductSpuCollectionsService:
version: 1.0.0
consumer:
UserService:
version: 1.0.0
# Seata 配置项
seata:

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.user.biz.dao.UserProductSpuCollectionsMapper">
<mapper namespace="cn.iocoder.mall.product.dao.UserProductSpuCollectionsMapper">
<sql id="FIELDS">
id, user_id, nickname, spu_id, spu_name,
@ -8,7 +8,7 @@
deleted
</sql>
<select id="selectById" parameterType="Integer" resultType="cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO">
<select id="selectById" parameterType="Integer" resultType="UserProductSpuCollectionsDO">
SELECT
<include refid="FIELDS" />
FROM user_spu_collections
@ -17,7 +17,7 @@
</select>
<select id="selectListByUser" resultType="cn.iocoder.mall.user.biz.dataobject.UserProductSpuCollectionsDO">
<select id="selectListByUser" resultType="UserProductSpuCollectionsDO">
SELECT
<include refid="FIELDS" />
FROM user_spu_collections