Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhonghong
custom-server
Commits
3dca12a3
Commit
3dca12a3
authored
Jul 14, 2026
by
Lizh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: P2 Step 3 — ComposeServer 服务器管理+日志 8 endpoints
Co-Authored-By: Claude <noreply@anthropic.com>
parent
de82bfad
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
861 additions
and
0 deletions
+861
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/SysComposeServerLogService.java
+40
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/SysComposeServerService.java
+61
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/SysComposeServerLogServiceImpl.java
+61
-0
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/SysComposeServerServiceImpl.java
+108
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysComposeServerEntity.java
+75
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysComposeServerLogEntity.java
+93
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysComposeServerLogMapper.java
+42
-0
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysComposeServerMapper.java
+42
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/SysComposeServerDomainService.java
+13
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/SysComposeServerLogDomainService.java
+24
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/impl/SysComposeServerDomainServiceImpl.java
+24
-0
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/impl/SysComposeServerLogDomainServiceImpl.java
+52
-0
custom-server-domain/src/main/resources/mapper/SysComposeServerLogMapper.xml
+53
-0
custom-server-domain/src/main/resources/mapper/SysComposeServerMapper.xml
+36
-0
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysComposeServerController.java
+83
-0
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysComposeServerLogController.java
+54
-0
No files found.
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/SysComposeServerLogService.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
app
.
service
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
java.util.List
;
/**
* 服务器日志 App Service 接口
*
* @author Lizh
* @date 2026-07-14
*/
public
interface
SysComposeServerLogService
{
/**
* 分页查询服务器日志列表
*
* @param log 查询条件
* @param page 分页参数
* @return 分页结果
*/
IPage
<
SysComposeServerLogEntity
>
pageList
(
SysComposeServerLogEntity
log
,
Page
<
SysComposeServerLogEntity
>
page
);
/**
* 根据ID查询日志详情
*
* @param id 日志id
* @return 日志详情
*/
SysComposeServerLogEntity
getById
(
Long
id
);
/**
* 批量删除日志
*
* @param idList 日志id列表
*/
void
deleteByIdList
(
List
<
Long
>
idList
);
}
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/SysComposeServerService.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
app
.
service
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
java.util.List
;
/**
* 服务器管理 App Service 接口
*
* @author Lizh
* @date 2026-07-14
*/
public
interface
SysComposeServerService
{
/**
* 分页查询服务器列表
*
* @param server 查询条件
* @param page 分页参数
* @return 分页结果
*/
IPage
<
SysComposeServerEntity
>
pageList
(
SysComposeServerEntity
server
,
Page
<
SysComposeServerEntity
>
page
);
/**
* 查询所有启用的服务器主机地址
*
* @return 服务器列表
*/
List
<
SysComposeServerEntity
>
getAllServerHost
();
/**
* 新增服务器
*
* @param server 服务器信息
*/
void
add
(
SysComposeServerEntity
server
);
/**
* 修改服务器
*
* @param server 服务器信息
*/
void
updateById
(
SysComposeServerEntity
server
);
/**
* 更新服务器状态
*
* @param id 服务器id
* @param status 状态(0停用 1正常)
*/
void
updateStatusById
(
Long
id
,
Integer
status
);
/**
* 删除服务器
*
* @param id 服务器id
*/
void
deleteById
(
Long
id
);
}
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/SysComposeServerLogServiceImpl.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
app
.
service
.
system
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.service.system.SysComposeServerLogService
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.dal.mapper.SysComposeServerLogMapper
;
import
com.jomalls.custom.domain.service.misc.SysComposeServerLogDomainService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
/**
* 服务器日志 App Service 实现
*
* @author Lizh
* @date 2026-07-14
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
SysComposeServerLogServiceImpl
implements
SysComposeServerLogService
{
private
final
SysComposeServerLogMapper
sysComposeServerLogMapper
;
private
final
SysComposeServerLogDomainService
sysComposeServerLogDomainService
;
@Override
public
IPage
<
SysComposeServerLogEntity
>
pageList
(
SysComposeServerLogEntity
log
,
Page
<
SysComposeServerLogEntity
>
page
)
{
// 分页查询
LambdaQueryWrapper
<
SysComposeServerLogEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
if
(
log
.
getComposeServerId
()
!=
null
)
{
wrapper
.
eq
(
SysComposeServerLogEntity:
:
getComposeServerId
,
log
.
getComposeServerId
());
}
if
(
log
.
getStatus
()
!=
null
)
{
wrapper
.
eq
(
SysComposeServerLogEntity:
:
getStatus
,
log
.
getStatus
());
}
if
(
StringUtils
.
hasText
(
log
.
getBatchNumber
()))
{
wrapper
.
like
(
SysComposeServerLogEntity:
:
getBatchNumber
,
log
.
getBatchNumber
());
}
wrapper
.
orderByDesc
(
SysComposeServerLogEntity:
:
getCreateTime
);
return
sysComposeServerLogDomainService
.
page
(
page
,
wrapper
);
}
@Override
public
SysComposeServerLogEntity
getById
(
Long
id
)
{
return
sysComposeServerLogMapper
.
selectLogById
(
id
);
}
@Override
public
void
deleteByIdList
(
List
<
Long
>
idList
)
{
if
(
idList
==
null
||
idList
.
isEmpty
())
{
return
;
}
sysComposeServerLogMapper
.
deleteByIdList
(
idList
);
log
.
info
(
"批量删除服务器日志成功: count={}"
,
idList
.
size
());
}
}
custom-server-app/src/main/java/com/jomalls/custom/app/service/system/impl/SysComposeServerServiceImpl.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
app
.
service
.
system
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.exception.ServiceException
;
import
com.jomalls.custom.app.service.system.SysComposeServerService
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.domain.service.misc.SysComposeServerDomainService
;
import
com.jomalls.custom.domain.service.misc.SysComposeServerLogDomainService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 服务器管理 App Service 实现
*
* @author Lizh
* @date 2026-07-14
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
SysComposeServerServiceImpl
implements
SysComposeServerService
{
private
final
SysComposeServerDomainService
sysComposeServerDomainService
;
private
final
SysComposeServerLogDomainService
sysComposeServerLogDomainService
;
@Override
public
IPage
<
SysComposeServerEntity
>
pageList
(
SysComposeServerEntity
server
,
Page
<
SysComposeServerEntity
>
page
)
{
// 分页查询
LambdaQueryWrapper
<
SysComposeServerEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
if
(
StringUtils
.
hasText
(
server
.
getTitle
()))
{
wrapper
.
like
(
SysComposeServerEntity:
:
getTitle
,
server
.
getTitle
());
}
wrapper
.
orderByDesc
(
SysComposeServerEntity:
:
getCreateTime
);
IPage
<
SysComposeServerEntity
>
result
=
sysComposeServerDomainService
.
page
(
page
,
wrapper
);
// 统计每个服务器的日志数量
List
<
SysComposeServerEntity
>
records
=
result
.
getRecords
();
if
(
records
!=
null
&&
!
records
.
isEmpty
())
{
List
<
Long
>
serverIds
=
records
.
stream
().
map
(
SysComposeServerEntity:
:
getId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
Long
[]>
countMap
=
sysComposeServerLogDomainService
.
countByServerIds
(
serverIds
);
for
(
SysComposeServerEntity
record
:
records
)
{
Long
[]
counts
=
countMap
.
get
(
record
.
getId
());
if
(
counts
!=
null
)
{
record
.
setStatus0Count
(
counts
[
0
]);
record
.
setStatus1Count
(
counts
[
1
]);
}
}
}
return
result
;
}
@Override
public
List
<
SysComposeServerEntity
>
getAllServerHost
()
{
return
sysComposeServerDomainService
.
list
(
new
LambdaQueryWrapper
<
SysComposeServerEntity
>()
.
eq
(
SysComposeServerEntity:
:
getStatus
,
1
)
.
select
(
SysComposeServerEntity:
:
getId
,
SysComposeServerEntity:
:
getHost
));
}
@Override
public
void
add
(
SysComposeServerEntity
server
)
{
if
(!
StringUtils
.
hasText
(
server
.
getTitle
()))
{
throw
new
ServiceException
(
"服务器标题不能为空"
);
}
if
(!
StringUtils
.
hasText
(
server
.
getHost
()))
{
throw
new
ServiceException
(
"服务器地址不能为空"
);
}
server
.
setStatus
(
1
);
boolean
saved
=
sysComposeServerDomainService
.
save
(
server
);
if
(
saved
)
{
log
.
info
(
"新增服务器成功: title={}, host={}"
,
server
.
getTitle
(),
server
.
getHost
());
}
}
@Override
public
void
updateById
(
SysComposeServerEntity
server
)
{
sysComposeServerDomainService
.
updateById
(
server
);
log
.
info
(
"修改服务器成功: id={}"
,
server
.
getId
());
}
@Override
public
void
updateStatusById
(
Long
id
,
Integer
status
)
{
sysComposeServerDomainService
.
updateById
(
new
SysComposeServerEntity
()
{{
setId
(
id
);
setStatus
(
status
);
}});
log
.
info
(
"更新服务器状态成功: id={}, status={}"
,
id
,
status
);
}
@Override
public
void
deleteById
(
Long
id
)
{
// 先删除关联的日志
sysComposeServerLogDomainService
.
remove
(
new
LambdaQueryWrapper
<
SysComposeServerLogEntity
>()
.
eq
(
SysComposeServerLogEntity:
:
getComposeServerId
,
id
));
// 再删除服务器
sysComposeServerDomainService
.
removeById
(
id
);
log
.
info
(
"删除服务器成功: id={}"
,
id
);
}
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysComposeServerEntity.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
dal
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 服务器管理 Entity
*
* @author Lizh
* @date 2026-07-14
*/
@Data
@TableName
(
"compose_server"
)
public
class
SysComposeServerEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 服务器标题
*/
@TableField
(
"title"
)
private
String
title
;
/**
* 服务器地址
*/
@TableField
(
"host"
)
private
String
host
;
/**
* 备注
*/
@TableField
(
"remark"
)
private
String
remark
;
/**
* 状态(0停用 1正常)
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 创建时间
*/
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createTime
;
// ===== 非表字段(统计数据) =====
/**
* 失败日志数
*/
@TableField
(
exist
=
false
)
private
Long
status0Count
;
/**
* 成功日志数
*/
@TableField
(
exist
=
false
)
private
Long
status1Count
;
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/entity/SysComposeServerLogEntity.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
dal
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 服务器日志 Entity
*
* @author Lizh
* @date 2026-07-14
*/
@Data
@TableName
(
"compose_server_log"
)
public
class
SysComposeServerLogEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 服务器id
*/
@TableField
(
"compose_server_id"
)
private
Long
composeServerId
;
/**
* 批次号
*/
@TableField
(
"batch_number"
)
private
String
batchNumber
;
/**
* 子订单号
*/
@TableField
(
"sub_order_numbers"
)
private
String
subOrderNumbers
;
/**
* 状态(0失败 1正常)
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 请求参数JSON
*/
@TableField
(
"post"
)
private
String
post
;
/**
* 返回结果
*/
@TableField
(
"result"
)
private
String
result
;
/**
* 耗时(毫秒)
*/
@TableField
(
"cost_time"
)
private
Long
costTime
;
/**
* 创建时间
*/
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
UPDATE
)
private
LocalDateTime
updateTime
;
// ===== 非表字段(JOIN查询) =====
/**
* 服务器地址(LEFT JOIN 查询)
*/
@TableField
(
exist
=
false
)
private
String
host
;
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysComposeServerLogMapper.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
dal
.
mapper
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 服务器日志 Mapper
*
* @author Lizh
* @date 2026-07-14
*/
@Mapper
public
interface
SysComposeServerLogMapper
extends
BaseMapper
<
SysComposeServerLogEntity
>
{
/**
* 查询服务器日志列表(支持条件过滤)
*
* @param log 查询条件
* @return 日志列表
*/
List
<
SysComposeServerLogEntity
>
selectServerLogList
(
@Param
(
"log"
)
SysComposeServerLogEntity
log
);
/**
* 根据ID查询日志详情(含服务器host)
*
* @param id 日志id
* @return 日志详情
*/
SysComposeServerLogEntity
selectLogById
(
@Param
(
"id"
)
Long
id
);
/**
* 批量删除日志
*
* @param idList 日志id列表
* @return 影响行数
*/
int
deleteByIdList
(
@Param
(
"idList"
)
List
<
Long
>
idList
);
}
custom-server-domain/src/main/java/com/jomalls/custom/dal/mapper/SysComposeServerMapper.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
dal
.
mapper
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
com.jomalls.custom.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 服务器管理 Mapper
*
* @author Lizh
* @date 2026-07-14
*/
@Mapper
public
interface
SysComposeServerMapper
extends
BaseMapper
<
SysComposeServerEntity
>
{
/**
* 查询服务器列表(支持模糊搜索)
*
* @param server 查询条件
* @return 服务器列表
*/
List
<
SysComposeServerEntity
>
selectServerList
(
@Param
(
"server"
)
SysComposeServerEntity
server
);
/**
* 查询所有启用的服务器主机地址
*
* @return 服务器列表(仅id和host)
*/
List
<
SysComposeServerEntity
>
selectAllServerHost
();
/**
* 更新服务器状态
*
* @param id 服务器id
* @param status 状态(0停用 1正常)
* @return 影响行数
*/
int
updateStatusById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/SysComposeServerDomainService.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
domain
.
service
.
misc
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
com.jomalls.custom.service.IBaseService
;
/**
* 服务器管理 Domain Service 接口
*
* @author Lizh
* @date 2026-07-14
*/
public
interface
SysComposeServerDomainService
extends
IBaseService
<
SysComposeServerEntity
>
{
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/SysComposeServerLogDomainService.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
domain
.
service
.
misc
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.service.IBaseService
;
import
java.util.List
;
import
java.util.Map
;
/**
* 服务器日志 Domain Service 接口
*
* @author Lizh
* @date 2026-07-14
*/
public
interface
SysComposeServerLogDomainService
extends
IBaseService
<
SysComposeServerLogEntity
>
{
/**
* 按服务器ID统计日志数量(失败/成功)
*
* @param serverIds 服务器ID列表
* @return Map<服务器ID, Long[]>,数组[0]=失败数,[1]=成功数
*/
Map
<
Long
,
Long
[]>
countByServerIds
(
List
<
Long
>
serverIds
);
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/impl/SysComposeServerDomainServiceImpl.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
domain
.
service
.
misc
.
impl
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
com.jomalls.custom.dal.mapper.SysComposeServerMapper
;
import
com.jomalls.custom.domain.service.misc.SysComposeServerDomainService
;
import
com.jomalls.custom.service.impl.BaseServiceImpl
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 服务器管理 Domain Service 实现
*
* @author Lizh
* @date 2026-07-14
*/
@Service
public
class
SysComposeServerDomainServiceImpl
extends
BaseServiceImpl
<
SysComposeServerMapper
,
SysComposeServerEntity
>
implements
SysComposeServerDomainService
{
@Autowired
public
SysComposeServerDomainServiceImpl
(
SqlSessionFactory
sqlSessionFactory
)
{
super
(
sqlSessionFactory
);
}
}
custom-server-domain/src/main/java/com/jomalls/custom/domain/service/misc/impl/SysComposeServerLogDomainServiceImpl.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
domain
.
service
.
misc
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.dal.mapper.SysComposeServerLogMapper
;
import
com.jomalls.custom.domain.service.misc.SysComposeServerLogDomainService
;
import
com.jomalls.custom.service.impl.BaseServiceImpl
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 服务器日志 Domain Service 实现
*
* @author Lizh
* @date 2026-07-14
*/
@Service
public
class
SysComposeServerLogDomainServiceImpl
extends
BaseServiceImpl
<
SysComposeServerLogMapper
,
SysComposeServerLogEntity
>
implements
SysComposeServerLogDomainService
{
@Autowired
public
SysComposeServerLogDomainServiceImpl
(
SqlSessionFactory
sqlSessionFactory
)
{
super
(
sqlSessionFactory
);
}
@Override
public
Map
<
Long
,
Long
[]>
countByServerIds
(
List
<
Long
>
serverIds
)
{
Map
<
Long
,
Long
[]>
result
=
new
HashMap
<>();
if
(
serverIds
==
null
||
serverIds
.
isEmpty
())
{
return
result
;
}
for
(
Long
serverId
:
serverIds
)
{
// 统计失败日志数(status = 0)
long
status0Count
=
count
(
new
LambdaQueryWrapper
<
SysComposeServerLogEntity
>()
.
eq
(
SysComposeServerLogEntity:
:
getComposeServerId
,
serverId
)
.
eq
(
SysComposeServerLogEntity:
:
getStatus
,
0
));
// 统计成功日志数(status = 1)
long
status1Count
=
count
(
new
LambdaQueryWrapper
<
SysComposeServerLogEntity
>()
.
eq
(
SysComposeServerLogEntity:
:
getComposeServerId
,
serverId
)
.
eq
(
SysComposeServerLogEntity:
:
getStatus
,
1
));
result
.
put
(
serverId
,
new
Long
[]{
status0Count
,
status1Count
});
}
return
result
;
}
}
custom-server-domain/src/main/resources/mapper/SysComposeServerLogMapper.xml
0 → 100644
View file @
3dca12a3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jomalls.custom.dal.mapper.SysComposeServerLogMapper"
>
<resultMap
type=
"com.jomalls.custom.dal.entity.SysComposeServerLogEntity"
id=
"sysComposeServerLogMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"composeServerId"
column=
"compose_server_id"
/>
<result
property=
"batchNumber"
column=
"batch_number"
/>
<result
property=
"subOrderNumbers"
column=
"sub_order_numbers"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"post"
column=
"post"
/>
<result
property=
"result"
column=
"result"
/>
<result
property=
"costTime"
column=
"cost_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"tableColumns"
>
id, compose_server_id, batch_number, sub_order_numbers, status, post, result, cost_time, create_time, update_time
</sql>
<select
id=
"selectServerLogList"
resultType=
"com.jomalls.custom.dal.entity.SysComposeServerLogEntity"
>
SELECT csl.*, cs.host FROM compose_server_log csl
LEFT JOIN compose_server cs ON cs.id = csl.compose_server_id
<where>
<if
test=
"log.composeServerId != null"
>
AND csl.compose_server_id = #{log.composeServerId}
</if>
<if
test=
"log.status != null"
>
AND csl.status = #{log.status}
</if>
<if
test=
"log.batchNumber != null and log.batchNumber != ''"
>
AND csl.batch_number LIKE CONCAT('%', #{log.batchNumber}, '%')
</if>
</where>
ORDER BY csl.create_time DESC
</select>
<select
id=
"selectLogById"
resultType=
"com.jomalls.custom.dal.entity.SysComposeServerLogEntity"
>
SELECT csl.*, cs.host FROM compose_server_log csl
LEFT JOIN compose_server cs ON cs.id = csl.compose_server_id
WHERE csl.id = #{id}
</select>
<!-- 批量删除日志(注意表名是 compose_server_log,非 compose_server) -->
<delete
id=
"deleteByIdList"
>
DELETE FROM compose_server_log WHERE id IN
<foreach
collection=
"idList"
item=
"id"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
custom-server-domain/src/main/resources/mapper/SysComposeServerMapper.xml
0 → 100644
View file @
3dca12a3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jomalls.custom.dal.mapper.SysComposeServerMapper"
>
<resultMap
type=
"com.jomalls.custom.dal.entity.SysComposeServerEntity"
id=
"sysComposeServerMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"host"
column=
"host"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createTime"
column=
"create_time"
/>
</resultMap>
<sql
id=
"tableColumns"
>
id, title, host, remark, status, create_time
</sql>
<select
id=
"selectServerList"
resultType=
"com.jomalls.custom.dal.entity.SysComposeServerEntity"
>
SELECT * FROM compose_server
<where>
<if
test=
"server.title != null and server.title != ''"
>
AND title LIKE CONCAT('%', #{server.title}, '%')
</if>
</where>
ORDER BY create_time DESC
</select>
<select
id=
"selectAllServerHost"
resultType=
"com.jomalls.custom.dal.entity.SysComposeServerEntity"
>
SELECT id, host FROM compose_server WHERE status = 1
</select>
<update
id=
"updateStatusById"
>
UPDATE compose_server SET status = #{status} WHERE id = #{id}
</update>
</mapper>
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysComposeServerController.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
webapp
.
controller
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.annotation.RequiresPermissions
;
import
com.jomalls.custom.app.service.system.SysComposeServerService
;
import
com.jomalls.custom.dal.entity.SysComposeServerEntity
;
import
com.jomalls.custom.utils.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 服务器管理 Controller
*
* @author Lizh
* @date 2026-07-14
*/
@Slf4j
@RestController
@RequestMapping
(
"/api/v2/system/composeServer"
)
@RequiredArgsConstructor
@Tag
(
name
=
"服务器管理"
)
public
class
SysComposeServerController
{
private
final
SysComposeServerService
sysComposeServerService
;
@Operation
(
summary
=
"分页查询服务器列表"
)
@RequiresPermissions
(
"system:composeServer:list"
)
@PostMapping
(
"/list"
)
public
R
<
IPage
<
SysComposeServerEntity
>>
list
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
SysComposeServerEntity
server
)
{
Page
<
SysComposeServerEntity
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
IPage
<
SysComposeServerEntity
>
result
=
sysComposeServerService
.
pageList
(
server
,
page
);
return
R
.
ok
(
result
);
}
@Operation
(
summary
=
"新增服务器"
)
@PostMapping
(
"/add"
)
public
R
<
Void
>
add
(
@RequestBody
SysComposeServerEntity
server
)
{
sysComposeServerService
.
add
(
server
);
return
R
.
ok
();
}
@Operation
(
summary
=
"修改服务器"
)
@PostMapping
(
"/updateById"
)
public
R
<
Void
>
updateById
(
@RequestBody
SysComposeServerEntity
server
)
{
sysComposeServerService
.
updateById
(
server
);
return
R
.
ok
();
}
@Operation
(
summary
=
"删除服务器"
)
@GetMapping
(
"/deleteById"
)
public
R
<
Void
>
deleteById
(
@RequestParam
Long
id
)
{
sysComposeServerService
.
deleteById
(
id
);
return
R
.
ok
();
}
@Operation
(
summary
=
"更新服务器状态"
)
@GetMapping
(
"/updateStatusById"
)
public
R
<
Void
>
updateStatusById
(
@RequestParam
Long
id
,
@RequestParam
Integer
status
)
{
sysComposeServerService
.
updateStatusById
(
id
,
status
);
return
R
.
ok
();
}
@Operation
(
summary
=
"获取所有启用的服务器主机地址"
)
@GetMapping
(
"/getAllServerHost"
)
public
R
<
List
<
SysComposeServerEntity
>>
getAllServerHost
()
{
List
<
SysComposeServerEntity
>
list
=
sysComposeServerService
.
getAllServerHost
();
return
R
.
ok
(
list
);
}
}
custom-server-webapp/src/main/java/com/jomalls/custom/webapp/controller/system/SysComposeServerLogController.java
0 → 100644
View file @
3dca12a3
package
com
.
jomalls
.
custom
.
webapp
.
controller
.
system
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.jomalls.custom.app.annotation.RequiresPermissions
;
import
com.jomalls.custom.app.service.system.SysComposeServerLogService
;
import
com.jomalls.custom.dal.entity.SysComposeServerLogEntity
;
import
com.jomalls.custom.utils.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 服务器日志管理 Controller
*
* @author Lizh
* @date 2026-07-14
*/
@Slf4j
@RestController
@RequestMapping
(
"/api/v2/system/composeServerLog"
)
@RequiredArgsConstructor
@Tag
(
name
=
"服务器日志管理"
)
public
class
SysComposeServerLogController
{
private
final
SysComposeServerLogService
sysComposeServerLogService
;
@Operation
(
summary
=
"分页查询服务器日志列表"
)
@RequiresPermissions
(
"system:composeServerLog:list"
)
@PostMapping
(
"/list"
)
public
R
<
IPage
<
SysComposeServerLogEntity
>>
list
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
SysComposeServerLogEntity
log
)
{
Page
<
SysComposeServerLogEntity
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
IPage
<
SysComposeServerLogEntity
>
result
=
sysComposeServerLogService
.
pageList
(
log
,
page
);
return
R
.
ok
(
result
);
}
@Operation
(
summary
=
"批量删除服务器日志"
)
@PostMapping
(
"/deleteByIdList"
)
public
R
<
Void
>
deleteByIdList
(
@RequestBody
List
<
Long
>
idList
)
{
sysComposeServerLogService
.
deleteByIdList
(
idList
);
return
R
.
ok
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment