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 bc4a3ee9
authored
Apr 21, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:发拍自测+接口开发提交
1 parent
31cd569d
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1505 additions
and
32 deletions
aus-admin/src/main/java/com/glsx/usedcar/web/rest/event/EventTrackingController.java
aus-config/src/main/resources/config/aus-vr-dev.yaml
aus-core/src/main/java/com/glsx/usedcar/aspect/DataPermissionAspect.java
aus-core/src/main/java/com/glsx/usedcar/consts/common/CommonConsts.java
aus-core/src/main/java/com/glsx/usedcar/converts/VrSystemConverter.java
aus-core/src/main/java/com/glsx/usedcar/enums/common/DataPermissionType.java
aus-core/src/main/java/com/glsx/usedcar/enums/event/BusinessTypeEnum.java
aus-core/src/main/java/com/glsx/usedcar/enums/event/EventSourceEnum.java
aus-core/src/main/java/com/glsx/usedcar/enums/event/ParamTypeEnum.java
aus-core/src/main/java/com/glsx/usedcar/enums/vr/OrgTypeEnum.java
aus-core/src/main/java/com/glsx/usedcar/enums/common/VrRoleCodeEnum.java → aus-core/src/main/java/com/glsx/usedcar/enums/vr/VrRoleCodeEnum.java
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingBusinessKeyRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingParamRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTypeConfigRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTracking.java
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTrackingBusinessKey.java
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTrackingParam.java
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTypeConfig.java
aus-core/src/main/java/com/glsx/usedcar/module/event/service/EventTrackingService.java
aus-core/src/main/java/com/glsx/usedcar/module/event/vo/EventTrackingBatchSaveVO.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/config/VrLoginProperties.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrAuditService.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrLoginService.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrOrgService.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/specifications/VrOrgSpecifications.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/vo/VrAuditPageRespVO.java
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
aus-vr-api/src/main/java/com/glsx/usedcar/controller/EventTrackingController.java
aus-vr/src/main/java/com/glsx/usedcar/controller/EventTrackingController.java
aus-vr/src/main/java/com/glsx/usedcar/controller/VrOrgController.java
aus-vr/src/main/java/com/glsx/usedcar/export/VrAuditExportBean.java
aus-vr/src/main/resources/bootstrap.yaml
aus-vr/src/main/resources/sql/vr_init_data.sql
aus-vr/src/main/resources/sql/vr_schema.sql
aus-admin/src/main/java/com/glsx/usedcar/web/rest/event/EventTrackingController.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
web
.
rest
.
event
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.enums.event.EventSourceEnum
;
import
com.glsx.usedcar.module.event.service.EventTrackingService
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO
;
import
com.glsx.usedcar.module.security.entity.User
;
import
com.glsx.usedcar.resp.BaseResp
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.core.Authentication
;
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.RestController
;
import
org.summerframework.core.exception.BusinessCodeException
;
/**
* 埋点事件控制器
*
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:12
*/
@Slf4j
@RestController
@RequestMapping
(
"/rest/eventTracking"
)
@RequiredArgsConstructor
@Tag
(
name
=
"埋点事件控制器"
,
description
=
"埋点事件控制器"
)
public
class
EventTrackingController
{
private
final
EventTrackingService
eventTrackingService
;
/**
* 批量保存埋点事件
*
* @param vo 请求体(包含事件列表、业务主键、扩展参数)
* @param authentication 当前登录用户
* @return 操作结果
*/
@PostMapping
(
"/batchSave"
)
@Operation
(
summary
=
"批量保存埋点事件"
,
description
=
"前端批量上报用户行为埋点事件,支持同时携带业务主键和扩展参数"
)
public
BaseResp
<
Void
>
batchSave
(
@Valid
@RequestBody
EventTrackingBatchSaveVO
vo
,
Authentication
authentication
)
{
log
.
info
(
"【接口请求】批量保存埋点事件,操作人={},事件数量={}"
,
getUserName
(
authentication
),
vo
.
getEvents
()
==
null
?
0
:
vo
.
getEvents
().
size
());
try
{
User
user
=
(
User
)
authentication
.
getPrincipal
();
eventTrackingService
.
batchSave
(
vo
,
String
.
valueOf
(
user
.
getUserId
()),
user
.
getUserName
(),
EventSourceEnum
.
ADMIN
.
getSource
());
return
BaseResp
.
success
();
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},业务异常!"
,
getUserName
(
authentication
),
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
be
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},系统异常!"
,
getUserName
(
authentication
),
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
}
private
String
getUserName
(
Authentication
authentication
)
{
try
{
return
authentication
!=
null
?
((
User
)
authentication
.
getPrincipal
()).
getUserName
()
:
"未知用户"
;
}
catch
(
Exception
e
)
{
return
"未知用户"
;
}
}
}
aus-config/src/main/resources/config/aus-vr-dev.yaml
View file @
bc4a3ee
# 开发环境配置
# 开发环境配置
server
:
server
:
port
:
1
6905
port
:
6905
servlet
:
servlet
:
context-path
:
/vr
context-path
:
/vr
logging
:
logging
:
...
...
aus-core/src/main/java/com/glsx/usedcar/aspect/DataPermissionAspect.java
View file @
bc4a3ee
...
@@ -6,7 +6,7 @@ import com.glsx.usedcar.config.VrApplicationCondition;
...
@@ -6,7 +6,7 @@ import com.glsx.usedcar.config.VrApplicationCondition;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.
common
.VrRoleCodeEnum
;
import
com.glsx.usedcar.enums.
vr
.VrRoleCodeEnum
;
import
com.glsx.usedcar.module.vrsystem.dao.VrOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrRoleRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrRoleRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
...
...
aus-core/src/main/java/com/glsx/usedcar/consts/common/CommonConsts.java
View file @
bc4a3ee
...
@@ -14,6 +14,10 @@ public interface CommonConsts {
...
@@ -14,6 +14,10 @@ public interface CommonConsts {
/** 1 */
/** 1 */
String
ONE
=
"1"
;
String
ONE
=
"1"
;
Integer
ZERO_INT
=
0
;
Integer
ONE_INT
=
1
;
/** desc */
/** desc */
String
DESC
=
"desc"
;
String
DESC
=
"desc"
;
...
...
aus-core/src/main/java/com/glsx/usedcar/converts/VrSystemConverter.java
View file @
bc4a3ee
...
@@ -6,6 +6,7 @@ import com.glsx.usedcar.module.vrsystem.entity.VrRole;
...
@@ -6,6 +6,7 @@ import com.glsx.usedcar.module.vrsystem.entity.VrRole;
import
com.glsx.usedcar.module.vrsystem.entity.VrUser
;
import
com.glsx.usedcar.module.vrsystem.entity.VrUser
;
import
com.glsx.usedcar.module.vrsystem.vo.*
;
import
com.glsx.usedcar.module.vrsystem.vo.*
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mapping
;
import
org.mapstruct.MappingTarget
;
import
org.mapstruct.MappingTarget
;
import
java.util.List
;
import
java.util.List
;
...
@@ -52,5 +53,7 @@ public interface VrSystemConverter {
...
@@ -52,5 +53,7 @@ public interface VrSystemConverter {
void
updateOrgFromVO
(
VrOrgUpdateVO
updateVO
,
@MappingTarget
VrOrg
org
);
void
updateOrgFromVO
(
VrOrgUpdateVO
updateVO
,
@MappingTarget
VrOrg
org
);
@Mapping
(
target
=
"vrOrgId"
,
source
=
"id"
)
@Mapping
(
target
=
"vrOrgName"
,
source
=
"orgName"
)
VrOrgStoreRespVO
org2StoreRespVO
(
VrOrg
vrOrg
);
VrOrgStoreRespVO
org2StoreRespVO
(
VrOrg
vrOrg
);
}
}
aus-core/src/main/java/com/glsx/usedcar/enums/common/DataPermissionType.java
View file @
bc4a3ee
...
@@ -14,12 +14,12 @@ import lombok.Getter;
...
@@ -14,12 +14,12 @@ import lombok.Getter;
public
enum
DataPermissionType
{
public
enum
DataPermissionType
{
/**
/**
* 按用户ID过滤
* 按用户ID过滤
,指定该类型时,集团账号会默认获取到集团下的所有用户
*/
*/
USER_ID
(
"userId"
,
"用户ID"
),
USER_ID
(
"userId"
,
"用户ID"
),
/**
/**
* 按组织ID过滤
* 按组织ID过滤
,指定该类型时,集团账号会默认获取到集团下的所有门店,包含该集团
*/
*/
ORG_ID
(
"orgId"
,
"组织ID"
);
ORG_ID
(
"orgId"
,
"组织ID"
);
...
...
aus-core/src/main/java/com/glsx/usedcar/enums/event/BusinessTypeEnum.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
enums
.
event
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 埋点时间业务类型枚举
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:27
*/
@Getter
@AllArgsConstructor
public
enum
BusinessTypeEnum
{
INSPECTION_MANAGEMENT
(
"INSPECTION_MANAGEMENT"
,
"检测管理"
),
REPORT
(
"REPORT"
,
"报表"
),
VEHICLE
(
"VEHICLE"
,
"车辆"
),
WORK_ORDER
(
"WORK_ORDER"
,
"工单"
);
private
final
String
value
;
private
final
String
desc
;
}
aus-core/src/main/java/com/glsx/usedcar/enums/event/EventSourceEnum.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
enums
.
event
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 事件来源,admin、api、inspector
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:32
*/
@Getter
@AllArgsConstructor
public
enum
EventSourceEnum
{
ADMIN
(
"admin"
,
"拍卖端pc后台"
),
API
(
"api"
,
"拍卖端小程序"
),
INSPECTOR
(
"inspector"
,
"车辆检测平台"
),
VR
(
"vr"
,
"发拍端pc后台"
),
VR_API
(
"vr_api"
,
"发拍端小程序"
),
OTHER
(
"other"
,
"其他"
);
private
final
String
source
;
private
final
String
description
;
}
aus-core/src/main/java/com/glsx/usedcar/enums/event/ParamTypeEnum.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
enums
.
event
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 埋点事件参数类型
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:24
*/
@Getter
@AllArgsConstructor
public
enum
ParamTypeEnum
{
// 参数类型: STRING, NUMBER, BOOLEAN, ARRAY, OBJECT
STRING
(
"STRING"
),
NUMBER
(
"NUMBER"
),
BOOLEAN
(
"BOOLEAN"
),
ARRAY
(
"ARRAY"
),
OBJECT
(
"OBJECT"
);
private
final
String
value
;
}
aus-core/src/main/java/com/glsx/usedcar/enums/vr/OrgTypeEnum.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
enums
.
vr
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* 机构类型枚举
* @author yangwei
* @version 1.0
* @since 2026/04/21 13:58
*/
@Getter
@AllArgsConstructor
public
enum
OrgTypeEnum
{
GROUP
(
1
,
"集团"
),
STORE
(
2
,
"门店"
);
private
final
Integer
code
;
private
final
String
description
;
}
aus-core/src/main/java/com/glsx/usedcar/enums/
common
/VrRoleCodeEnum.java
→
aus-core/src/main/java/com/glsx/usedcar/enums/
vr
/VrRoleCodeEnum.java
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
enums
.
common
;
package
com
.
glsx
.
usedcar
.
enums
.
vr
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Getter
;
...
...
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingBusinessKeyRepository.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
dao
;
import
com.glsx.usedcar.module.event.entity.EventTrackingBusinessKey
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
import
org.summerframework.orm.BaseRepository
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 埋点事件业务主键表数据访问层
*
* @author yangwei
* @since 2026/4/7
*/
@Repository
public
interface
EventTrackingBusinessKeyRepository
extends
BaseRepository
<
EventTrackingBusinessKey
,
Long
>,
JpaSpecificationExecutor
<
EventTrackingBusinessKey
>
{
/**
* 根据事件ID和删除标识查询业务主键列表
*
* @param eventId 事件ID
* @param deleteFlag 删除标识
* @return 业务主键列表
*/
List
<
EventTrackingBusinessKey
>
findByEventIdAndDeleteFlag
(
Long
eventId
,
String
deleteFlag
);
/**
* 根据业务类型和业务主键及删除标识查询列表
*
* @param businessType 业务类型
* @param businessKey 业务主键
* @param deleteFlag 删除标识
* @return 业务主键列表
*/
List
<
EventTrackingBusinessKey
>
findByBusinessTypeAndBusinessKeyAndDeleteFlag
(
String
businessType
,
String
businessKey
,
String
deleteFlag
);
/**
* 根据事件ID、业务类型、业务主键及删除标识查询
*
* @param eventId 事件ID
* @param businessType 业务类型
* @param businessKey 业务主键
* @param deleteFlag 删除标识
* @return 业务主键信息
*/
Optional
<
EventTrackingBusinessKey
>
findByEventIdAndBusinessTypeAndBusinessKeyAndDeleteFlag
(
Long
eventId
,
String
businessType
,
String
businessKey
,
String
deleteFlag
);
/**
* 根据事件ID列表和删除标识查询业务主键列表
*
* @param eventIds 事件ID列表
* @param deleteFlag 删除标识
* @return 业务主键列表
*/
List
<
EventTrackingBusinessKey
>
findByEventIdInAndDeleteFlag
(
List
<
Long
>
eventIds
,
String
deleteFlag
);
}
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingParamRepository.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
dao
;
import
com.glsx.usedcar.module.event.entity.EventTrackingParam
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
import
org.summerframework.orm.BaseRepository
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 埋点事件参数表数据访问层
*
* @author yangwei
* @since 2026/4/7
*/
@Repository
public
interface
EventTrackingParamRepository
extends
BaseRepository
<
EventTrackingParam
,
Long
>,
JpaSpecificationExecutor
<
EventTrackingParam
>
{
/**
* 根据事件ID和删除标识查询参数列表
*
* @param eventId 事件ID
* @param deleteFlag 删除标识
* @return 参数列表
*/
List
<
EventTrackingParam
>
findByEventIdAndDeleteFlag
(
Long
eventId
,
String
deleteFlag
);
/**
* 根据事件ID、参数键和删除标识查询参数
*
* @param eventId 事件ID
* @param paramKey 参数键
* @param deleteFlag 删除标识
* @return 参数信息
*/
Optional
<
EventTrackingParam
>
findByEventIdAndParamKeyAndDeleteFlag
(
Long
eventId
,
String
paramKey
,
String
deleteFlag
);
/**
* 根据事件ID列表和删除标识查询参数列表
*
* @param eventIds 事件ID列表
* @param deleteFlag 删除标识
* @return 参数列表
*/
List
<
EventTrackingParam
>
findByEventIdInAndDeleteFlag
(
List
<
Long
>
eventIds
,
String
deleteFlag
);
/**
* 根据参数键和删除标识查询参数列表
*
* @param paramKey 参数键
* @param deleteFlag 删除标识
* @return 参数列表
*/
List
<
EventTrackingParam
>
findByParamKeyAndDeleteFlag
(
String
paramKey
,
String
deleteFlag
);
}
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTrackingRepository.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
dao
;
import
com.glsx.usedcar.module.event.entity.EventTracking
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
import
org.summerframework.orm.BaseRepository
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* 埋点事件主表数据访问层
*
* @author yangwei
* @since 2026/4/7
*/
@Repository
public
interface
EventTrackingRepository
extends
BaseRepository
<
EventTracking
,
Long
>,
JpaSpecificationExecutor
<
EventTracking
>
{
/**
* 根据事件代码和删除标识查询列表
*
* @param eventCode 事件代码
* @param deleteFlag 删除标识
* @return 事件列表
*/
List
<
EventTracking
>
findByEventCodeAndDeleteFlag
(
String
eventCode
,
String
deleteFlag
);
/**
* 根据账户ID和删除标识查询列表
*
* @param accountId 账户ID
* @param deleteFlag 删除标识
* @return 事件列表
*/
List
<
EventTracking
>
findByAccountIdAndDeleteFlag
(
String
accountId
,
String
deleteFlag
);
/**
* 根据账户ID、事件代码和删除标识查询列表
*
* @param accountId 账户ID
* @param eventCode 事件代码
* @param deleteFlag 删除标识
* @return 事件列表
*/
List
<
EventTracking
>
findByAccountIdAndEventCodeAndDeleteFlag
(
String
accountId
,
String
eventCode
,
String
deleteFlag
);
/**
* 根据事件时间范围和删除标识查询列表
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param deleteFlag 删除标识
* @return 事件列表
*/
List
<
EventTracking
>
findByEventTimeBetweenAndDeleteFlag
(
LocalDateTime
startTime
,
LocalDateTime
endTime
,
String
deleteFlag
);
}
aus-core/src/main/java/com/glsx/usedcar/module/event/dao/EventTypeConfigRepository.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
dao
;
import
com.glsx.usedcar.module.event.entity.EventTypeConfig
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
import
org.summerframework.orm.BaseRepository
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 事件类型配置表数据访问层
*
* @author yangwei
* @since 2026/4/7
*/
@Repository
public
interface
EventTypeConfigRepository
extends
BaseRepository
<
EventTypeConfig
,
Long
>,
JpaSpecificationExecutor
<
EventTypeConfig
>
{
/**
* 根据事件名称和删除标识查询
*
* @param eventName 事件名称
* @param deleteFlag 删除标识
* @return 事件类型配置
*/
Optional
<
EventTypeConfig
>
findByEventNameAndDeleteFlag
(
String
eventName
,
String
deleteFlag
);
/**
* 根据事件代码和删除标识查询
*
* @param eventCode 事件代码
* @param deleteFlag 删除标识
* @return 事件类型配置
*/
Optional
<
EventTypeConfig
>
findByEventCodeAndDeleteFlag
(
String
eventCode
,
String
deleteFlag
);
/**
* 根据事件类型和删除标识查询列表
*
* @param eventType 事件类型
* @param deleteFlag 删除标识
* @return 事件类型配置列表
*/
List
<
EventTypeConfig
>
findByEventTypeAndDeleteFlag
(
String
eventType
,
String
deleteFlag
);
/**
* 根据所属模块和删除标识查询列表
*
* @param module 所属模块
* @param deleteFlag 删除标识
* @return 事件类型配置列表
*/
List
<
EventTypeConfig
>
findByModuleAndDeleteFlag
(
String
module
,
String
deleteFlag
);
/**
* 根据启用状态和删除标识查询列表
*
* @param isActive 是否启用
* @param deleteFlag 删除标识
* @return 事件类型配置列表
*/
List
<
EventTypeConfig
>
findByIsActiveAndDeleteFlag
(
Integer
isActive
,
String
deleteFlag
);
}
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTracking.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
entity
;
import
jakarta.persistence.*
;
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
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
/**
* 埋点事件主表(EventTracking)实体类
*
* @author yangwei
* @since 2026/4/7
*/
@Entity
@Getter
@Setter
@Builder
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"event_tracking"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
EventTracking
extends
AuditingEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2325290238446386363L
;
/**
* 主键ID
*/
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"EVENT_ID"
,
unique
=
true
,
nullable
=
false
)
private
Long
eventId
;
/**
* 事件代码
*/
@Column
(
name
=
"EVENT_CODE"
,
nullable
=
false
,
length
=
128
)
private
String
eventCode
;
/**
* 事件来源,admin、api、inspector
* @see com.glsx.usedcar.enums.event.EventSourceEnum
*/
@Column
(
name
=
"SOURCE"
,
nullable
=
false
,
length
=
128
)
private
String
source
;
/**
* 操作人账户ID
*/
@Column
(
name
=
"ACCOUNT_ID"
,
nullable
=
false
,
length
=
64
)
private
String
accountId
;
/**
* 操作人账户名称
*/
@Column
(
name
=
"ACCOUNT_NAME"
,
nullable
=
false
,
length
=
64
)
private
String
accountName
;
/**
* 操作人工号
*/
@Column
(
name
=
"OPERATOR_ID"
,
length
=
64
)
private
String
operatorId
;
/**
* 时长(秒),用于页面停留事件
*/
@Column
(
name
=
"DURATION"
)
private
Integer
duration
;
/**
* 事件时间
*/
@Column
(
name
=
"EVENT_TIME"
,
nullable
=
false
)
private
LocalDateTime
eventTime
;
/**
* 删除标识 N:未删除 D:已删除
*/
@Builder
.
Default
@Column
(
name
=
"DELETE_FLAG"
,
nullable
=
false
,
length
=
1
)
private
String
deleteFlag
=
"N"
;
/**
* 备注
*/
@Column
(
name
=
"REMARK"
,
length
=
256
)
private
String
remark
;
}
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTrackingBusinessKey.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
entity
;
import
jakarta.persistence.*
;
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
java.io.Serial
;
import
java.io.Serializable
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
/**
* 埋点事件业务主键表(EventTrackingBusinessKey)实体类
*
* @author yangwei
* @since 2026/4/7
*/
@Entity
@Getter
@Setter
@Builder
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"event_tracking_business_key"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
EventTrackingBusinessKey
extends
AuditingEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5710355237303945508L
;
/**
* 主键ID
*/
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"BIZ_ID"
,
unique
=
true
,
nullable
=
false
)
private
Long
bizId
;
/**
* 关联 event_tracking.event_id
*/
@Column
(
name
=
"EVENT_ID"
,
nullable
=
false
)
private
Long
eventId
;
/**
* 业务类型: REPORT-报告, VEHICLE-车辆, WORK_ORDER-工单...
*/
@Column
(
name
=
"BUSINESS_TYPE"
,
nullable
=
false
,
length
=
64
)
private
String
businessType
;
/**
* 业务主键
*/
@Column
(
name
=
"BUSINESS_KEY"
,
nullable
=
false
,
length
=
128
)
private
String
businessKey
;
/**
* 删除标识 N:未删除 D:已删除
*/
@Builder
.
Default
@Column
(
name
=
"DELETE_FLAG"
,
nullable
=
false
,
length
=
1
)
private
String
deleteFlag
=
"N"
;
/**
* 备注
*/
@Column
(
name
=
"REMARK"
,
length
=
256
)
private
String
remark
;
}
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTrackingParam.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
entity
;
import
jakarta.persistence.*
;
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
java.io.Serial
;
import
java.io.Serializable
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
/**
* 埋点事件参数表(EventTrackingParam)实体类
*
* @author yangwei
* @since 2026/4/7
*/
@Entity
@Getter
@Setter
@Builder
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"event_tracking_param"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
EventTrackingParam
extends
AuditingEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
928261531995021747L
;
/**
* 主键ID
*/
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"PARAM_ID"
,
unique
=
true
,
nullable
=
false
)
private
Long
paramId
;
/**
* 关联 event_tracking.event_id
*/
@Column
(
name
=
"EVENT_ID"
,
nullable
=
false
)
private
Long
eventId
;
/**
* 参数键
*/
@Column
(
name
=
"PARAM_KEY"
,
nullable
=
false
,
length
=
100
)
private
String
paramKey
;
/**
* 参数值
*/
@Column
(
name
=
"PARAM_VALUE"
,
columnDefinition
=
"TEXT"
)
private
String
paramValue
;
/**
* 参数类型: STRING, NUMBER, BOOLEAN, ARRAY, OBJECT
*/
@Builder
.
Default
@Column
(
name
=
"PARAM_TYPE"
,
length
=
32
)
private
String
paramType
=
"STRING"
;
/**
* 删除标识 N:未删除 D:已删除
*/
@Builder
.
Default
@Column
(
name
=
"DELETE_FLAG"
,
nullable
=
false
,
length
=
1
)
private
String
deleteFlag
=
"N"
;
/**
* 备注
*/
@Column
(
name
=
"REMARK"
,
length
=
256
)
private
String
remark
;
}
aus-core/src/main/java/com/glsx/usedcar/module/event/entity/EventTypeConfig.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
entity
;
import
jakarta.persistence.*
;
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
java.io.Serial
;
import
java.io.Serializable
;
import
static
jakarta
.
persistence
.
GenerationType
.
IDENTITY
;
/**
* 事件类型配置表(EventTypeConfig)实体类
*
* @author yangwei
* @since 2026/4/7
*/
@Entity
@Getter
@Setter
@Builder
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"event_type_config"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
EventTypeConfig
extends
AuditingEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2192070012796048699L
;
/**
* 主键ID
*/
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"ID"
,
unique
=
true
,
nullable
=
false
)
private
Long
id
;
/**
* 事件类型: CLICK-点击事件, PAGE_VIEW-页面浏览, PAGE_DURATION-页面停留时长
*/
@Column
(
name
=
"EVENT_TYPE"
,
nullable
=
false
,
length
=
32
)
private
String
eventType
;
/**
* 事件代码
*/
@Column
(
name
=
"EVENT_CODE"
,
nullable
=
false
,
length
=
128
)
private
String
eventCode
;
/**
* 事件名称
*/
@Column
(
name
=
"EVENT_NAME"
,
nullable
=
false
,
length
=
128
)
private
String
eventName
;
/**
* 事件描述
*/
@Column
(
name
=
"EVENT_DESC"
,
length
=
512
)
private
String
eventDesc
;
/**
* 所属模块
*/
@Column
(
name
=
"MODULE"
,
length
=
64
)
private
String
module
;
/**
* 是否启用 1:启用 0:禁用
*/
@Builder
.
Default
@Column
(
name
=
"IS_ACTIVE"
,
nullable
=
false
)
private
Integer
isActive
=
1
;
/**
* 删除标识 N:未删除 D:已删除
*/
@Builder
.
Default
@Column
(
name
=
"DELETE_FLAG"
,
nullable
=
false
,
length
=
1
)
private
String
deleteFlag
=
"N"
;
/**
* 备注
*/
@Column
(
name
=
"REMARK"
,
length
=
256
)
private
String
remark
;
}
aus-core/src/main/java/com/glsx/usedcar/module/event/service/EventTrackingService.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
service
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.consts.common.CommonConsts
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.event.EventSourceEnum
;
import
com.glsx.usedcar.enums.event.ParamTypeEnum
;
import
com.glsx.usedcar.module.event.dao.EventTrackingBusinessKeyRepository
;
import
com.glsx.usedcar.module.event.dao.EventTrackingParamRepository
;
import
com.glsx.usedcar.module.event.dao.EventTrackingRepository
;
import
com.glsx.usedcar.module.event.dao.EventTypeConfigRepository
;
import
com.glsx.usedcar.module.event.entity.EventTracking
;
import
com.glsx.usedcar.module.event.entity.EventTrackingBusinessKey
;
import
com.glsx.usedcar.module.event.entity.EventTrackingParam
;
import
com.glsx.usedcar.module.event.entity.EventTypeConfig
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO.BusinessKeyVO
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO.EventTrackingItemVO
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO.ParamVO
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 埋点事件服务
*
* @author yangwei
* @version 1.0
* @since 2026/04/07
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
EventTrackingService
{
private
final
EventTrackingRepository
eventTrackingRepository
;
private
final
EventTypeConfigRepository
eventTypeConfigRepository
;
private
final
EventTrackingParamRepository
eventTrackingParamRepository
;
private
final
EventTrackingBusinessKeyRepository
eventTrackingBusinessKeyRepository
;
/**
* 批量保存埋点事件
* <p>
* 流程:
* 1. 校验 eventCode 在 event_type_config 中存在且启用
* 2. 批量插入 event_tracking 主表
* 3. 批量插入 event_tracking_business_key(若有)
* 4. 批量插入 event_tracking_param(若有)
*
* @param vo 批量请求体
* @param accountId 操作人账户ID
* @param accountName 操作人账户名称
* @param source 来源标识(admin / api / inspector)
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
batchSave
(
EventTrackingBatchSaveVO
vo
,
String
accountId
,
String
accountName
,
String
source
)
{
List
<
EventTrackingItemVO
>
items
=
vo
.
getEvents
();
// 1. 收集所有 eventCode,批量查 event_type_config 做合法性校验
Set
<
String
>
eventCodes
=
items
.
stream
()
.
map
(
EventTrackingItemVO:
:
getEventCode
)
.
collect
(
Collectors
.
toSet
());
List
<
EventTypeConfig
>
configs
=
eventTypeConfigRepository
.
findByIsActiveAndDeleteFlag
(
CommonConsts
.
ONE_INT
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
Map
<
String
,
EventTypeConfig
>
configMap
=
configs
.
stream
()
.
collect
(
Collectors
.
toMap
(
EventTypeConfig:
:
getEventCode
,
Function
.
identity
(),
(
pre
,
next
)
->
pre
));
// 校验所有 eventCode 均在配置中
for
(
String
code
:
eventCodes
)
{
if
(!
configMap
.
containsKey
(
code
))
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
EVENT_CODE_NOT_CONFIG
,
code
);
}
}
// 2. 批量插入 event_tracking 主表
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
EventTracking
>
trackings
=
items
.
stream
()
.
map
(
item
->
EventTracking
.
builder
()
.
eventCode
(
item
.
getEventCode
())
.
accountId
(
accountId
)
.
accountName
(
accountName
)
.
source
(
StrUtil
.
blankToDefault
(
source
,
EventSourceEnum
.
ADMIN
.
getSource
()))
.
eventTime
(
item
.
getEventTime
()
!=
null
?
item
.
getEventTime
()
:
now
)
.
duration
(
item
.
getDuration
())
.
remark
(
item
.
getRemark
())
.
build
())
.
collect
(
Collectors
.
toList
());
List
<
EventTracking
>
savedTrackings
=
eventTrackingRepository
.
saveAll
(
trackings
);
log
.
info
(
"【埋点】批量保存事件主表成功,数量={}"
,
savedTrackings
.
size
());
// 3. 批量插入业务主键 & 参数(按索引对应)
List
<
EventTrackingBusinessKey
>
bizKeys
=
new
ArrayList
<>();
List
<
EventTrackingParam
>
params
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
items
.
size
();
i
++)
{
EventTrackingItemVO
item
=
items
.
get
(
i
);
Long
eventId
=
savedTrackings
.
get
(
i
).
getEventId
();
// 业务主键
if
(
CollUtil
.
isNotEmpty
(
item
.
getBusinessKeys
()))
{
for
(
BusinessKeyVO
bk
:
item
.
getBusinessKeys
())
{
bizKeys
.
add
(
EventTrackingBusinessKey
.
builder
()
.
eventId
(
eventId
)
.
businessType
(
bk
.
getBusinessType
())
.
businessKey
(
bk
.
getBusinessKey
())
.
build
());
}
}
// 扩展参数
if
(
CollUtil
.
isNotEmpty
(
item
.
getParams
()))
{
for
(
ParamVO
p
:
item
.
getParams
())
{
params
.
add
(
EventTrackingParam
.
builder
()
.
eventId
(
eventId
)
.
paramKey
(
p
.
getParamKey
())
.
paramValue
(
p
.
getParamValue
())
.
paramType
(
StrUtil
.
blankToDefault
(
p
.
getParamType
(),
ParamTypeEnum
.
STRING
.
getValue
()))
.
build
());
}
}
}
if
(
CollUtil
.
isNotEmpty
(
bizKeys
))
{
eventTrackingBusinessKeyRepository
.
saveAll
(
bizKeys
);
log
.
info
(
"【埋点】批量保存业务主键成功,数量={}"
,
bizKeys
.
size
());
}
if
(
CollUtil
.
isNotEmpty
(
params
))
{
eventTrackingParamRepository
.
saveAll
(
params
);
log
.
info
(
"【埋点】批量保存参数成功,数量={}"
,
params
.
size
());
}
}
}
aus-core/src/main/java/com/glsx/usedcar/module/event/vo/EventTrackingBatchSaveVO.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
event
.
vo
;
import
com.glsx.usedcar.enums.event.BusinessTypeEnum
;
import
com.glsx.usedcar.enums.event.ParamTypeEnum
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
jakarta.validation.Valid
;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.NotEmpty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* 埋点事件批量保存请求 VO
*
* @author yangwei
* @version 1.0
* @since 2026/04/07
*/
@Data
@Schema
(
description
=
"埋点事件批量保存请求 VO"
)
public
class
EventTrackingBatchSaveVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
6490522758631650481L
;
/**
* 事件列表,至少包含一条
*/
@Valid
@NotEmpty
(
message
=
"事件列表不能为空"
)
@Schema
(
description
=
"事件列表"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
List
<
EventTrackingItemVO
>
events
;
// ----------------------------------------------------------------
// 单条事件 VO
// ----------------------------------------------------------------
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"单条埋点事件"
)
public
static
class
EventTrackingItemVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
3543221761509804738L
;
/**
* 事件代码,需在 event_type_config 中已配置且启用
*/
@NotBlank
(
message
=
"事件代码不能为空"
)
@Schema
(
description
=
"事件代码"
,
example
=
"REPORT_DETAIL_VIEW"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
private
String
eventCode
;
/**
* 事件时间(前端传入,格式 yyyy-MM-dd HH:mm:ss)
* 为空时取服务器当前时间
*/
@Schema
(
description
=
"事件时间,为空则取服务器时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
eventTime
;
/**
* 时长(秒),仅页面停留类事件需传
*/
@Schema
(
description
=
"时长(秒),页面停留事件使用"
)
private
Integer
duration
;
/**
* 备注
*/
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
* 业务主键列表(可选)
*/
@Valid
@Schema
(
description
=
"业务主键列表"
)
private
List
<
BusinessKeyVO
>
businessKeys
;
/**
* 扩展参数列表(可选)
*/
@Valid
@Schema
(
description
=
"扩展参数列表"
)
private
List
<
ParamVO
>
params
;
}
// ----------------------------------------------------------------
// 业务主键 VO
// ----------------------------------------------------------------
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"业务主键"
)
public
static
class
BusinessKeyVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
3401073440486276291L
;
/**
* 业务类型,如 REPORT、VEHICLE、WORK_ORDER
* @see com.glsx.usedcar.enums.event.BusinessTypeEnum
*/
@NotBlank
(
message
=
"业务类型不能为空"
)
@Schema
(
description
=
"业务类型,如 REPORT、VEHICLE、WORK_ORDER"
,
example
=
"REPORT"
)
@Builder
.
Default
private
String
businessType
=
BusinessTypeEnum
.
INSPECTION_MANAGEMENT
.
getValue
();
/**
* 业务主键值
*/
@NotBlank
(
message
=
"业务主键不能为空"
)
@Schema
(
description
=
"业务主键"
,
example
=
"123456"
)
private
String
businessKey
;
}
// ----------------------------------------------------------------
// 扩展参数 VO
// ----------------------------------------------------------------
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema
(
description
=
"扩展参数"
)
public
static
class
ParamVO
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2621909004110488768L
;
/**
* 参数键
*/
@NotBlank
(
message
=
"参数键不能为空"
)
@Schema
(
description
=
"参数键"
,
example
=
"page_name"
)
private
String
paramKey
;
/**
* 参数值
*/
@Schema
(
description
=
"参数值"
)
private
String
paramValue
;
/**
* 参数类型: STRING, NUMBER, BOOLEAN, ARRAY, OBJECT
*/
@Schema
(
description
=
"参数类型:STRING, NUMBER, BOOLEAN, ARRAY, OBJECT"
,
example
=
"STRING"
)
@Builder
.
Default
private
String
paramType
=
ParamTypeEnum
.
STRING
.
getValue
();
}
}
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/config/VrLoginProperties.java
View file @
bc4a3ee
...
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
...
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
/**
/**
* VR系统登录配置属性
* VR系统登录配置属性
* @author yangwei
*/
*/
@Data
@Data
@Component
@Component
...
@@ -39,4 +40,29 @@ public class VrLoginProperties {
...
@@ -39,4 +40,29 @@ public class VrLoginProperties {
"/swagger-resources/**"
,
"/swagger-resources/**"
,
"/webjars/**"
"/webjars/**"
};
};
/**
* 登录失败计数窗口时间(秒),默认15分钟=900秒
*/
private
Integer
failWindowSeconds
=
900
;
/**
* 允许的最大登录失败次数,默认5次
*/
private
Integer
maxFailCount
=
5
;
/**
* 账号锁定时间(秒),默认15分钟=900秒
*/
private
Integer
lockSeconds
=
900
;
/**
* 登录失败计数Redis key前缀
*/
private
String
failKeyPrefix
=
"vr:login:fail:"
;
/**
* 登录锁定Redis key前缀
*/
private
String
lockKeyPrefix
=
"vr:login:lock:"
;
}
}
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrAuditService.java
View file @
bc4a3ee
...
@@ -11,7 +11,7 @@ import com.glsx.usedcar.consts.common.SymbolConsts;
...
@@ -11,7 +11,7 @@ import com.glsx.usedcar.consts.common.SymbolConsts;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.converts.VrAuditConverter
;
import
com.glsx.usedcar.converts.VrAuditConverter
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.
common
.VrRoleCodeEnum
;
import
com.glsx.usedcar.enums.
vr
.VrRoleCodeEnum
;
import
com.glsx.usedcar.enums.common.WebhooksBusinessType
;
import
com.glsx.usedcar.enums.common.WebhooksBusinessType
;
import
com.glsx.usedcar.handler.WebHookHandler
;
import
com.glsx.usedcar.handler.WebHookHandler
;
import
com.glsx.usedcar.module.auction.dao.AuctionOrderDao
;
import
com.glsx.usedcar.module.auction.dao.AuctionOrderDao
;
...
@@ -21,7 +21,6 @@ import com.glsx.usedcar.module.auction.entity.Auction;
...
@@ -21,7 +21,6 @@ import com.glsx.usedcar.module.auction.entity.Auction;
import
com.glsx.usedcar.module.auction.entity.AuctionOrder
;
import
com.glsx.usedcar.module.auction.entity.AuctionOrder
;
import
com.glsx.usedcar.module.auction.entity.AuctionVehicle
;
import
com.glsx.usedcar.module.auction.entity.AuctionVehicle
;
import
com.glsx.usedcar.module.auction.entity.OrderSnapshot
;
import
com.glsx.usedcar.module.auction.entity.OrderSnapshot
;
import
com.glsx.usedcar.module.auction.entity.*
;
import
com.glsx.usedcar.module.business.entity.NoticeTemplate
;
import
com.glsx.usedcar.module.business.entity.NoticeTemplate
;
import
com.glsx.usedcar.module.business.service.NoticeField
;
import
com.glsx.usedcar.module.business.service.NoticeField
;
import
com.glsx.usedcar.module.vehicle.dao.VehicleDao
;
import
com.glsx.usedcar.module.vehicle.dao.VehicleDao
;
...
@@ -48,7 +47,6 @@ import org.summerframework.core.enums.ErrorCodeEnum;
...
@@ -48,7 +47,6 @@ import org.summerframework.core.enums.ErrorCodeEnum;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Pagination
;
import
org.summerframework.orm.paging.Pagination
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -210,6 +208,11 @@ public class VrAuditService {
...
@@ -210,6 +208,11 @@ public class VrAuditService {
vo
.
setLicensePlate
(
"未上牌"
);
vo
.
setLicensePlate
(
"未上牌"
);
}
}
List
<
String
>
location
=
List
.
of
(
vrAudit
.
getProvinceName
(),
vrAudit
.
getCityName
());
if
(
location
.
stream
().
allMatch
(
StringUtils:
:
hasText
))
{
vo
.
setLocation
(
StrUtil
.
join
(
SymbolConsts
.
HYPHEN
,
location
));
}
// 场次信息:从 AuctionVehicle 获取(取最新场次)
// 场次信息:从 AuctionVehicle 获取(取最新场次)
AuctionVehicle
av
=
finalAvMap
.
get
(
vrAudit
.
getVehicleId
());
AuctionVehicle
av
=
finalAvMap
.
get
(
vrAudit
.
getVehicleId
());
if
(
av
!=
null
)
{
if
(
av
!=
null
)
{
...
@@ -237,7 +240,6 @@ public class VrAuditService {
...
@@ -237,7 +240,6 @@ public class VrAuditService {
}
}
/**
/**
* 保存/编辑发拍单(支持分步草稿保存及最终提交)
* 保存/编辑发拍单(支持分步草稿保存及最终提交)
*
*
...
@@ -907,6 +909,7 @@ public class VrAuditService {
...
@@ -907,6 +909,7 @@ public class VrAuditService {
List
<
CarImage
>
carImages
=
buildCarImages
(
vrAudit
);
List
<
CarImage
>
carImages
=
buildCarImages
(
vrAudit
);
vehicle
.
setCarImages
(
carImages
);
vehicle
.
setCarImages
(
carImages
);
// 设置图库albums和封面cover(左前45度作为默认封面)
// 设置图库albums和封面cover(左前45度作为默认封面)
List
<
FileInfo
>
albumFileInfos
=
carImages
.
stream
().
map
(
CarImage:
:
toFileInfo
).
toList
();
List
<
FileInfo
>
albumFileInfos
=
carImages
.
stream
().
map
(
CarImage:
:
toFileInfo
).
toList
();
vehicle
.
setAlbums
(
albumFileInfos
);
vehicle
.
setAlbums
(
albumFileInfos
);
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrLoginService.java
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
service
;
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
service
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.module.vrsystem.config.VrLoginProperties
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrRole
;
import
com.glsx.usedcar.module.vrsystem.entity.VrRole
;
...
@@ -11,12 +12,15 @@ import com.glsx.usedcar.module.vrsystem.vo.VrLoginRespVO;
...
@@ -11,12 +12,15 @@ import com.glsx.usedcar.module.vrsystem.vo.VrLoginRespVO;
import
com.glsx.usedcar.module.vrsystem.vo.VrLoginUserVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrLoginUserVO
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* VR系统登录服务
* VR系统登录服务
...
@@ -31,27 +35,81 @@ public class VrLoginService {
...
@@ -31,27 +35,81 @@ public class VrLoginService {
private
final
VrOrgService
vrOrgService
;
private
final
VrOrgService
vrOrgService
;
private
final
PasswordEncoder
passwordEncoder
;
private
final
PasswordEncoder
passwordEncoder
;
private
final
RedisTokenUtil
redisTokenUtil
;
private
final
RedisTokenUtil
redisTokenUtil
;
private
final
StringRedisTemplate
redisTemplate
;
private
final
VrLoginProperties
loginProperties
;
/**
* 获取最大失败次数
*/
private
int
getMaxFailCount
()
{
return
loginProperties
.
getMaxFailCount
();
}
/**
* 获取失败计数窗口时间(秒)
*/
private
int
getFailWindowSeconds
()
{
return
loginProperties
.
getFailWindowSeconds
();
}
/**
* 获取账号锁定时间(秒)
*/
private
int
getLockSeconds
()
{
return
loginProperties
.
getLockSeconds
();
}
/**
* 获取登录失败计数Key前缀
*/
private
String
getFailKeyPrefix
()
{
return
loginProperties
.
getFailKeyPrefix
();
}
/**
* 获取登录锁定Key前缀
*/
private
String
getLockKeyPrefix
()
{
return
loginProperties
.
getLockKeyPrefix
();
}
/**
/**
* 用户登录
* 用户登录
* <p>支持登录限频:配置窗口时间内密码错误超过配置次数,账号锁定配置时长</p>
*/
*/
public
VrLoginRespVO
login
(
VrLoginReqVO
loginReqVO
)
{
public
VrLoginRespVO
login
(
VrLoginReqVO
loginReqVO
)
{
// 查询用户
String
phone
=
loginReqVO
.
getPhone
();
VrUser
user
=
vrUserService
.
findByPhone
(
loginReqVO
.
getPhone
());
// 1. 检查账号是否被锁定
Long
lockRemainingSeconds
=
getLockRemainingSeconds
(
phone
);
if
(
lockRemainingSeconds
!=
null
&&
lockRemainingSeconds
>
0
)
{
// 不足1分钟按1分钟计算
long
remainingMinutes
=
(
lockRemainingSeconds
+
59
)
/
60
;
log
.
warn
(
"登录失败,账号已被锁定: phone={}, 剩余锁定时间={}分钟"
,
phone
,
remainingMinutes
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_ACCOUNT_LOCKED
,
remainingMinutes
);
}
// 2. 查询用户
VrUser
user
=
vrUserService
.
findByPhone
(
phone
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
handleLoginFail
(
phone
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_PHONE_PASSWORD_ERROR
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_PHONE_PASSWORD_ERROR
);
}
}
// 检查用户状态
//
3.
检查用户状态
if
(
user
.
getStatus
()
!=
1
)
{
if
(
user
.
getStatus
()
!=
1
)
{
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_ACCOUNT_DISABLED
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_ACCOUNT_DISABLED
);
}
}
// 验证密码
//
4.
验证密码
if
(!
passwordEncoder
.
matches
(
loginReqVO
.
getPassword
(),
user
.
getPassword
()))
{
if
(!
passwordEncoder
.
matches
(
loginReqVO
.
getPassword
(),
user
.
getPassword
()))
{
handleLoginFail
(
phone
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_PHONE_PASSWORD_ERROR
);
throw
new
BusinessCodeException
(
ErrorCodeEnum
.
VR_PHONE_PASSWORD_ERROR
);
}
}
// 5. 登录成功,清除失败计数
clearLoginFailCount
(
phone
);
// 登录时清理该用户的过期token(异步)
// 登录时清理该用户的过期token(异步)
cleanupExpiredTokensAsync
(
user
.
getPhone
());
cleanupExpiredTokensAsync
(
user
.
getPhone
());
...
@@ -96,6 +154,43 @@ public class VrLoginService {
...
@@ -96,6 +154,43 @@ public class VrLoginService {
}
}
/**
/**
* 获取账号剩余锁定时间(秒),未锁定返回 null
*/
private
Long
getLockRemainingSeconds
(
String
phone
)
{
String
lockKey
=
getLockKeyPrefix
()
+
phone
;
Long
ttl
=
redisTemplate
.
getExpire
(
lockKey
,
TimeUnit
.
SECONDS
);
return
ttl
!=
null
&&
ttl
>
0
?
ttl
:
null
;
}
/**
* 处理登录失败:增加失败计数,达到阈值则锁定账号
*/
private
void
handleLoginFail
(
String
phone
)
{
String
failKey
=
getFailKeyPrefix
()
+
phone
;
Long
failCount
=
redisTemplate
.
opsForValue
().
increment
(
failKey
);
if
(
failCount
!=
null
&&
failCount
==
1
)
{
// 第一次失败,设置过期时间
redisTemplate
.
expire
(
failKey
,
getFailWindowSeconds
(),
TimeUnit
.
SECONDS
);
}
if
(
failCount
!=
null
&&
failCount
>=
getMaxFailCount
())
{
// 达到最大失败次数,锁定账号
String
lockKey
=
getLockKeyPrefix
()
+
phone
;
redisTemplate
.
opsForValue
().
set
(
lockKey
,
"1"
,
getLockSeconds
(),
TimeUnit
.
SECONDS
);
log
.
warn
(
"账号锁定: phone={}, {}秒内密码错误{}次"
,
phone
,
getFailWindowSeconds
(),
failCount
);
}
else
{
log
.
warn
(
"登录失败: phone={}, 当前{}秒内错误次数={}"
,
phone
,
getFailWindowSeconds
(),
failCount
);
}
}
/**
* 登录成功后清除失败计数
*/
private
void
clearLoginFailCount
(
String
phone
)
{
String
failKey
=
getFailKeyPrefix
()
+
phone
;
redisTemplate
.
delete
(
failKey
);
}
/**
* 退出登录
* 退出登录
*/
*/
public
void
logout
(
String
token
,
LoginUserDTO
userDTO
)
{
public
void
logout
(
String
token
,
LoginUserDTO
userDTO
)
{
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrOrgService.java
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
service
;
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
service
;
import
cn.hutool.core.lang.func.LambdaUtil
;
import
com.glsx.usedcar.annotation.DataPermission
;
import
com.glsx.usedcar.annotation.DataPermission
;
import
com.glsx.usedcar.converts.VrSystemConverter
;
import
com.glsx.usedcar.converts.VrSystemConverter
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.vr.OrgTypeEnum
;
import
com.glsx.usedcar.module.vrsystem.dao.VrOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
...
@@ -13,14 +15,17 @@ import com.glsx.usedcar.module.vrsystem.vo.VrOrgRespVO;
...
@@ -13,14 +15,17 @@ import com.glsx.usedcar.module.vrsystem.vo.VrOrgRespVO;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgStoreRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgStoreRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgTreeRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgTreeRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgUpdateVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgUpdateVO
;
import
com.google.common.collect.Sets
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.enums.ErrorCodeEnum
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.core.exception.BusinessCodeException
;
import
org.summerframework.orm.entity.AuditingTimeEntity
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -154,11 +159,13 @@ public class VrOrgService {
...
@@ -154,11 +159,13 @@ public class VrOrgService {
}
}
@DataPermission
(
key
=
"orgIds"
,
type
=
DataPermissionType
.
ORG_ID
)
@DataPermission
(
key
=
"orgIds"
,
type
=
DataPermissionType
.
ORG_ID
)
public
List
<
VrOrgStoreRespVO
>
listAllStores
(
Map
<
String
,
Se
t
<
Long
>>
params
)
{
public
List
<
VrOrgStoreRespVO
>
listAllStores
(
Map
<
String
,
Lis
t
<
Long
>>
params
)
{
Specification
<
VrOrg
>
specification
=
VrOrgSpecifications
.
deleteFlagIsN
();
Specification
<
VrOrg
>
specification
=
VrOrgSpecifications
.
deleteFlagIsN
();
Set
<
Long
>
orgIds
=
params
.
get
(
"orgIds"
);
List
<
Long
>
orgIds
=
params
.
getOrDefault
(
"orgIds"
,
List
.
of
());
specification
.
and
(
VrOrgSpecifications
.
orgIdIn
(
orgIds
));
specification
=
specification
.
and
(
VrOrgSpecifications
.
orgIdIn
(
Sets
.
newHashSet
(
orgIds
)));
return
vrOrgRepository
.
findAll
(
specification
)
specification
=
specification
.
and
(
VrOrgSpecifications
.
orgTypeEqual
(
OrgTypeEnum
.
STORE
));
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
LambdaUtil
.
getFieldName
(
AuditingTimeEntity:
:
getCreateTime
));
return
vrOrgRepository
.
findAll
(
specification
,
sort
)
.
stream
()
.
stream
()
.
map
(
vrSystemConverter:
:
org2StoreRespVO
)
.
map
(
vrSystemConverter:
:
org2StoreRespVO
)
.
toList
();
.
toList
();
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/specifications/VrOrgSpecifications.java
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
specifications
;
package
com
.
glsx
.
usedcar
.
module
.
vrsystem
.
specifications
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.glsx.usedcar.consts.common.CommonConsts
;
import
com.glsx.usedcar.consts.common.CommonConsts
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.vr.OrgTypeEnum
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg_
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg_
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
...
@@ -31,6 +34,22 @@ public class VrOrgSpecifications {
...
@@ -31,6 +34,22 @@ public class VrOrgSpecifications {
}
}
/**
/**
* 组织类型等于指定值
* @author yangwei
* @since 2026/4/21 10:16
* @param orgType 组织类型
* @return org.springframework.data.jpa.domain.Specification<com.glsx.usedcar.module.vrsystem.entity.VrOrg>
*/
public
static
Specification
<
VrOrg
>
orgTypeEqual
(
OrgTypeEnum
orgType
)
{
if
(
ObjectUtil
.
isNull
(
orgType
))
{
return
null
;
}
return
(
root
,
query
,
criteriaBuilder
)
->
criteriaBuilder
.
equal
(
root
.
get
(
VrOrg_
.
ORG_TYPE
),
orgType
.
getCode
());
}
/**
* 删除标识为N
* 删除标识为N
* @author yangwei
* @author yangwei
* @since 2026/4/21 10:16
* @since 2026/4/21 10:16
...
@@ -38,6 +57,6 @@ public class VrOrgSpecifications {
...
@@ -38,6 +57,6 @@ public class VrOrgSpecifications {
*/
*/
public
static
Specification
<
VrOrg
>
deleteFlagIsN
()
{
public
static
Specification
<
VrOrg
>
deleteFlagIsN
()
{
return
(
root
,
query
,
criteriaBuilder
)
->
return
(
root
,
query
,
criteriaBuilder
)
->
criteriaBuilder
.
equal
(
root
.
get
(
VrOrg_
.
DELETE_FLAG
),
CommonConsts
.
ZERO
);
criteriaBuilder
.
equal
(
root
.
get
(
VrOrg_
.
DELETE_FLAG
),
DeleteFlag
.
NOT_DELETED
.
getCode
()
);
}
}
}
}
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/vo/VrAuditPageRespVO.java
View file @
bc4a3ee
...
@@ -93,6 +93,15 @@ public class VrAuditPageRespVO {
...
@@ -93,6 +93,15 @@ public class VrAuditPageRespVO {
@Schema
(
description
=
"拍卖次数"
)
@Schema
(
description
=
"拍卖次数"
)
private
Long
auctionCount
;
private
Long
auctionCount
;
@Schema
(
description
=
"发拍申请人ID(关联vr_user表)"
)
private
Long
vrUserId
;
@Schema
(
description
=
"发拍申请人姓名"
)
private
String
vrUserName
;
@Schema
(
description
=
"发拍申请人手机号"
)
private
String
vrUserPhone
;
@Schema
(
description
=
"车款/成交价(万元,仅交易成功状态展示)"
)
@Schema
(
description
=
"车款/成交价(万元,仅交易成功状态展示)"
)
private
BigDecimal
orderPrice
;
private
BigDecimal
orderPrice
;
}
}
aus-framework/src/main/java/org/summerframework/core/enums/ErrorCodeEnum.java
View file @
bc4a3ee
...
@@ -48,7 +48,7 @@ public enum ErrorCodeEnum {
...
@@ -48,7 +48,7 @@ public enum ErrorCodeEnum {
NODE_CHECK_RULE_ERROR
(
1001105
,
"【{0}】校验规则解析异常"
),
NODE_CHECK_RULE_ERROR
(
1001105
,
"【{0}】校验规则解析异常"
),
NOT_CURR_WORK_INSPECTOR
(
1001106
,
"您不是当前工单的检测师,无法提交!"
),
NOT_CURR_WORK_INSPECTOR
(
1001106
,
"您不是当前工单的检测师,无法提交!"
),
EVENT_CODE_NOT_CONFIG
(
1001108
,
"事件代码 [{0}] 未在 event_type_config 中配置或未启用"
),
/** 1002 发拍模块 */
/** 1002 发拍模块 */
VR_PHONE_PASSWORD_ERROR
(
1002001
,
"手机号或密码错误"
),
VR_PHONE_PASSWORD_ERROR
(
1002001
,
"手机号或密码错误"
),
...
@@ -63,6 +63,7 @@ public enum ErrorCodeEnum {
...
@@ -63,6 +63,7 @@ public enum ErrorCodeEnum {
VR_AUDIT_STATUS_NOT_REPUBLISH
(
1002010
,
"当前发拍单状态不允许重新发拍,仅已下架和流拍状态可重新发拍"
),
VR_AUDIT_STATUS_NOT_REPUBLISH
(
1002010
,
"当前发拍单状态不允许重新发拍,仅已下架和流拍状态可重新发拍"
),
VR_AUDIT_NOT_SYNCED_TO_VEHICLE
(
1002011
,
"发拍单未同步到车辆档案,无法重新发拍"
),
VR_AUDIT_NOT_SYNCED_TO_VEHICLE
(
1002011
,
"发拍单未同步到车辆档案,无法重新发拍"
),
VR_AUDIT_RESERVE_PRICE_NOT_FOUND
(
1002012
,
"未找到车辆[{0}]对应的发拍单保留价"
),
VR_AUDIT_RESERVE_PRICE_NOT_FOUND
(
1002012
,
"未找到车辆[{0}]对应的发拍单保留价"
),
VR_ACCOUNT_LOCKED
(
1002013
,
"密码输入次数已达上限,账号已锁定,剩余锁定时间{0}分钟"
),
;
;
private
final
Integer
code
;
private
final
Integer
code
;
private
final
String
message
;
private
final
String
message
;
...
...
aus-vr-api/src/main/java/com/glsx/usedcar/controller/EventTrackingController.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.enums.event.EventSourceEnum
;
import
com.glsx.usedcar.module.event.service.EventTrackingService
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.util.UserContext
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
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.RestController
;
import
org.summerframework.core.exception.BusinessCodeException
;
/**
* 埋点事件控制器
*
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:12
*/
@Slf4j
@RestController
@RequestMapping
(
"/rest/eventTracking"
)
@RequiredArgsConstructor
@Tag
(
name
=
"埋点事件控制器"
,
description
=
"埋点事件控制器"
)
public
class
EventTrackingController
{
private
final
EventTrackingService
eventTrackingService
;
/**
* 批量保存埋点事件
*
* @param vo 请求体(包含事件列表、业务主键、扩展参数)
* @return 操作结果
*/
@PostMapping
(
"/batchSave"
)
@Operation
(
summary
=
"批量保存埋点事件"
,
description
=
"前端批量上报用户行为埋点事件,支持同时携带业务主键和扩展参数"
)
public
BaseResp
<
Void
>
batchSave
(
@Valid
@RequestBody
EventTrackingBatchSaveVO
vo
)
{
LoginUserDTO
user
=
UserContext
.
getUser
();
log
.
info
(
"【接口请求】批量保存埋点事件,操作人={},事件数量={}"
,
user
.
getUserName
(),
vo
.
getEvents
()
==
null
?
0
:
vo
.
getEvents
().
size
());
try
{
eventTrackingService
.
batchSave
(
vo
,
String
.
valueOf
(
user
.
getUserId
()),
user
.
getUserName
(),
EventSourceEnum
.
VR_API
.
getSource
());
return
BaseResp
.
success
();
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},业务异常!"
,
user
.
getUserName
(),
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
be
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},系统异常!"
,
user
.
getUserName
(),
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
}
}
aus-vr/src/main/java/com/glsx/usedcar/controller/EventTrackingController.java
0 → 100644
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
com.glsx.usedcar.enums.event.EventSourceEnum
;
import
com.glsx.usedcar.module.event.service.EventTrackingService
;
import
com.glsx.usedcar.module.event.vo.EventTrackingBatchSaveVO
;
import
com.glsx.usedcar.module.security.entity.User
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.util.UserContext
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
jakarta.validation.Valid
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.security.core.Authentication
;
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.RestController
;
import
org.summerframework.core.exception.BusinessCodeException
;
/**
* 埋点事件控制器
*
* @author yangwei
* @version 1.0
* @since 2026/04/07 21:12
*/
@Slf4j
@RestController
@RequestMapping
(
"/rest/eventTracking"
)
@RequiredArgsConstructor
@Tag
(
name
=
"埋点事件控制器"
,
description
=
"埋点事件控制器"
)
public
class
EventTrackingController
{
private
final
EventTrackingService
eventTrackingService
;
/**
* 批量保存埋点事件
*
* @param vo 请求体(包含事件列表、业务主键、扩展参数)
* @return 操作结果
*/
@PostMapping
(
"/batchSave"
)
@Operation
(
summary
=
"批量保存埋点事件"
,
description
=
"前端批量上报用户行为埋点事件,支持同时携带业务主键和扩展参数"
)
public
BaseResp
<
Void
>
batchSave
(
@Valid
@RequestBody
EventTrackingBatchSaveVO
vo
)
{
LoginUserDTO
user
=
UserContext
.
getUser
();
log
.
info
(
"【接口请求】批量保存埋点事件,操作人={},事件数量={}"
,
user
.
getUserName
(),
vo
.
getEvents
()
==
null
?
0
:
vo
.
getEvents
().
size
());
try
{
eventTrackingService
.
batchSave
(
vo
,
String
.
valueOf
(
user
.
getUserId
()),
user
.
getUserName
(),
EventSourceEnum
.
VR
.
getSource
());
return
BaseResp
.
success
();
}
catch
(
BusinessCodeException
be
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},业务异常!"
,
user
.
getUserName
(),
be
);
return
BaseResp
.
fail
(
StrUtil
.
toString
(
be
.
getCode
()),
be
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"【接口响应】批量保存埋点事件失败!操作人={},系统异常!"
,
user
.
getUserName
(),
e
);
return
BaseResp
.
fail
(
"系统异常: "
+
e
.
getMessage
());
}
}
}
aus-vr/src/main/java/com/glsx/usedcar/controller/VrOrgController.java
View file @
bc4a3ee
package
com
.
glsx
.
usedcar
.
controller
;
package
com
.
glsx
.
usedcar
.
controller
;
import
cn.hutool.core.map.MapUtil
;
import
com.glsx.usedcar.module.vrsystem.service.VrOrgService
;
import
com.glsx.usedcar.module.vrsystem.service.VrOrgService
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgAddVO
;
import
com.glsx.usedcar.module.vrsystem.vo.*
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgTreeRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrOrgUpdateVO
;
import
com.glsx.usedcar.resp.BaseResp
;
import
com.glsx.usedcar.resp.BaseResp
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Parameter
;
...
@@ -15,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -15,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* VR组织机构管理接口
* VR组织机构管理接口
...
@@ -70,4 +69,11 @@ public class VrOrgController {
...
@@ -70,4 +69,11 @@ public class VrOrgController {
vrOrgService
.
deleteOrg
(
id
);
vrOrgService
.
deleteOrg
(
id
);
return
BaseResp
.
success
();
return
BaseResp
.
success
();
}
}
@GetMapping
(
"/list/currUser"
)
@Operation
(
summary
=
"查询门店列表"
,
description
=
"只会查询当前用户拥有权限的门店列表"
)
public
BaseResp
<
List
<
VrOrgStoreRespVO
>>
listAllStores
()
{
List
<
VrOrgStoreRespVO
>
results
=
vrOrgService
.
listAllStores
(
MapUtil
.<
String
,
List
<
Long
>>
builder
().
build
());
return
BaseResp
.
success
(
results
);
}
}
}
aus-vr/src/main/java/com/glsx/usedcar/export/VrAuditExportBean.java
View file @
bc4a3ee
...
@@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
...
@@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.module.vrsystem.entity.VrAudit
;
import
com.glsx.usedcar.module.vrsystem.entity.VrAudit
;
import
com.glsx.usedcar.module.vrsystem.vo.VrAuditPageRespVO
;
import
com.glsx.usedcar.module.vrsystem.vo.VrAuditPageRespVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serial
;
...
@@ -58,18 +59,26 @@ public class VrAuditExportBean implements Serializable {
...
@@ -58,18 +59,26 @@ public class VrAuditExportBean implements Serializable {
@ColumnWidth
(
30
)
@ColumnWidth
(
30
)
private
String
carTypeName
;
private
String
carTypeName
;
@ExcelProperty
(
"发拍用户"
)
@ColumnWidth
(
20
)
private
String
vrUserName
;
@ExcelProperty
(
"用户手机"
)
@ColumnWidth
(
20
)
private
String
vrUserPhone
;
/**
/**
* 省份
* 省份
*/
*/
@ExcelProperty
(
"省份"
)
@ExcelProperty
(
"
车辆所在
省份"
)
@ColumnWidth
(
1
0
)
@ColumnWidth
(
2
0
)
private
String
provinceName
;
private
String
provinceName
;
/**
/**
* 城市
* 城市
*/
*/
@ExcelProperty
(
"城市"
)
@ExcelProperty
(
"
车辆所在
城市"
)
@ColumnWidth
(
1
0
)
@ColumnWidth
(
2
0
)
private
String
cityName
;
private
String
cityName
;
/**
/**
...
@@ -82,7 +91,7 @@ public class VrAuditExportBean implements Serializable {
...
@@ -82,7 +91,7 @@ public class VrAuditExportBean implements Serializable {
/**
/**
* 起拍场次名称
* 起拍场次名称
*/
*/
@ExcelProperty
(
"起拍场次"
)
@ExcelProperty
(
"起拍场次
名称
"
)
@ColumnWidth
(
20
)
@ColumnWidth
(
20
)
private
String
auctionName
;
private
String
auctionName
;
...
@@ -156,6 +165,8 @@ public class VrAuditExportBean implements Serializable {
...
@@ -156,6 +165,8 @@ public class VrAuditExportBean implements Serializable {
.
map
(
price
->
price
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
+
"万元"
)
.
map
(
price
->
price
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
+
"万元"
)
.
orElse
(
SymbolConsts
.
HYPHEN
);
.
orElse
(
SymbolConsts
.
HYPHEN
);
this
.
auctionCount
=
vo
.
getAuctionCount
();
this
.
auctionCount
=
vo
.
getAuctionCount
();
this
.
vrUserName
=
vo
.
getVrUserName
();
this
.
vrUserPhone
=
vo
.
getVrUserPhone
();
this
.
orderPrice
=
Optional
.
ofNullable
(
vo
.
getOrderPrice
())
this
.
orderPrice
=
Optional
.
ofNullable
(
vo
.
getOrderPrice
())
.
filter
(
r
->
Objects
.
equals
(
this
.
status
,
VrAudit
.
PublishStatus
.
SOLD
.
getValue
()
+
StrUtil
.
EMPTY
))
.
filter
(
r
->
Objects
.
equals
(
this
.
status
,
VrAudit
.
PublishStatus
.
SOLD
.
getValue
()
+
StrUtil
.
EMPTY
))
.
map
(
price
->
price
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
+
"万元"
)
.
map
(
price
->
price
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
+
"万元"
)
...
...
aus-vr/src/main/resources/bootstrap.yaml
View file @
bc4a3ee
...
@@ -14,5 +14,5 @@ spring:
...
@@ -14,5 +14,5 @@ spring:
#配置文件后导名称
#配置文件后导名称
profile
:
dev
profile
:
dev
#配置中心地址
#配置中心地址
uri
:
http://127.0.0.1:
1
6900
uri
:
http://127.0.0.1:6900
aus-vr/src/main/resources/sql/vr_init_data.sql
View file @
bc4a3ee
...
@@ -34,9 +34,9 @@ INSERT INTO `vr_menu` (`ID`, `PARENT_ID`, `MENU_NAME`, `MENU_TYPE`, `PATH`, `ICO
...
@@ -34,9 +34,9 @@ INSERT INTO `vr_menu` (`ID`, `PARENT_ID`, `MENU_NAME`, `MENU_TYPE`, `PATH`, `ICO
-- 二级菜单
-- 二级菜单
INSERT
INTO
`vr_menu`
(
`ID`
,
`PARENT_ID`
,
`MENU_NAME`
,
`MENU_TYPE`
,
`PATH`
,
`COMPONENT`
,
`PERMISSION`
,
`ICON`
,
`SORT_ORDER`
,
`VISIBLE`
,
`STATUS`
,
`DELETE_FLAG`
,
`CREATE_BY`
,
`CREATE_TIME`
)
VALUES
INSERT
INTO
`vr_menu`
(
`ID`
,
`PARENT_ID`
,
`MENU_NAME`
,
`MENU_TYPE`
,
`PATH`
,
`COMPONENT`
,
`PERMISSION`
,
`ICON`
,
`SORT_ORDER`
,
`VISIBLE`
,
`STATUS`
,
`DELETE_FLAG`
,
`CREATE_BY`
,
`CREATE_TIME`
)
VALUES
(
3
,
2
,
'账号管理'
,
'C'
,
'/system/user'
,
'system/user/index'
,
'system:user:list'
,
'user'
,
1
,
1
,
1
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
3
,
2
,
'账号管理'
,
'C'
,
'/system/user'
,
'system/user/index'
,
'system:user:list'
,
'user'
,
1
,
1
,
1
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
4
,
2
,
'角色管理'
,
'C'
,
'/system/role'
,
'system/role/index'
,
'system:role:list'
,
'role'
,
2
,
1
,
1
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
4
,
2
,
'角色管理'
,
'C'
,
'/system/role'
,
'system/role/index'
,
'system:role:list'
,
'role'
,
2
,
0
,
0
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
5
,
2
,
'菜单管理'
,
'C'
,
'/system/menu'
,
'system/menu/index'
,
'system:menu:list'
,
'menu'
,
3
,
1
,
1
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
5
,
2
,
'菜单管理'
,
'C'
,
'/system/menu'
,
'system/menu/index'
,
'system:menu:list'
,
'menu'
,
3
,
0
,
0
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
),
(
6
,
2
,
'组织管理'
,
'C'
,
'/system/org'
,
'system/org/index'
,
'system:org:list'
,
'org'
,
4
,
1
,
1
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
);
(
6
,
2
,
'组织管理'
,
'C'
,
'/system/org'
,
'system/org/index'
,
'system:org:list'
,
'org'
,
4
,
0
,
0
,
'N'
,
'系统初始化'
,
'2026-04-01 00:00:00'
);
-- 三级按钮(账号管理下)
-- 三级按钮(账号管理下)
INSERT
INTO
`vr_menu`
(
`ID`
,
`PARENT_ID`
,
`MENU_NAME`
,
`MENU_TYPE`
,
`PERMISSION`
,
`SORT_ORDER`
,
`VISIBLE`
,
`STATUS`
,
`DELETE_FLAG`
,
`CREATE_BY`
,
`CREATE_TIME`
)
VALUES
INSERT
INTO
`vr_menu`
(
`ID`
,
`PARENT_ID`
,
`MENU_NAME`
,
`MENU_TYPE`
,
`PERMISSION`
,
`SORT_ORDER`
,
`VISIBLE`
,
`STATUS`
,
`DELETE_FLAG`
,
`CREATE_BY`
,
`CREATE_TIME`
)
VALUES
...
@@ -64,3 +64,26 @@ INSERT INTO `vr_role_menu` (`ROLE_ID`, `MENU_ID`) VALUES
...
@@ -64,3 +64,26 @@ INSERT INTO `vr_role_menu` (`ROLE_ID`, `MENU_ID`) VALUES
(
2
,
1
),
(
2
,
1
),
-- 门店账号 -> 仅发拍管理
-- 门店账号 -> 仅发拍管理
(
3
,
1
);
(
3
,
1
);
-- 埋点
-- 删除已存在的事件配置
DELETE
FROM
event_type_config
WHERE
event_code
IN
(
'denglu_dianji'
,
'liebiao_puguang'
,
'xinzeng_dianji'
,
'liucheng_zhongduan'
,
'saoma_shibie_chufa'
,
'tijiao_chenggong'
);
-- 插入事件类型配置
INSERT
INTO
`event_type_config`
(
`EVENT_TYPE`
,
`EVENT_CODE`
,
`EVENT_NAME`
,
`EVENT_DESC`
,
`MODULE`
,
`IS_ACTIVE`
,
`CREATE_TIME`
)
VALUES
(
'CLICK'
,
'denglu_dianji'
,
'登录-点击登录按钮'
,
'点击“登录”按钮触发,【漏斗起点】 监测登录转化率及失败拦截率。'
,
'VR_LOGIN'
,
1
,
NOW
()),
(
'PAGE_VIEW'
,
'liebiao_puguang'
,
'发拍-列表曝光'
,
'列表数据加载完成并曝光展示触发,【行为分析】了解用户核心关注的单据状态分类,评估列表页流转效率。'
,
'VR_AUDIT'
,
1
,
NOW
()),
(
'CLICK'
,
'xinzeng_dianji'
,
'发拍-点击新增按钮'
,
'发拍单新增按钮触发,【转化基数】发拍业务的核心起点,作为发拍漏斗计算总的基数分母。'
,
'VR_AUDIT'
,
1
,
NOW
()),
(
'CLICK'
,
'liucheng_zhongduan'
,
'发拍流程-中断'
,
'填写过程中点击“返回”或直接关闭当前流程触发,【断点诊断】精准定位用户在哪一环节流失,便于后续优化长表单结构或交互体验。'
,
'VR_AUDIT'
,
1
,
NOW
()),
(
'CLICK'
,
'saoma_shibie_chufa'
,
'发拍-扫码识别触发'
,
'点击输入框旁边的“相机识别辅助”图标触发,【功能评估】评估智能辅助录入工具的使用率及成功率,验证其是否有效降低了车架号输入的错误成本。'
,
'VR_AUDIT'
,
1
,
NOW
()),
(
'CLICK'
,
'tijiao_chenggong'
,
'发拍-提交成功'
,
'点击“提交发拍”按钮且服务端返回成功触发,【完成转化】发拍全链路的终结事件,用于计算最终的整体业务发拍成功率。'
,
'VR_AUDIT'
,
1
,
NOW
());
aus-vr/src/main/resources/sql/vr_schema.sql
View file @
bc4a3ee
...
@@ -123,3 +123,85 @@ CREATE TABLE `vr_user_org` (
...
@@ -123,3 +123,85 @@ CREATE TABLE `vr_user_org` (
KEY
`idx_user_id`
(
`USER_ID`
),
KEY
`idx_user_id`
(
`USER_ID`
),
KEY
`idx_org_id`
(
`ORG_ID`
)
KEY
`idx_org_id`
(
`ORG_ID`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'VR用户组织关系表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'VR用户组织关系表'
;
CREATE
TABLE
IF
NOT
EXISTS
`event_tracking`
(
`EVENT_ID`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID'
,
`EVENT_CODE`
varchar
(
128
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'事件代码'
,
`SOURCE`
varchar
(
32
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'事件来源,admin、api、inspector'
,
`ACCOUNT_ID`
varchar
(
64
)
NOT
NULL
COMMENT
'操作人账户ID'
,
`ACCOUNT_NAME`
varchar
(
64
)
NOT
NULL
COMMENT
'操作人账户名称'
,
`OPERATOR_ID`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'操作人工号'
,
`DURATION`
int
(
11
)
DEFAULT
NULL
COMMENT
'时长(秒),用于页面停留事件'
,
`EVENT_TIME`
datetime
NOT
NULL
COMMENT
'事件时间'
,
`DELETE_FLAG`
char
(
1
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
DEFAULT
'N'
COMMENT
'删除标识 N:未删除 D:已删除'
,
`REMARK`
varchar
(
256
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'备注'
,
`CREATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'创建人'
,
`UPDATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'更新人'
,
`CREATE_TIME`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`UPDATE_TIME`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`EVENT_ID`
),
KEY
`IDX_EVENT_NAME`
(
`EVENT_CODE`
),
KEY
`IDX_USER_ID`
(
`ACCOUNT_ID`
),
KEY
`IDX_EVENT_TIME`
(
`EVENT_TIME`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'埋点事件主表'
;
CREATE
TABLE
IF
NOT
EXISTS
`event_tracking_business_key`
(
`BIZ_ID`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID'
,
`EVENT_ID`
bigint
(
20
)
NOT
NULL
COMMENT
'关联event_tracking.id'
,
`BUSINESS_TYPE`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'业务类型: REPORT-报告, VEHICLE-车辆, WORK_ORDER-工单...'
,
`BUSINESS_KEY`
varchar
(
128
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'业务主键'
,
`DELETE_FLAG`
char
(
1
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
DEFAULT
'N'
COMMENT
'删除标识 N:未删除 D:已删除'
,
`REMARK`
varchar
(
256
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'备注'
,
`CREATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'创建人'
,
`UPDATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'更新人'
,
`CREATE_TIME`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`UPDATE_TIME`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`BIZ_ID`
),
KEY
`IDX_EVENT_ID`
(
`EVENT_ID`
),
KEY
`IDX_BUSINESS_TYPE`
(
`BUSINESS_TYPE`
),
KEY
`IDX_BUSINESS_KEY`
(
`BUSINESS_KEY`
),
KEY
`IDX_TYPE_KEY`
(
`BUSINESS_TYPE`
,
`BUSINESS_KEY`
),
UNIQUE
KEY
`UNQ_EVENT_BUSINESS`
(
`EVENT_ID`
,
`BUSINESS_TYPE`
,
`BUSINESS_KEY`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'埋点事件业务主键表'
;
CREATE
TABLE
IF
NOT
EXISTS
`event_tracking_param`
(
`PARAM_ID`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID'
,
`EVENT_ID`
bigint
(
20
)
NOT
NULL
COMMENT
'关联event_tracking.event_id'
,
`PARAM_KEY`
varchar
(
100
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'参数键'
,
`PARAM_VALUE`
text
COLLATE
utf8mb4_unicode_ci
COMMENT
'参数值'
,
`PARAM_TYPE`
varchar
(
32
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
'STRING'
COMMENT
'参数类型: STRING, NUMBER, BOOLEAN, ARRAY, OBJECT'
,
`DELETE_FLAG`
char
(
1
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
DEFAULT
'N'
COMMENT
'删除标识 N:未删除 D:已删除'
,
`REMARK`
varchar
(
256
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'备注'
,
`CREATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'创建人'
,
`UPDATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'更新人'
,
`CREATE_TIME`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`UPDATE_TIME`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`PARAM_ID`
),
KEY
`IDX_EVENT_ID`
(
`EVENT_ID`
),
KEY
`IDX_PARAM_KEY`
(
`PARAM_KEY`
),
UNIQUE
KEY
`UNQ_EVENT_PARAM`
(
`EVENT_ID`
,
`PARAM_KEY`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'埋点事件参数表'
;
CREATE
TABLE
IF
NOT
EXISTS
`event_type_config`
(
`ID`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID'
,
`EVENT_TYPE`
varchar
(
32
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'事件类型: CLICK-点击事件, PAGE_VIEW-页面浏览, PAGE_DURATION-页面停留时长'
,
`EVENT_CODE`
varchar
(
128
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'事件代码'
,
`EVENT_NAME`
varchar
(
128
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
COMMENT
'事件名称'
,
`EVENT_DESC`
varchar
(
512
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'事件描述'
,
`MODULE`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'所属模块'
,
`IS_ACTIVE`
tinyint
(
4
)
NOT
NULL
DEFAULT
'1'
COMMENT
'是否启用 1:启用 0:禁用'
,
`DELETE_FLAG`
char
(
1
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
DEFAULT
'N'
COMMENT
'删除标识 N:未删除 D:已删除'
,
`REMARK`
varchar
(
256
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'备注'
,
`CREATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'创建人'
,
`UPDATE_BY`
varchar
(
64
)
COLLATE
utf8mb4_unicode_ci
DEFAULT
NULL
COMMENT
'更新人'
,
`CREATE_TIME`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`UPDATE_TIME`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`ID`
),
UNIQUE
KEY
`UNQ_EVENT_NAME`
(
`EVENT_NAME`
),
KEY
`IDX_MODULE`
(
`MODULE`
),
KEY
`IDX_EVENT_TYPE`
(
`EVENT_TYPE`
),
KEY
`IDX_EVENT_CODE`
(
`EVENT_CODE`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'事件类型配置表'
;
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