Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9d664a46
authored
Feb 10, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:检测师新增修改删除接口
1 parent
04d8861f
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
712 additions
and
0 deletions
.gitignore
aus-admin/pom.xml
aus-admin/src/main/java/com/glsx/usedcar/config/OpenApiConfig.java
aus-admin/src/main/java/com/glsx/usedcar/web/rest/inspect/InspectorController.java
aus-core/src/main/java/com/glsx/usedcar/enums/common/DeleteFlag.java
aus-core/src/main/java/com/glsx/usedcar/enums/inspect/InspectorStatus.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectorRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/Inspector.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectorService.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectorAddVO.java
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectorUpdateVO.java
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
aus-framework/src/main/java/org/summerframework/core/exception/BusinessCodeException.java
aus-framework/src/main/java/org/summerframework/core/util/StringUtils.java
pom.xml
.gitignore
View file @
9d664a4
...
@@ -20,3 +20,9 @@
...
@@ -20,3 +20,9 @@
/aus-admin/src/main/resources/static/main/main/assets/
/aus-admin/src/main/resources/static/main/main/assets/
/aus-admin/src/main/resources/static/main/tinymce/
/aus-admin/src/main/resources/static/main/tinymce/
/aus-admin/src/main/resources/static/main/index.html
/aus-admin/src/main/resources/static/main/index.html
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
.kotlin
aus-admin/pom.xml
View file @
9d664a4
...
@@ -162,6 +162,10 @@
...
@@ -162,6 +162,10 @@
<scope>
test
</scope>
<scope>
test
</scope>
<type>
jar
</type>
<type>
jar
</type>
</dependency>
</dependency>
<dependency>
<groupId>
com.github.xingfudeshi
</groupId>
<artifactId>
knife4j-openapi3-jakarta-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
aus-admin/src/main/java/com/glsx/usedcar/config/OpenApiConfig.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
config
;
import
io.swagger.v3.oas.models.OpenAPI
;
import
io.swagger.v3.oas.models.info.Contact
;
import
io.swagger.v3.oas.models.info.Info
;
import
io.swagger.v3.oas.models.info.License
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* <pre>
* Knife4j/OpenAPI配置类
* 用于启用和配置Swagger文档
* 访问地址:<a href="http://localhost:6903/admin/doc.html">aus-admin API文档</a>
* </pre>
* @author yangwei
* @since 2026/2/9 18:25
*/
@Configuration
public
class
OpenApiConfig
{
@Bean
public
OpenAPI
customOpenApi
()
{
return
new
OpenAPI
()
.
info
(
new
Info
()
.
title
(
"aus-admin API文档"
)
.
version
(
"1.0.0"
)
.
description
(
"专电优拍后台管理系统API接口文档"
)
.
contact
(
new
Contact
()
.
name
(
"开发团队"
)
.
email
(
"yangwei@didihu.com.cn"
)
.
url
(
"https://gitee.com/foutouren/aus.git"
))
.
license
(
new
License
()
.
name
(
"Apache 2.0"
)
.
url
(
"http://www.apache.org/licenses/LICENSE-2.0.html"
)));
}
}
\ No newline at end of file
\ No newline at end of file
aus-admin/src/main/java/com/glsx/usedcar/web/rest/inspect/InspectorController.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
web
.
rest
.
inspect
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.module.inspect.service.InspectorService
;
import
com.glsx.usedcar.module.inspect.vo.InspectorAddVO
;
import
com.glsx.usedcar.module.inspect.vo.InspectorUpdateVO
;
import
com.glsx.usedcar.resp.BaseResp
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.NotNull
;
import
jakarta.validation.constraints.Positive
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.orm.validator.UpdateValidGroup
;
/**
* 检测师控制器
* @author yangwei
* @version 1.0
* @since 2026/02/09 15:45
*/
@Slf4j
@Tag
(
name
=
"检测师管理接口"
,
description
=
"检测师信息的增删改查操作"
)
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/rest/inspect"
)
public
class
InspectorController
{
private
final
InspectorService
inspectorService
;
@Operation
(
summary
=
"新增检测师"
,
description
=
"添加新的检测师信息,包含姓名、手机号、初始密码等基本信息"
)
@PostMapping
(
"/add"
)
public
BaseResp
<
Void
>
addInspector
(
@Valid
@RequestBody
InspectorAddVO
addVO
)
{
log
.
info
(
"新增检测师请求: 姓名={}, 手机号={}"
,
addVO
.
getName
(),
addVO
.
getPhone
());
try
{
inspectorService
.
addInspector
(
addVO
);
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"新增检测师失败!业务异常!"
,
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
StrUtil
.
toString
(
be
.
getMessage
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"新增检测师失败!系统异常!"
,
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
return
BaseResp
.
success
();
}
@Operation
(
summary
=
"修改检测师"
,
description
=
"根据检测师ID修改检测师信息"
)
@PutMapping
(
"/update/{id}"
)
public
BaseResp
<
Void
>
updateInspector
(
@Parameter
(
description
=
"检测师ID"
)
@NotNull
(
message
=
"检测师ID不能为空"
)
@Positive
(
message
=
"检测师ID必须为正数"
)
@PathVariable
(
"id"
)
Long
id
,
@Validated
(
UpdateValidGroup
.
class
)
@RequestBody
InspectorUpdateVO
updateVO
)
{
log
.
info
(
"修改检测师请求: ID={}, 姓名={}"
,
id
,
updateVO
.
getName
());
try
{
inspectorService
.
updateInspector
(
id
,
updateVO
);
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"修改检测师失败!业务异常!"
,
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
StrUtil
.
toString
(
be
.
getMessage
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"修改检测师失败!系统异常!"
,
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
return
BaseResp
.
success
();
}
@Operation
(
summary
=
"删除检测师"
,
description
=
"根据检测师ID删除检测师(逻辑删除)"
)
@DeleteMapping
(
"/delete/{id}"
)
public
BaseResp
<
Void
>
deleteInspector
(
@Parameter
(
description
=
"检测师ID"
,
required
=
true
)
@NotNull
(
message
=
"检测师ID不能为空"
)
@Positive
(
message
=
"检测师ID必须为正数"
)
@PathVariable
(
"id"
)
Long
id
)
{
log
.
info
(
"删除检测师请求: ID={}"
,
id
);
try
{
inspectorService
.
deleteInspector
(
id
);
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"删除检测师失败!业务异常!"
,
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
StrUtil
.
toString
(
be
.
getMessage
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"删除检测师失败!系统异常!"
,
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
return
BaseResp
.
success
();
}
}
aus-core/src/main/java/com/glsx/usedcar/enums/common/DeleteFlag.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
enums
.
common
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 删除状态
* @author yangwei
* @version 1.0
* @since 2026/02/09 15:41
*/
@Getter
@AllArgsConstructor
public
enum
DeleteFlag
{
/**
* 未删除
*/
NOT_DELETED
(
"N"
,
"未删除"
),
/**
* 已删除
*/
DELETED
(
"D"
,
"已删除"
);
private
final
String
code
;
private
final
String
description
;
}
aus-core/src/main/java/com/glsx/usedcar/enums/inspect/InspectorStatus.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
enums
.
inspect
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 检测师状态
* @author yangwei
* @version 1.0
* @since 2026/02/09 15:39
*/
@Getter
@AllArgsConstructor
public
enum
InspectorStatus
{
/**
* 正常
*/
NORMAL
(
1
,
"正常"
),
/**
* 禁用
*/
DISABLED
(
0
,
"禁用"
);
private
final
int
code
;
private
final
String
description
;
}
aus-core/src/main/java/com/glsx/usedcar/module/inspect/dao/InspectorRepository.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
module
.
inspect
.
dao
;
import
com.glsx.usedcar.module.inspect.entity.Inspector
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
import
org.summerframework.orm.BaseRepository
;
import
java.util.Optional
;
/**
* 检测师数据访问层
* @author yangwei
* @since 2026/2/9 15:34
*/
@Repository
public
interface
InspectorRepository
extends
BaseRepository
<
Inspector
,
Long
>,
JpaSpecificationExecutor
<
Inspector
>
{
/**
* 根据手机号查询检测师
*
* @param phone 手机号
* @return 检测师信息
*/
Optional
<
Inspector
>
findByPhone
(
String
phone
);
}
aus-core/src/main/java/com/glsx/usedcar/module/inspect/entity/Inspector.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
module
.
inspect
.
entity
;
import
com.fasterxml.jackson.annotation.JsonView
;
import
jakarta.persistence.*
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.Size
;
import
lombok.*
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
org.summerframework.orm.entity.AuditingEntity
;
import
org.summerframework.orm.validator.CreateValidGroup
;
import
org.summerframework.orm.validator.UpdateValidGroup
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
/**
* 检测师(Inspector)实体类
* @author yangwei
* @since 2026/2/9 15:36
*/
@Entity
@Getter
@Setter
@Builder
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"inspectors"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
Inspector
extends
AuditingEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
8929192115233965495L
;
public
interface
Summary
{
}
/**
* 主键ID
*/
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"ID"
,
unique
=
true
,
nullable
=
false
)
@JsonView
(
value
=
Summary
.
class
)
private
Long
id
;
/**
* 姓名
*/
@JsonView
(
value
=
Summary
.
class
)
@NotBlank
(
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Size
(
max
=
64
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"NAME"
,
nullable
=
false
,
length
=
64
)
private
String
name
;
/**
* 工号
*/
@JsonView
(
value
=
Summary
.
class
)
@Size
(
max
=
64
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"EMPLOYEE_NO"
,
nullable
=
true
,
length
=
64
)
private
String
employeeNo
;
/**
* 初始密码
*/
@NotBlank
(
groups
=
{
CreateValidGroup
.
class
})
@Size
(
max
=
128
,
groups
=
{
CreateValidGroup
.
class
})
@Column
(
name
=
"PASSWORD"
,
nullable
=
false
,
length
=
128
)
private
String
password
;
/**
* 所属区域
*/
@Size
(
max
=
128
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"REGION"
,
nullable
=
true
,
length
=
128
)
private
String
region
;
/**
* 手机号
*/
@Size
(
max
=
20
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"PHONE"
,
nullable
=
true
,
length
=
20
)
private
String
phone
;
/**
* 邮箱
*/
@Size
(
max
=
128
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"EMAIL"
,
nullable
=
true
,
length
=
128
)
private
String
email
;
/**
* 状态 1:正常 0:禁用
*/
@JsonView
(
value
=
Summary
.
class
)
@Column
(
name
=
"STATUS"
,
nullable
=
false
)
@Builder
.
Default
private
Integer
status
=
1
;
/**
* 删除标识 N:未删除 D:已删除
*/
@Builder
.
Default
@Column
(
name
=
"DELETE_FLAG"
,
nullable
=
false
,
length
=
1
)
private
String
deleteFlag
=
"N"
;
/**
* 备注
*/
@Size
(
max
=
512
,
groups
=
{
CreateValidGroup
.
class
,
UpdateValidGroup
.
class
})
@Column
(
name
=
"REMARK"
,
nullable
=
true
,
length
=
512
)
private
String
remark
;
}
\ No newline at end of file
\ No newline at end of file
aus-core/src/main/java/com/glsx/usedcar/module/inspect/service/InspectorService.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
module
.
inspect
.
service
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.inspect.InspectorStatus
;
import
com.glsx.usedcar.module.inspect.dao.InspectorRepository
;
import
com.glsx.usedcar.module.inspect.entity.Inspector
;
import
com.glsx.usedcar.module.inspect.vo.InspectorAddVO
;
import
com.glsx.usedcar.module.inspect.vo.InspectorUpdateVO
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
java.util.Objects
;
/**
* 检测师服务
* @author yangwei
* @version 1.0
* @since 2026/02/09 15:46
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
)
public
class
InspectorService
{
private
final
InspectorRepository
inspectorRepository
;
/**
* 新增检测师
* @author yangwei
* @since 2026/2/9 16:10
* @param addVO 新增请求VO
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addInspector
(
InspectorAddVO
addVO
)
{
// 检查手机号是否已存在
if
(
inspectorRepository
.
findByPhone
(
addVO
.
getPhone
()).
isPresent
())
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PHONE_ALREADY_EXISTS
,
addVO
.
getPhone
());
}
// 创建检测师实体
Inspector
inspector
=
Inspector
.
builder
()
.
name
(
addVO
.
getName
())
.
phone
(
addVO
.
getPhone
())
.
password
(
addVO
.
getPassword
())
.
status
(
InspectorStatus
.
NORMAL
.
getCode
())
.
deleteFlag
(
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
build
();
// 保存到数据库
inspectorRepository
.
save
(
inspector
);
log
.
info
(
"检测师新增成功: ID={}"
,
inspector
.
getId
());
}
/**
* 修改检测师
* @author yangwei
* @since 2026/2/9 18:50
* @param id 检测师ID
* @param updateVO 修改请求VO
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateInspector
(
Long
id
,
InspectorUpdateVO
updateVO
)
{
// 查找检测师
Inspector
inspector
=
inspectorRepository
.
findById
(
id
)
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
DATA_NOT_EXIST
,
"检测师不存在"
));
// 检查手机号是否已被其他检测师使用
if
(
updateVO
.
getPhone
()
!=
null
&&
!
Objects
.
equals
(
inspector
.
getPhone
(),
updateVO
.
getPhone
()))
{
if
(
inspectorRepository
.
findByPhone
(
updateVO
.
getPhone
()).
isPresent
())
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
PHONE_ALREADY_EXISTS
,
updateVO
.
getPhone
());
}
}
// 更新检测师信息
inspector
.
setName
(
updateVO
.
getName
());
inspector
.
setPhone
(
updateVO
.
getPhone
());
inspector
.
setStatus
(
updateVO
.
getStatus
());
// 保存到数据库
inspectorRepository
.
save
(
inspector
);
log
.
info
(
"检测师修改成功: ID={}"
,
inspector
.
getId
());
}
/**
* 删除检测师(逻辑删除)
* @author yangwei
* @since 2026/2/9 18:55
* @param id 检测师ID
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteInspector
(
Long
id
)
{
// 查找检测师
Inspector
inspector
=
inspectorRepository
.
findById
(
id
)
.
orElseThrow
(()
->
new
BusinessCodeException
(
ErrorCodeEnum
.
DATA_NOT_EXIST
,
"检测师不存在"
));
// 逻辑删除
inspector
.
setDeleteFlag
(
DeleteFlag
.
DELETED
.
getCode
());
inspectorRepository
.
save
(
inspector
);
log
.
info
(
"检测师删除成功: ID={}"
,
inspector
.
getId
());
}
}
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectorAddVO.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
module
.
inspect
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.Pattern
;
import
jakarta.validation.constraints.Size
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
/**
* 检测师新增请求VO
*
* @author yangwi
* @since 2026-02-09 16:00:00
*/
@Data
@Schema
(
description
=
"检测师新增请求参数"
)
public
class
InspectorAddVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
374733149988979493L
;
@Schema
(
description
=
"姓名"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"张三"
)
@NotBlank
(
message
=
"姓名不能为空"
)
@Size
(
max
=
64
,
message
=
"姓名长度不能超过64个字符"
)
private
String
name
;
@Schema
(
description
=
"手机号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"13800138000"
)
@NotBlank
(
message
=
"手机号不能为空"
)
@Pattern
(
regexp
=
"^1[3-9]\\d{9}$"
,
message
=
"手机号格式不正确"
)
@Size
(
max
=
20
,
message
=
"手机号长度不能超过20个字符"
)
private
String
phone
;
@Schema
(
description
=
"初始密码"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"123456"
)
@NotBlank
(
message
=
"初始密码不能为空"
)
@Size
(
min
=
6
,
max
=
20
,
message
=
"密码长度必须在6-20个字符之间"
)
private
String
password
;
}
\ No newline at end of file
\ No newline at end of file
aus-core/src/main/java/com/glsx/usedcar/module/inspect/vo/InspectorUpdateVO.java
0 → 100644
View file @
9d664a4
package
com
.
glsx
.
usedcar
.
module
.
inspect
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.Size
;
import
lombok.Data
;
import
org.summerframework.orm.validator.UpdateValidGroup
;
import
java.io.Serial
;
import
java.io.Serializable
;
/**
* 检测师修改VO
* @author yangwei
* @since 2026/2/9 18:45
*/
@Data
@Schema
(
description
=
"检测师修改请求VO"
)
public
class
InspectorUpdateVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
3467823456789012345L
;
/**
* 姓名
*/
@Schema
(
description
=
"姓名"
,
example
=
"张三"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotBlank
(
message
=
"姓名不能为空"
,
groups
=
UpdateValidGroup
.
class
)
@Size
(
max
=
64
,
message
=
"姓名长度不能超过64个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
name
;
/**
* 工号
*/
@Schema
(
description
=
"工号"
,
example
=
"EMP001"
)
@Size
(
max
=
64
,
message
=
"工号长度不能超过64个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
employeeNo
;
/**
* 所属区域
*/
@Schema
(
description
=
"所属区域"
,
example
=
"北京"
)
@Size
(
max
=
128
,
message
=
"所属区域长度不能超过128个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
region
;
/**
* 手机号
*/
@Schema
(
description
=
"手机号"
,
example
=
"13800138000"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotBlank
(
message
=
"手机号不能为空"
,
groups
=
UpdateValidGroup
.
class
)
@Size
(
max
=
20
,
message
=
"手机号长度不能超过{max}个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
phone
;
/**
* 邮箱
*/
@Schema
(
description
=
"邮箱"
,
example
=
"zhangsan@example.com"
)
@Size
(
max
=
128
,
message
=
"邮箱长度不能超过{max}个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
email
;
/**
* 状态 1:正常 0:禁用
*/
@Schema
(
description
=
"状态 1:正常 0:禁用"
,
example
=
"1"
)
private
Integer
status
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
,
example
=
"优秀检测师"
)
@Size
(
max
=
512
,
message
=
"备注长度不能超过{max}个字符"
,
groups
=
UpdateValidGroup
.
class
)
private
String
remark
;
}
\ No newline at end of file
\ No newline at end of file
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
0 → 100644
View file @
9d664a4
package
org
.
summerframework
.
core
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 错误代码枚举
* @author yangwei
* @version 1.0
* @since 2026/02/09 16:16
*/
@Getter
@AllArgsConstructor
public
enum
ErrorCodeEnum
{
SYSTEM_ERROR
(
1000
,
"系统异常,请稍后重试"
),
PARAM_INVALID
(
1001
,
"参数校验失败"
),
DATABASE_ERROR
(
1002
,
"数据库操作失败"
),
FEIGN_ERROR
(
1003
,
"feign调用失败"
),
DATA_NOT_EXIST
(
1004
,
"数据不存在"
),
VALIDATION_ERROR
(
1005
,
"参数校验失败"
),
LOGIN_ERROR
(
1006
,
"未登录或登录已过期,请重新登录"
),
/* 七位错误码,第一位标志位,前三位模块,后三位具体错误码 */
/** 检测模块 1001 */
DATA_NOT_EXISTS
(
1001001
,
"id为[{0}]的[{1}]不存在!"
),
PHONE_ALREADY_EXISTS
(
1001002
,
"手机号[{0}]已存在"
);
private
final
Integer
code
;
private
final
String
message
;
}
aus-framework/src/main/java/org/summerframework/core/exception/BusinessCodeException.java
0 → 100644
View file @
9d664a4
package
org
.
summerframework
.
core
.
exception
;
import
lombok.Getter
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.util.StringUtils
;
import
java.io.Serial
;
/**
* 业务异常
* @author yangwei
* @version 1.0
* @since 2026/02/09 16:15
*/
@Getter
public
class
BusinessCodeException
extends
RuntimeException
{
@Serial
private
static
final
long
serialVersionUID
=
5832258083468488295L
;
private
final
Integer
code
;
public
BusinessCodeException
(
String
message
)
{
super
(
message
);
this
.
code
=
ErrorCodeEnum
.
SYSTEM_ERROR
.
getCode
();
}
public
BusinessCodeException
(
ErrorCodeEnum
errorCodeEnum
,
Object
...
params
)
{
super
(
StringUtils
.
templateFormat
(
errorCodeEnum
.
getMessage
(),
params
));
this
.
code
=
errorCodeEnum
.
getCode
();
}
public
BusinessCodeException
(
ErrorCodeEnum
errorCodeEnum
)
{
super
(
errorCodeEnum
.
getMessage
());
this
.
code
=
errorCodeEnum
.
getCode
();
}
public
BusinessCodeException
(
Integer
code
,
String
message
,
Object
...
params
)
{
super
(
StringUtils
.
templateFormat
(
message
,
params
));
this
.
code
=
code
;
}
public
BusinessCodeException
(
Integer
code
,
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
this
.
code
=
code
;
}
}
aus-framework/src/main/java/org/summerframework/core/util/StringUtils.java
0 → 100644
View file @
9d664a4
package
org
.
summerframework
.
core
.
util
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.experimental.UtilityClass
;
import
java.text.MessageFormat
;
/**
* @author yangwei
* @version 1.0
* @since 2026/02/09 16:21
*/
@UtilityClass
public
class
StringUtils
{
/**
* <pre>
* 模版替换
* eg: template = "hello {0}", params = {"world"}; => "hello world"
* </pre>
* @author yangwei
* @since 2025/11/24 14:50
* @param template 需要替换的模版
* @param params 替换参数
* @return java.lang.String
*/
public
String
templateFormat
(
String
template
,
Object
...
params
)
{
return
MessageFormat
.
format
(
template
,
params
);
}
/**
* <pre>
* 根据分隔符截取字符串
* eg: str = "hello world", split = " ", index = 1; => "world"
* </pre>
* @author yangwei
* @since 2025/12/11 10:50
* @param str 源字符串
* @param split 分隔符
* @param index 截取的索引
* @return java.lang.String
*/
public
String
truncateStringBySplit
(
String
str
,
String
split
,
int
index
)
{
if
(
StrUtil
.
isBlank
(
str
))
{
return
null
;
}
String
[]
splitArr
=
str
.
split
(
split
);
return
splitArr
.
length
>
index
?
splitArr
[
index
]
:
null
;
}
}
pom.xml
View file @
9d664a4
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
<minio.version>
8.5.6
</minio.version>
<minio.version>
8.5.6
</minio.version>
<commons-io.version>
2.14.0
</commons-io.version>
<commons-io.version>
2.14.0
</commons-io.version>
<junit-bom.version>
5.9.1
</junit-bom.version>
<junit-bom.version>
5.9.1
</junit-bom.version>
<knife4j.version>
4.6.0
</knife4j.version>
<!-- 仓库地址(抽离统一维护) -->
<!-- 仓库地址(抽离统一维护) -->
<company.nexus.url>
http://192.168.3.194:9898/nexus/content/groups/public/
</company.nexus.url>
<company.nexus.url>
http://192.168.3.194:9898/nexus/content/groups/public/
</company.nexus.url>
...
@@ -141,6 +142,12 @@
...
@@ -141,6 +142,12 @@
<scope>
import
</scope>
<scope>
import
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.github.xingfudeshi
</groupId>
<artifactId>
knife4j-openapi3-jakarta-spring-boot-starter
</artifactId>
<version>
${knife4j.version}
</version>
</dependency>
<!-- 基础工具依赖 -->
<!-- 基础工具依赖 -->
<dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<groupId>
org.projectlombok
</groupId>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment