commit
d041e7b5b4
@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: buyer-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@ -182,6 +184,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: debug
|
||||
@ -191,10 +194,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
@ -4,9 +4,9 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="seller-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="buyer-api"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
<timeZone>UTC</timeZone>
|
||||
</timestamp>
|
||||
</providers>
|
||||
<!--自定义字段 区分项目-->
|
||||
<customFields>{"appName":"${APP_NAME}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</root>
|
||||
</configuration>
|
@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: common-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@ -181,6 +183,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@ -190,10 +193,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
@ -4,9 +4,9 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="common-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
@ -182,6 +182,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@ -190,11 +191,13 @@ logging:
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
path: logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
@ -25,6 +25,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: consumer
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@ -184,6 +186,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@ -193,10 +196,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
@ -4,9 +4,9 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="common-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
@ -192,6 +192,8 @@ public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> impl
|
||||
seckillVO.setEndTime(cn.hutool.core.date.DateUtil.endOfDay(seckillVO.getStartTime()));
|
||||
}
|
||||
PromotionTools.checkPromotionTime(seckillVO.getStartTime().getTime(), seckillVO.getEndTime().getTime());
|
||||
//检查秒杀活动参数
|
||||
this.checkSeckillParam(seckillVO);
|
||||
//更新到MYSQL中
|
||||
boolean result = this.updateById(seckillVO);
|
||||
//保存到MONGO中
|
||||
|
@ -1,19 +1,27 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.SettingKeys;
|
||||
import cn.lili.modules.search.entity.dos.CustomWords;
|
||||
import cn.lili.modules.search.entity.vo.CustomWordsVO;
|
||||
import cn.lili.modules.search.service.CustomWordsService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
@ -41,11 +49,11 @@ public class CustomWordsController {
|
||||
|
||||
@GetMapping
|
||||
public String getCustomWords(String secretKey) {
|
||||
if (StringUtils.isEmpty(secretKey)) {
|
||||
if (CharSequenceUtil.isEmpty(secretKey)) {
|
||||
return "";
|
||||
}
|
||||
Setting setting = settingService.get(SettingKeys.ES_SIGN.name());
|
||||
if (setting == null || StringUtils.isEmpty(setting.getSettingValue())) {
|
||||
if (setting == null || CharSequenceUtil.isEmpty(setting.getSettingValue())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -57,9 +65,38 @@ public class CustomWordsController {
|
||||
try {
|
||||
return new String(res.getBytes(), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
log.error("获取分词错误",e);
|
||||
log.error("获取分词错误", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加自定义分词")
|
||||
@PostMapping
|
||||
public ResultMessage<CustomWordsVO> addCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.addCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@PutMapping
|
||||
public ResultMessage<CustomWordsVO> updateCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.updateCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<String> deleteCustomWords(@NotNull @PathVariable String id) {
|
||||
customWordsService.deleteCustomWords(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取自定义分词")
|
||||
@ApiImplicitParam(name = "words", value = "分词", required = true, dataType = "String", paramType = "query")
|
||||
@GetMapping("/page")
|
||||
public ResultMessage<IPage<CustomWords>> getCustomWords(@RequestParam String words, PageVO pageVo) {
|
||||
return ResultUtil.data(customWordsService.getCustomWordsByPage(words, pageVo));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,66 +0,0 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.search.entity.dos.CustomWords;
|
||||
import cn.lili.modules.search.entity.vo.CustomWordsVO;
|
||||
import cn.lili.modules.search.service.CustomWordsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 管理端,自定义分词接口
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
@RestController
|
||||
@Api(tags = "管理端,自定义分词接口")
|
||||
@RequestMapping("/manager/manager/custom-words")
|
||||
public class CustomWordsManagerController {
|
||||
|
||||
/**
|
||||
* 分词
|
||||
*/
|
||||
@Autowired
|
||||
private CustomWordsService customWordsService;
|
||||
|
||||
@ApiOperation(value = "添加自定义分词")
|
||||
@PostMapping
|
||||
public ResultMessage<CustomWordsVO> addCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.addCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@PutMapping
|
||||
public ResultMessage<CustomWordsVO> updateCustomWords(@Valid CustomWordsVO customWords) {
|
||||
customWordsService.updateCustomWords(customWords);
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResultMessage<String> deleteCustomWords(@NotNull @PathVariable String id) {
|
||||
customWordsService.deleteCustomWords(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取自定义分词")
|
||||
@ApiImplicitParam(name = "words", value = "分词", required = true, dataType = "String", paramType = "query")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<CustomWords>> getCustomWords(@RequestParam String words, PageVO pageVo) {
|
||||
return ResultUtil.data(customWordsService.getCustomWordsByPage(words, pageVo));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: manager-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@ -166,6 +168,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@ -175,10 +178,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
@ -4,9 +4,9 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="consumer"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
@ -22,7 +22,7 @@
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>192.168.0.116:4560</destination>
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: seller-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@ -164,6 +166,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@ -173,10 +176,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
41
seller-api/src/main/resources/logback-spring.xml
Normal file
41
seller-api/src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
<timeZone>UTC</timeZone>
|
||||
</timestamp>
|
||||
</providers>
|
||||
<!--自定义字段 区分项目-->
|
||||
<customFields>{"appName":"${APP_NAME}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</root>
|
||||
</configuration>
|
Loading…
x
Reference in New Issue
Block a user