解决商品suk会删除的问题,新增添加购物车提示

This commit is contained in:
liyj 2025-07-28 17:41:59 +08:00
parent 79f038e977
commit 62cbe31346
7 changed files with 50 additions and 9 deletions

View File

@ -26,7 +26,8 @@ public class ProductTitleUtil {
"特价", "折扣", "优惠", "促销", "限时", "秒杀", "抢购", "直降", "满减", "特价", "折扣", "优惠", "促销", "限时", "秒杀", "抢购", "直降", "满减",
"赠品", "包邮", "新品", "热卖", "爆款", "推荐", "精选", "特惠", "清仓", "赠品", "包邮", "新品", "热卖", "爆款", "推荐", "精选", "特惠", "清仓",
"正品", "原装", "官方", "正版", "品牌", "优质", "好用", "新款", "老款", "正品", "原装", "官方", "正版", "品牌", "优质", "好用", "新款", "老款",
"", "", "", "", "[]", "()", "", "", "", "", "??", "?","袋装","盒装","" "", "", "", "", "[]", "()", "", "", "", "", "??", "?",
"袋装","盒装","","精品","加工","",""
))); )));
/** /**

View File

@ -15,5 +15,5 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface ShopProductItemSeqMapper extends BaseMapper<ShopProductItemSeq> { public interface ShopProductItemSeqMapper extends BaseMapper<ShopProductItemSeq> {
int updateSeqIdByItemIdAndProductId(ShopProductItemSeq shopProductItemSeq);
} }

View File

@ -13,4 +13,5 @@ import com.suisung.mall.core.web.service.IBaseService;
*/ */
public interface ShopProductItemSeqService extends IBaseService<ShopProductItemSeq> { public interface ShopProductItemSeqService extends IBaseService<ShopProductItemSeq> {
int updateSeqIdByItemIdAndProductId(ShopProductItemSeq shopProductItemSeq);
} }

View File

@ -1007,6 +1007,19 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
//判断是否存在 //判断是否存在
ShopProductItemSeq product_item_seq_row = shopProductItemSeqService.get(product_item_seq_id); ShopProductItemSeq product_item_seq_row = shopProductItemSeqService.get(product_item_seq_id);
//新增反向校验
if(null == product_item_seq_row){
QueryWrapper<ShopProductItemSeq> itemSeqQueryWrapper = new QueryWrapper<>();
itemSeqQueryWrapper.eq("item_id",item_row.getItem_id());
itemSeqQueryWrapper.eq("product_id",item_row.getProduct_id());
product_item_seq_row= shopProductItemSeqService.findOne(itemSeqQueryWrapper);
if(null!=product_item_seq_row){
product_item_seq_row.setProduct_item_seq_id(product_item_seq_id);
product_item_seq_row.setProduct_item_seq_val(product_item_seq_val);
shopProductItemSeqService.updateSeqIdByItemIdAndProductId(product_item_seq_row);
}
}
if (null != product_item_seq_row) { if (null != product_item_seq_row) {
item_id = product_item_seq_row.getItem_id(); item_id = product_item_seq_row.getItem_id();
} else { } else {

View File

@ -4,6 +4,7 @@ import com.suisung.mall.common.modules.product.ShopProductItemSeq;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.product.mapper.ShopProductItemSeqMapper; import com.suisung.mall.shop.product.mapper.ShopProductItemSeqMapper;
import com.suisung.mall.shop.product.service.ShopProductItemSeqService; import com.suisung.mall.shop.product.service.ShopProductItemSeqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -17,4 +18,11 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class ShopProductItemSeqServiceImpl extends BaseServiceImpl<ShopProductItemSeqMapper, ShopProductItemSeq> implements ShopProductItemSeqService { public class ShopProductItemSeqServiceImpl extends BaseServiceImpl<ShopProductItemSeqMapper, ShopProductItemSeq> implements ShopProductItemSeqService {
@Autowired
private ShopProductItemSeqMapper shopProductItemSeqMapper;
@Override
public int updateSeqIdByItemIdAndProductId(ShopProductItemSeq shopProductItemSeq) {
return shopProductItemSeqMapper.updateSeqIdByItemIdAndProductId(shopProductItemSeq);
}
} }

View File

@ -36,6 +36,7 @@ import com.suisung.mall.common.pojo.dto.SameCityDeliveryFeeRespDTO;
import com.suisung.mall.common.service.MessageService; import com.suisung.mall.common.service.MessageService;
import com.suisung.mall.common.utils.CheckUtil; import com.suisung.mall.common.utils.CheckUtil;
import com.suisung.mall.common.utils.I18nUtil; import com.suisung.mall.common.utils.I18nUtil;
import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.base.service.AccountBaseConfigService; import com.suisung.mall.shop.base.service.AccountBaseConfigService;
import com.suisung.mall.shop.base.service.ShopBaseStateCodeService; import com.suisung.mall.shop.base.service.ShopBaseStateCodeService;
@ -413,6 +414,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
// 采购判断 先放入此处 // 采购判断 先放入此处
String from = getParameter("from"); String from = getParameter("from");
Integer item_quantity = Convert.toInt(item_row.get("item_quantity")); Integer item_quantity = Convert.toInt(item_row.get("item_quantity"));
if(StringUtils.isNotEmpty(from)){
if ("manage".equals(from) && item_quantity < cart_quantity) { if ("manage".equals(from) && item_quantity < cart_quantity) {
throw new ApiException(I18nUtil._("当前商品只可购买") + item_quantity + I18nUtil._("件,请确认!")); throw new ApiException(I18nUtil._("当前商品只可购买") + item_quantity + I18nUtil._("件,请确认!"));
} else if ("manage".equals(from) && cart_quantity <= 0) { } else if ("manage".equals(from) && cart_quantity <= 0) {
@ -422,6 +424,17 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
throw new ApiException(ResultCode.FAILED); throw new ApiException(ResultCode.FAILED);
} }
} }
}else {
if (item_quantity < cart_quantity) {
throw new ApiException(I18nUtil._("当前商品只可购买") + item_quantity + I18nUtil._("件,请确认!"));
} else if (cart_quantity <= 0) {
throw new ApiException(I18nUtil._("最低备货数量 1 件,请确认!"));
} else {
if (!addCart(data)) {
throw new ApiException(ResultCode.FAILED);
}
}
}
data.putAll(item_row); data.putAll(item_row);
} }
} }

View File

@ -7,4 +7,9 @@
product_item_seq_id, product_item_seq_val, item_id, product_id product_item_seq_id, product_item_seq_val, item_id, product_id
</sql> </sql>
<update id="updateSeqIdByItemIdAndProductId" parameterType="com.suisung.mall.common.modules.product.ShopProductItemSeq">
update shop_product_item_seq set product_item_seq_val=#{product_item_seq_val},
product_item_seq_id=#{product_item_seq_id}
where item_id=#{item_id} and product_id=#{product_id}
</update>
</mapper> </mapper>