mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
提交 mq 配置
This commit is contained in:
parent
6e6088a7f5
commit
97247a23d5
|
@ -16,7 +16,13 @@ public interface MiaoShaMessageDao {
|
|||
public List<MiaoShaMessage> listMiaoShaMessage(@Param("messageId") String messageId);
|
||||
@Select("<script>select * from miaosha_message_user where 1=1 <if test=\"messageId !=null \">and messageId = #{messageId} </if></script>")
|
||||
public List<MiaoShaMessageUser> listMiaoShaMessageUser(@Param("messageId") String messageId);
|
||||
// @Insert("insert into miaosha_user (id , nickname ,password , salt ,head,register_date,last_login_date)value (#{id},#{nickname},#{password},#{salt},#{head},#{registerDate},#{lastLoginDate}) ")
|
||||
// @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
// public void insertMiaoShaUser(MiaoshaUser miaoshaUser);
|
||||
@Insert("insert into miaosha_message (id , messageid ,content , create_time ,status,over_time,message_type ,send_type , goodname , price)" +
|
||||
"value (#{id},#{messageId},#{content},#{createTime},#{status},#{overTime},#{messageType},#{sendType},#{goodName},#{price}) ")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
public void insertMiaoShaMessage(MiaoShaMessage miaoShaMessage);
|
||||
|
||||
@Insert("insert into miaosha_message_user (id , userid ,messageid , goodid ,orderid)" +
|
||||
"value (#{id},#{userId},#{messageId},#{goodId},#{orderId}) ")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
public void insertMiaoShaMessageUser(MiaoShaMessageUser miaoShaMessageUser);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.geekq.miaosha.service.OrderService;
|
|||
import com.geekq.miaosha.vo.GoodsVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -36,7 +37,7 @@ public class MQReceiver {
|
|||
MiaoshaMessage mm = RedisService.stringToBean(message, MiaoshaMessage.class);
|
||||
MiaoshaUser user = mm.getUser();
|
||||
long goodsId = mm.getGoodsId();
|
||||
|
||||
|
||||
GoodsVo goods = goodsService.getGoodsVoByGoodsId(goodsId);
|
||||
int stock = goods.getStockCount();
|
||||
if(stock <= 0) {
|
||||
|
@ -54,8 +55,9 @@ public class MQReceiver {
|
|||
|
||||
|
||||
@RabbitListener(queues=MQConfig.MIAOSHA_MESSAGE)
|
||||
public void receiveMiaoShaMessage(String message) {
|
||||
|
||||
@RabbitHandler
|
||||
public void receiveMiaoShaMessage(Object message) {
|
||||
System.out.println(111111);
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
|||
#druid
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.filters=stat
|
||||
spring.datasource.maxActive=1000
|
||||
spring.datasource.maxActive=100
|
||||
spring.datasource.initialSize=100
|
||||
spring.datasource.maxWait=60000
|
||||
spring.datasource.minIdle=500
|
||||
spring.datasource.maxWait=600
|
||||
spring.datasource.minIdle=50
|
||||
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
spring.datasource.validationQuery=select 'x'
|
||||
|
|
Loading…
Reference in New Issue
Block a user