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

This commit is contained in:
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> 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<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> 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) { if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
log.info("耗材信息未配置"); log.info("耗材信息未配置或未开启校验");
return; return;
} }

View File

@@ -66,11 +66,13 @@ public class ConsService {
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>(); List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
for (TbOrderDetail orderDetail : orderDetails) { 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){ 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; continue;
} }
for (TbProskuCon proskuCon : proskuCons) { for (TbProskuCon proskuCon : proskuCons) {
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId()); TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){ if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){

View File

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

View File

@@ -15,7 +15,7 @@
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tb_prosku_con from tb_prosku_con
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
@@ -25,11 +25,11 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon"> <insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id, insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, surplus_stock, status, con_info_id, surplus_stock, status,
create_time) create_time)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP})
</insert> </insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon"> <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 * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
</select> </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 id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
SELECT SELECT
p.con_info_id 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 * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
</select> </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>