更新,BUG修改
This commit is contained in:
@@ -14,6 +14,7 @@ public class ConsumerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("es.set.netty.runtime.available.processors", "false");
|
||||
System.setProperty("rocketmq.client.logUseSlf4j","true");
|
||||
SpringApplication.run(ConsumerApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lili.sucurity;
|
||||
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
* @since 2022/2/18
|
||||
**/
|
||||
@Component
|
||||
public class ConsumerSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.formLogin().disable();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import cn.lili.modules.system.entity.dto.SeckillSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -44,24 +45,40 @@ public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
//清除所以商品索引的无效促销活动
|
||||
this.esGoodsIndexService.cleanInvalidPromotion();
|
||||
//定时创建活动
|
||||
addSeckill();
|
||||
try {
|
||||
//清除所有商品索引的无效促销活动
|
||||
this.esGoodsIndexService.cleanInvalidPromotion();
|
||||
} catch (Exception e) {
|
||||
log.error("清楚商品索引中无效促销异常", e);
|
||||
}
|
||||
try {
|
||||
//定时创建活动
|
||||
addSeckill();
|
||||
} catch (Exception e) {
|
||||
log.error("秒杀活动添加异常", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加秒杀活动
|
||||
* 从系统设置中获取秒杀活动的配置
|
||||
* 添加30天后的秒杀活动
|
||||
* 添加明天后的秒杀活动
|
||||
*/
|
||||
private void addSeckill() {
|
||||
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
||||
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
||||
log.info("生成秒杀活动设置:{}", seckillSetting);
|
||||
for (int i = 1; i <= SeckillService.PRE_CREATION; i++) {
|
||||
Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule());
|
||||
seckillService.savePromotions(seckill);
|
||||
|
||||
LambdaQueryWrapper<Seckill> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Seckill::getStartTime, seckill.getStartTime());
|
||||
//如果已经存在促销,则不再次保存
|
||||
if (seckillService.list(lambdaQueryWrapper).isEmpty()) {
|
||||
boolean result = seckillService.savePromotions(seckill);
|
||||
log.info("生成秒杀活动参数:{},结果:{}", seckill, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ spring:
|
||||
type: redis
|
||||
# Redis
|
||||
redis:
|
||||
host: 192.168.2.122
|
||||
host: 120.71.145.134
|
||||
port: 6379
|
||||
password: Gb84505016
|
||||
password: ekLhvPGraSj8DGO0
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数(使用负值表示没有限制) 默认 8
|
||||
@@ -66,9 +66,9 @@ spring:
|
||||
default-datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.2.126:3306/rx-shop?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
|
||||
username: rx-shop
|
||||
password: J2xEZ42HwPXrDXt3
|
||||
url: jdbc:mysql://120.71.183.195:3306/zyt_shop?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
|
||||
username: zyt_shop
|
||||
password: Gb84505016@zytshop
|
||||
maxActive: 20
|
||||
initialSize: 5
|
||||
maxWait: 60000
|
||||
@@ -209,16 +209,16 @@ lili:
|
||||
sk: zhNKVrJK6UPOhqIjn8AQvG37b9sz6
|
||||
#域名
|
||||
domain:
|
||||
pc: https://pc.b2b2c.pickmall.cn
|
||||
wap: https://m.b2b2c.pickmall.cn
|
||||
store: https://store.b2b2c.pickmall.cn
|
||||
admin: https://admin.b2b2c.pickmall.cn
|
||||
pc: http://zbuyer.sx1788.cn/buyer
|
||||
wap: http://zshop.sx1788.cn/
|
||||
store: http://zseller.sx1788.cn/login
|
||||
admin: http://zmanager.sx1788.cn/login
|
||||
#api地址
|
||||
api:
|
||||
buyer: https://buyer-api.pickmall.cn
|
||||
common: https://common-api.pickmall.cn
|
||||
manager: https://admin-api.pickmall.cn
|
||||
store: https://store-api.pickmall.cn
|
||||
buyer: https://zshop-api.sx1788.cn/buyer-api
|
||||
common: https://zshop-api.sx1788.cn/common-api
|
||||
manager: https://zshop-api.sx1788.cn/manager-api
|
||||
store: https://zshop-api.sx1788.cn/seller-api
|
||||
|
||||
# jwt 细节设定
|
||||
jwt-setting:
|
||||
@@ -237,7 +237,7 @@ lili:
|
||||
data:
|
||||
elasticsearch:
|
||||
cluster-name: elasticsearch
|
||||
cluster-nodes: 192.168.2.122:9200
|
||||
cluster-nodes: 106.124.130.167:9200
|
||||
index:
|
||||
number-of-replicas: 0
|
||||
number-of-shards: 3
|
||||
@@ -247,7 +247,7 @@ lili:
|
||||
# username: elastic
|
||||
# password: LiLiShopES
|
||||
logstash:
|
||||
server: 192.168.2.122:4560
|
||||
server: 106.124.130.167:4560
|
||||
rocketmq:
|
||||
promotion-topic: lili_promotion_topic
|
||||
promotion-group: lili_promotion_group
|
||||
@@ -268,7 +268,7 @@ lili:
|
||||
after-sale-topic: lili_after_sale_topic
|
||||
after-sale-group: lili_after_sale_group
|
||||
rocketmq:
|
||||
name-server: 192.168.2.122:9876
|
||||
name-server: 106.124.130.167:9876
|
||||
producer:
|
||||
group: lili_group
|
||||
send-message-timeout: 30000
|
||||
@@ -276,7 +276,7 @@ rocketmq:
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://192.168.2.122:9001/xxl-job-admin
|
||||
addresses: http://127.0.0.1:9001/xxl-job-admin
|
||||
executor:
|
||||
appname: xxl-job-executor-lilishop
|
||||
address:
|
||||
|
||||
@@ -20,6 +20,22 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="RocketmqClientAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_FILE_PATH}/rocketmq.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_PATH}/rocketmq/rocketmq-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>30MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} %X{ServiceId} - %m%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<logger name="RocketmqClient" additivity="false">
|
||||
<level value="info" />
|
||||
<appender-ref ref="RocketmqClientAppender"/>
|
||||
</logger>
|
||||
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
@@ -34,7 +50,7 @@
|
||||
<customFields>{"appName":"${APP_NAME}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root >
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
|
||||
Reference in New Issue
Block a user