Merge remote-tracking branch 'refs/remotes/public/develop' into feature/YunKuaiChongV160

# Conflicts:
#	jcpp-protocol-yunkuaichong/src/main/java/sanbing/jcpp/protocol/yunkuaichong/YunKuaiChongProtocolMessageProcessor.java
This commit is contained in:
三丙
2024-10-22 16:25:12 +08:00
31 changed files with 232 additions and 135 deletions

View File

@@ -27,7 +27,7 @@ spring:
password: "${SPRING_DATASOURCE_PASSWORD:postgres}"
hikari:
leak-detection-threshold: "${SPRING_DATASOURCE_HIKARI_LEAK_DETECTION_THRESHOLD:0}"
maximum-pool-size: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:16}"
maximum-pool-size: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:64}"
register-mbeans: "${SPRING_DATASOURCE_HIKARI_REGISTER_MBEANS:false}"
mybatis-plus:
@@ -63,9 +63,10 @@ queue:
type: "${QUEUE_TYPE:memory}"
partitions:
hash_function_name: "${QUEUE_PARTITIONS_HASH_FUNCTION_NAME:murmur3_128}" # murmur3_32, murmur3_128 or sha256
in_memory:
in-memory:
queue-capacity: "${QUEUE_IN_MEMORY_QUEUE_CAPACITY:100000}"
stats:
print-interval-ms: "${QUEUE_IN_MEMORY_STATS_PRINT_INTERVAL_MS:60000}"
print-interval-ms: "${QUEUE_IN_MEMORY_STATS_PRINT_INTERVAL_MS:10000}"
kafka:
bootstrap-servers: "${KAFKA_SERVERS:kafka:9092}"
ssl:
@@ -93,7 +94,7 @@ queue:
auto-offset-reset: "${QUEUE_KAFKA_AUTO_OFFSET_RESET:earliest}"
other-inline: "${QUEUE_KAFKA_OTHER_PROPERTIES:}"
topic-properties:
app: "${QUEUE_KAFKA_APP_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}"
app: "${QUEUE_KAFKA_APP_TOPIC_PROPERTIES:retention.ms:86400000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}"
consumer-stats:
enabled: "${QUEUE_KAFKA_CONSUMER_STATS_ENABLED:true}"
print-interval-ms: "${QUEUE_KAFKA_CONSUMER_STATS_MIN_PRINT_INTERVAL_MS:60000}"
@@ -115,8 +116,8 @@ cache:
type: "${CACHE_TYPE:caffeine}" # caffeine or redis
specs:
piles:
timeToLiveInMinutes: "${CACHE_SPECS_PILES_TTL:15}"
maxSize: "${CACHE_SPECS_PILES_MAX_SIZE:1000}"
timeToLiveInMinutes: "${CACHE_SPECS_PILES_TTL:1440}"
maxSize: "${CACHE_SPECS_PILES_MAX_SIZE:100000}"
pileSessions:
timeToLiveInMinutes: "${CACHE_SPECS_PILE_SESSIONS_TTL:1440}"
maxSize: "${CACHE_SPECS_PILE_SESSIONS_MAX_SIZE:100000}"
@@ -132,7 +133,7 @@ redis:
commandTimeout: "${REDIS_CLIENT_COMMAND_TIMEOUT:30000}"
shutdownTimeout: "${REDIS_CLIENT_SHUTDOWN_TIMEOUT:1000}"
readTimeout: "${REDIS_CLIENT_READ_TIMEOUT:60000}"
usePoolConfig: "${REDIS_CLIENT_USE_POOL_CONFIG:false}"
usePoolConfig: "${REDIS_CLIENT_USE_POOL_CONFIG:true}"
cluster:
nodes: "${REDIS_NODES:redis-node-0:6379,redis-node-1:6379,redis-node-2:6379,redis-node-3:6379,redis-node-4:6379,redis-node-5:6379}"
max-redirects: "${REDIS_MAX_REDIRECTS:12}"
@@ -146,7 +147,7 @@ redis:
password: "${REDIS_PASSWORD:sanbing}"
pool_config:
maxTotal: "${REDIS_POOL_CONFIG_MAX_TOTAL:128}"
maxIdle: "${REDIS_POOL_CONFIG_MAX_IDLE:128}"
maxIdle: "${REDIS_POOL_CONFIG_MAX_IDLE:64}"
minIdle: "${REDIS_POOL_CONFIG_MIN_IDLE:16}"
testOnBorrow: "${REDIS_POOL_CONFIG_TEST_ON_BORROW:false}"
testOnReturn: "${REDIS_POOL_CONFIG_TEST_ON_RETURN:false}"

View File

@@ -18,7 +18,8 @@
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
<SizeBasedTriggeringPolicy size="1G"/>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy>
@@ -45,6 +46,12 @@
<AppenderRef ref="ROLLING_FILE"/>
</AsyncLogger>
<AsyncLogger name="sanbing.jcpp.app" level="${env:APP_LOG_LEVEL:-TRACE}"
additivity="false" includeLocation="false">
<AppenderRef ref="CONSOLE"/>
<AppenderRef ref="ROLLING_FILE"/>
</AsyncLogger>
<AsyncLogger name="sanbing.jcpp.protocol" level="${env:PROTOCOLS_LOG_LEVEL:-TRACE}"
additivity="false" includeLocation="false">
<AppenderRef ref="CONSOLE"/>

View File

@@ -12,9 +12,9 @@ import sanbing.jcpp.app.dal.config.ibatis.enums.GunOptStatusEnum;
import sanbing.jcpp.app.dal.config.ibatis.enums.GunRunStatusEnum;
import sanbing.jcpp.app.dal.config.ibatis.enums.OwnerTypeEnum;
import sanbing.jcpp.app.dal.entity.Gun;
import sanbing.jcpp.app.dal.entity.Pile;
import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.util.UUID;
@@ -42,9 +42,6 @@ class GunMapperIT extends AbstractTestBase {
@Resource
GunMapper gunMapper;
@Resource
PileMapper pileMapper;
@Test
void curdTest() {
gunMapper.delete(Wrappers.lambdaQuery());
@@ -53,15 +50,13 @@ class GunMapperIT extends AbstractTestBase {
UUID pileId = NORMAL_PILE_ID[i];
UUID gunId = NORMAL_GUN_ID[i];
Pile pile = pileMapper.selectById(pileId);
Gun gun = Gun.builder()
.id(gunId)
.createdTime(LocalDateTime.now())
.additionalInfo(JacksonUtil.newObjectNode())
.gunNo("02")
.gunName(pile.getPileName() + "的2号枪")
.gunCode(pile.getPileCode() + "-02")
.gunName(String.format("三丙家的%d号充电桩", i + 1) + "的2号枪")
.gunCode("202312120000" + new DecimalFormat("00").format(i + 1) + "-02")
.stationId(NORMAL_STATION_ID)
.pileId(pileId)
.ownerId(NORMAL_USER_ID)

View File

@@ -17,7 +17,10 @@ import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import static sanbing.jcpp.app.dal.mapper.StationMapperIT.NORMAL_STATION_ID;
import static sanbing.jcpp.app.dal.mapper.UserMapperIT.NORMAL_USER_ID;
@@ -68,7 +71,36 @@ class PileMapperIT extends AbstractTestBase {
pileMapper.insertOrUpdate(pile);
log.info("{}", pileMapper.selectById(pileId));
}
}
@Test
void generate100KPiles() {
AtomicInteger number = new AtomicInteger(1);
for (int i = 0; i < 100; i++) {
List<Pile> piles = new ArrayList<>();
for (int j = 0; j < 1000; j++, number.incrementAndGet()) {
Pile pile = Pile.builder()
.id(UUID.randomUUID())
.createdTime(LocalDateTime.now())
.additionalInfo(JacksonUtil.newObjectNode())
.pileName(String.format("三丙家的%d号充电桩", number.get()))
.pileCode("20241015" + new DecimalFormat("000000").format(number.get()))
.protocol("yunkuaichongV150")
.stationId(NORMAL_STATION_ID)
.ownerId(NORMAL_USER_ID)
.ownerType(OwnerTypeEnum.C)
.brand("星星")
.model("10A")
.manufacturer("星星")
.status(PileStatusEnum.IDLE)
.type(PileTypeEnum.AC)
.build();
piles.add(pile);
}
pileMapper.insert(piles);
}
log.info("{}", pileMapper.selectCount(Wrappers.lambdaQuery()));
}
}