秒杀拼团下单时的一些bug
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
<contextName>yshop</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
<property name="log.pattern" value="${log.pattern:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
<property name="log.path" value="logs/yshop-admin"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
|
@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
<contextName>yshop</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
<property name="log.pattern" value="${log.pattern:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
<property name="log.path" value="logs/yshop-app"/>
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
|
@ -34,7 +34,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
" where id=#{combinationId}")
|
||||
int incStockDecSales(@Param("num") int num,@Param("combinationId") Long combinationId);
|
||||
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price," +
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price, s.sales as sales," +
|
||||
"c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " +
|
||||
"INNER JOIN yx_store_product s ON s.id=c.product_id " +
|
||||
" WHERE c.is_show = 1 AND c.is_del = 0 AND c.start_time < now() " +
|
||||
@ -42,7 +42,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
List<YxStoreCombinationQueryVo> getCombList(Page page);
|
||||
|
||||
@Select("SELECT c.id,c.effective_time as effectiveTime,c.image,c.people,c.price,c.browse," +
|
||||
"c.description,c.image,c.images,c.info,c.is_postage as isPostage,c.postage," +
|
||||
"c.description,c.image,c.images,c.info," +
|
||||
"c.product_id as productId,c.sales,c.start_time as startTime" +
|
||||
",c.stock,c.stop_time stopTime," +
|
||||
"c.title,c.unit_name as unitName,s.price as productPrice FROM yx_store_combination c " +
|
||||
@ -51,7 +51,7 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
YxStoreCombinationQueryVo getCombDetail(Long id);
|
||||
|
||||
@Select("SELECT c.id,c.image,c.price,c.title as storeName,c.is_show as isShow,c.cost," +
|
||||
"c.is_postage as isPostage,c.postage,c.sales,c.stock,c.is_del as isDel" +
|
||||
"c.sales,c.stock,c.is_del as isDel" +
|
||||
" FROM yx_store_combination c " +
|
||||
" WHERE c.id = #{id} and c.is_del = 0 ")
|
||||
YxStoreProductQueryVo combinatiionInfo(Long id);
|
||||
|
@ -139,13 +139,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
yxStoreProductAttrService.decProductAttrStock(num,productId,unique, type);
|
||||
}
|
||||
int res = 0;
|
||||
if("combination".equals(type)){
|
||||
res = storeProductMapper.decCombinationStockIncSales(num,productId,activityId);
|
||||
}else if("seckill".equals(type)){
|
||||
res = storeProductMapper.decSeckillStockIncSales(num,productId,activityId);
|
||||
}else {
|
||||
|
||||
res = storeProductMapper.decStockIncSales(num,productId);
|
||||
}
|
||||
|
||||
if(res == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
|
@ -36,11 +36,11 @@ public interface StoreProductAttrValueMapper extends CoreMapper<YxStoreProductAt
|
||||
int incStockDecSales(@Param("num") int num,@Param("productId") Long productId,
|
||||
@Param("unique") String unique);
|
||||
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, pink_stock=pink_stock-#{num} sales=sales+#{num}" +
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, pink_stock=pink_stock-#{num} ,sales=sales+#{num}" +
|
||||
" where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and pink_stock>=#{num}")
|
||||
int decCombinationStockIncSales(int num, Long productId, String unique);
|
||||
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, seckill_stock=seckill_stock-#{num} sales=sales+#{num}" +
|
||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, seckill_stock=seckill_stock-#{num},sales=sales+#{num}" +
|
||||
" where product_id=#{productId} and `unique`=#{unique} and stock >= #{num} and seckill_stock>=#{num}")
|
||||
int decSeckillStockIncSales(int num, Long productId, String unique);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
|
||||
@Update("update yx_store_combination set stock=stock-#{num}, sales=sales+#{num}" +
|
||||
" where id=#{activityId} and stock >= #{num}")
|
||||
int decCombinationStockIncSales(int num, Long productId,Long activityId);
|
||||
//todo 拼团商品库存+—
|
||||
//todo 秒杀商品库存+—
|
||||
@Update("update yx_store_seckill set stock=stock-#{num}, sales=sales+#{num}" +
|
||||
" where id=#{activityId} and stock >= #{num}")
|
||||
int decSeckillStockIncSales(int num, Long productId,Long activityId);
|
||||
|
Reference in New Issue
Block a user