1.推送校验耗材是否开启check

This commit is contained in:
SongZhang 2024-08-16 13:51:06 +08:00
parent df75a74822
commit 38b03b556c
5 changed files with 29 additions and 12 deletions

View File

@ -24,12 +24,14 @@ public interface TbProskuConMapper {
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
}
}

View File

@ -94,9 +94,10 @@ public class ConsMsgConsumer {
}
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
// List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopIdAngCheck(skuId, shopId);
if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
log.info("耗材信息未配置");
log.info("耗材信息未配置或未开启校验");
return;
}

View File

@ -66,11 +66,13 @@ public class ConsService {
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
for (TbOrderDetail orderDetail : orderDetails) {
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
// List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductIdAndCheck(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
log.info("不存在的耗材信息配置:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
log.info("耗材信息配置或未开启校验:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
continue;
}
for (TbProskuCon proskuCon : proskuCons) {
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){

View File

@ -820,7 +820,6 @@ public class OrderService {
if (flag) {
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
;
}
} else {

View File

@ -15,7 +15,7 @@
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
@ -25,11 +25,11 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, surplus_stock, status,
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, surplus_stock, status,
create_time)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
@ -123,6 +123,12 @@
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
</select>
<select id="selectBySkuIdAndShopIdAngCheck" resultMap="BaseResultMap">
select a.* from tb_prosku_con as a
left join tb_cons_info as b on a.con_info_id=b.id
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.status=1 and b.is_check=0
</select>
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
SELECT
p.con_info_id
@ -139,4 +145,11 @@
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
</select>
</mapper>
<select id="selectByShopIdAndSkuIdAndProductIdAndCheck" resultMap="BaseResultMap">
select a.* from tb_prosku_con as a
left join tb_cons_info as b on a.con_info_id=b.id
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.product_id=#{productId} and a.status=1 and b.is_check=1
</select>
</mapper>