1. 商品信息变动刷新库存
2. 商品信息变动发生Mq消息
This commit is contained in:
@@ -17,4 +17,11 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-mq</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.czg.service.product.mapper;
|
||||
|
||||
import com.czg.product.dto.ProdConsRelationDTO;
|
||||
import com.czg.product.dto.ProductBriefDTO;
|
||||
import com.czg.product.entity.ProdConsRelation;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
@@ -19,4 +20,5 @@ public interface ProdConsRelationMapper extends BaseMapper<ProdConsRelation> {
|
||||
|
||||
List<ProductBriefDTO> getProductListByConId(@Param("conId") Long conId);
|
||||
|
||||
List<ProdConsRelationDTO> selectListByProdId(@Param("prodId") Long prodId);
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
import com.czg.constant.CacheConstant;
|
||||
import com.czg.product.dto.ProductStockSubtractDTO;
|
||||
import com.czg.product.entity.ConsInfo;
|
||||
@@ -49,6 +51,8 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
||||
|
||||
@Resource
|
||||
private ConsStockFlowMapper consStockFlowMapper;
|
||||
@Resource
|
||||
private RabbitPublisher rabbitPublisher;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -107,6 +111,7 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
||||
consStockFlowMapper.insert(consStockFlow);
|
||||
}
|
||||
}
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,5 +170,6 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
||||
consStockFlowMapper.insert(consStockFlow);
|
||||
}
|
||||
}
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
lowMemberPriceIsPresent.ifPresent(record::setLowMemberPrice);
|
||||
}
|
||||
record.setSkuList(skuList);
|
||||
List<ProdConsRelationDTO> consList = prodConsRelationMapper.selectListByQueryAs(query().eq(ProdConsRelation::getProductId, record.getId()), ProdConsRelationDTO.class);
|
||||
List<ProdConsRelationDTO> consList = prodConsRelationMapper.selectListByProdId(record.getId());
|
||||
record.setConsList(consList);
|
||||
if (CollUtil.isNotEmpty(consList)) {
|
||||
List<Long> consIds = consList.stream().map(ProdConsRelationDTO::getConsInfoId).distinct().toList();
|
||||
|
||||
@@ -11,4 +11,11 @@
|
||||
inner join tb_product t2 on t1.product_id = t2.id
|
||||
where t1.cons_info_id = #{conId}
|
||||
</select>
|
||||
<select id="selectListByProdId" resultType="com.czg.product.dto.ProdConsRelationDTO">
|
||||
SELECT t1.*,
|
||||
t2.con_unit
|
||||
FROM tb_prod_cons_relation t1
|
||||
LEFT JOIN tb_cons_info t2 on t1.cons_info_id = t2.id
|
||||
WHERE t1.product_id = #{prodId}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user