Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
张文彪
/
employmentBusinessPc
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cef9c004
authored
Dec 08, 2025
by
zwb
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增用户管理,修改岗位智推为userId去重
parent
4726ec1c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
282 additions
and
27 deletions
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/SysUserController.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/vo/SysUserInfoVo.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/vo/UserInfoVo.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/mapper/PositionRecommendMapper.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/PositionRecommendRedisService.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/PositionRecommendRedisServiceImpl.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/RecommendPositionServiceImpl.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/resources/mapper/system/PositionRecommendMapper.xml
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/SysUserController.java
0 → 100644
View file @
cef9c004
package
com
.
bkty
.
system
.
controller
;
import
cn.dev33.satoken.secure.BCrypt
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.bkty.system.api.model.LoginUser
;
import
com.bkty.system.domain.dto.EditPasswordDto
;
import
com.bkty.system.domain.dto.SysRoleDto
;
import
com.bkty.system.domain.dto.SysUserDto
;
import
com.bkty.system.domain.vo.SysRoleVo
;
import
com.bkty.system.domain.vo.SysUserInfoVo
;
import
com.bkty.system.domain.vo.SysUserVo
;
import
com.bkty.system.domain.vo.UserInfoVo
;
import
com.bkty.system.service.Isys.ISysRoleService
;
import
com.bkty.system.service.Isys.ISysUserService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
lombok.RequiredArgsConstructor
;
import
org.dromara.common.core.constant.UserConstants
;
import
org.dromara.common.core.domain.R
;
import
org.dromara.common.core.exception.ServiceException
;
import
org.dromara.common.core.utils.StreamUtils
;
import
org.dromara.common.core.utils.StringUtils
;
import
org.dromara.common.log.annotation.Log
;
import
org.dromara.common.log.enums.BusinessType
;
import
org.dromara.common.mybatis.core.page.PageQuery
;
import
org.dromara.common.mybatis.core.page.TableDataInfo
;
import
org.dromara.common.satoken.utils.LoginHelper
;
import
org.dromara.common.web.core.BaseController
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 用户信息
*
* @author Lion Li
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping
(
"/user"
)
public
class
SysUserController
extends
BaseController
{
private
final
ISysUserService
userService
;
private
final
ISysRoleService
roleService
;
/**
* 获取用户列表
*/
// @SaCheckPermission("system:user:list")
@GetMapping
(
"/list"
)
public
TableDataInfo
<
SysUserVo
>
list
(
SysUserDto
user
,
PageQuery
pageQuery
)
{
return
userService
.
selectPageUserList
(
user
,
pageQuery
);
}
/**
* 新增用户信息
*/
// @SaCheckPermission("system:user:edit")
@Log
(
title
=
"新增用户信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
R
<
Void
>
insertUser
(
@Validated
@RequestBody
SysUserDto
user
)
{
if
(
user
.
getRoleIds
()
==
null
||
user
.
getRoleIds
().
length
==
0
)
{
throw
new
ServiceException
(
"角色不能为空"
);
}
return
toAjax
(
userService
.
insertUser
(
user
));
}
/**
* 修改用户
*/
// @SaCheckPermission("system:user:edit")
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
R
<
Void
>
edit
(
@Validated
@RequestBody
SysUserDto
user
)
{
userService
.
checkUserAllowed
(
user
.
getUserId
());
userService
.
checkUserDataScope
(
user
.
getUserId
());
if
(!
userService
.
checkUserNameUnique
(
user
))
{
return
R
.
fail
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,登录账号已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getPhonenumber
())
&&
!
userService
.
checkPhoneUnique
(
user
))
{
return
R
.
fail
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,手机号码已存在"
);
}
else
if
(
StringUtils
.
isNotEmpty
(
user
.
getEmail
())
&&
!
userService
.
checkEmailUnique
(
user
))
{
return
R
.
fail
(
"修改用户'"
+
user
.
getUserName
()
+
"'失败,邮箱账号已存在"
);
}
return
toAjax
(
userService
.
updateUser
(
user
));
}
/**
* 根据用户编号获取详细信息
*
* @param userId 用户ID
*/
// @SaCheckPermission("system:user:query")
@GetMapping
(
value
=
{
"/"
,
"/{userId}"
})
public
R
<
SysUserInfoVo
>
getInfo
(
@PathVariable
(
value
=
"userId"
,
required
=
false
)
Long
userId
)
{
userService
.
checkUserDataScope
(
userId
);
SysUserInfoVo
userInfoVo
=
new
SysUserInfoVo
();
SysRoleDto
roleBo
=
new
SysRoleDto
();
roleBo
.
setStatus
(
UserConstants
.
ROLE_NORMAL
);
List
<
SysRoleVo
>
roles
=
roleService
.
selectRoleList
(
roleBo
);
userInfoVo
.
setRoles
(
LoginHelper
.
isSuperAdmin
(
userId
)
?
roles
:
StreamUtils
.
filter
(
roles
,
r
->
!
r
.
isSuperAdmin
()));
if
(
ObjectUtil
.
isNotNull
(
userId
))
{
SysUserVo
sysUser
=
userService
.
selectUserById
(
userId
);
userInfoVo
.
setUser
(
sysUser
);
userInfoVo
.
setRoleIds
(
roleService
.
selectRoleListByUserId
(
userId
));
}
return
R
.
ok
(
userInfoVo
);
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping
(
"/getInfo"
)
public
R
<
UserInfoVo
>
getInfo
()
{
UserInfoVo
userInfoVo
=
new
UserInfoVo
();
LoginUser
loginUser
=
LoginHelper
.
getLoginUser
();
SysUserVo
user
=
userService
.
selectUserById
(
loginUser
.
getUserId
());
if
(
ObjectUtil
.
isNull
(
user
))
{
return
R
.
fail
(
"没有权限访问用户数据!"
);
}
user
.
setRoles
(
roleService
.
selectRolesByUserId
(
user
.
getUserId
()));
userInfoVo
.
setUser
(
user
);
userInfoVo
.
setPermissions
(
loginUser
.
getMenuPermission
());
userInfoVo
.
setRoles
(
loginUser
.
getRolePermission
());
return
R
.
ok
(
userInfoVo
);
}
/**
* 删除用户
*
* @param userIds 角色ID串
*/
// @SaCheckPermission("system:user:remove")
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{userIds}"
)
public
R
<
Void
>
remove
(
@PathVariable
Long
[]
userIds
)
{
if
(
ArrayUtil
.
contains
(
userIds
,
LoginHelper
.
getUserId
()))
{
return
R
.
fail
(
"当前用户不能删除"
);
}
return
toAjax
(
userService
.
deleteUserByIds
(
userIds
));
}
@PostMapping
(
value
=
"/queryUserPullDown"
)
@Operation
(
description
=
"查询用户信息下拉框使用"
)
public
R
queryUserPullDown
()
{
return
R
.
ok
(
this
.
userService
.
queryUserPullDown
());
}
/**
* 重置密码
*/
// @ApiEncrypt
// @SaCheckPermission("system:user:resetPwd")
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/resetPwd"
)
public
R
<
Void
>
resetPwd
(
@RequestBody
SysUserDto
user
)
{
userService
.
checkUserAllowed
(
user
.
getUserId
());
userService
.
checkUserDataScope
(
user
.
getUserId
());
return
toAjax
(
userService
.
resetUserPwd
(
user
.
getUserId
()));
}
/**
* 修改用户密码
*/
// @SaCheckPermission("system:user:edit")
@Log
(
title
=
"修改用户密码"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/editPassword"
)
public
R
<
Void
>
editPassword
(
@Validated
@RequestBody
EditPasswordDto
user
)
{
SysUserVo
sysUserVo
=
userService
.
selectUserById
(
user
.
getUserId
());
if
(!
BCrypt
.
checkpw
(
user
.
getPassword
(),
sysUserVo
.
getPassword
()))
{
throw
new
ServiceException
(
"旧密码不正确"
);
}
return
toAjax
(
userService
.
editPassword
(
user
));
}
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/vo/SysUserInfoVo.java
0 → 100644
View file @
cef9c004
package
com
.
bkty
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 用户信息
*
* @author Michelle.Chung
*/
@Data
public
class
SysUserInfoVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 用户信息
*/
private
SysUserVo
user
;
/**
* 角色ID列表
*/
private
List
<
Long
>
roleIds
;
/**
* 角色列表
*/
private
List
<
SysRoleVo
>
roles
;
/**
* 岗位ID列表
*/
private
List
<
Long
>
postIds
;
}
\ No newline at end of file
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/vo/UserInfoVo.java
0 → 100644
View file @
cef9c004
package
com
.
bkty
.
system
.
domain
.
vo
;
import
lombok.Data
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.Set
;
/**
* 登录用户信息
*
* @author Michelle.Chung
*/
@Data
public
class
UserInfoVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1L
;
/**
* 用户基本信息
*/
private
SysUserVo
user
;
/**
* 菜单权限
*/
private
Set
<
String
>
permissions
;
/**
* 角色权限
*/
private
Set
<
String
>
roles
;
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/mapper/PositionRecommendMapper.java
View file @
cef9c004
...
...
@@ -18,11 +18,11 @@ import java.util.List;
public
interface
PositionRecommendMapper
extends
BaseMapper
<
AiPositionRecommendRecord
>
{
@Select
(
"""
SELECT position_id from ai_position_recommend_record where is_deleted = 0 and
analysis_id = #{analysis
Id}
SELECT position_id from ai_position_recommend_record where is_deleted = 0 and
user_id = #{user
Id}
"""
)
List
<
Long
>
selectPositionIdList
(
@Param
(
"
analysisId"
)
Long
analysis
Id
);
List
<
Long
>
selectPositionIdList
(
@Param
(
"
userId"
)
Long
user
Id
);
List
<
AiPositionRecommendRecordVo
>
selectPositionList
(
@Param
(
"
analysisId"
)
Long
analysis
Id
,
List
<
AiPositionRecommendRecordVo
>
selectPositionList
(
@Param
(
"
userId"
)
Long
user
Id
,
@Param
(
"queryType"
)
Integer
queryType
,
@Param
(
"recommendTime"
)
String
recommendTime
,
@Param
(
"pId"
)
Long
pId
,
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/PositionRecommendRedisService.java
View file @
cef9c004
...
...
@@ -14,7 +14,7 @@ public interface PositionRecommendRedisService {
/**
* 初始化redis数据
*/
public
boolean
initRedisData
(
Long
analysis
Id
);
public
boolean
initRedisData
(
Long
user
Id
);
/**
* 保存岗位到redis
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/PositionRecommendRedisServiceImpl.java
View file @
cef9c004
...
...
@@ -46,14 +46,14 @@ public class PositionRecommendRedisServiceImpl implements PositionRecommendRedis
private
static
final
String
RECOMMEND_COUNT_KEY
=
"recommend:count:%d"
;
//推荐次数
@Override
public
boolean
initRedisData
(
Long
analysis
Id
)
{
public
boolean
initRedisData
(
Long
user
Id
)
{
// 1. 查询所有岗位推荐数据
QueryWrapper
<
AiPositionRecommendRecord
>
queryWrapper
=
Wrappers
.
query
();
queryWrapper
.
select
(
"id"
,
"resume_id"
,
"operation_type"
,
"treasures_type"
,
"deliver_type"
,
"city_code"
,
"r_details"
,
"position_score"
,
"jd_md"
);
queryWrapper
.
eq
(
"
analysis_id"
,
analysis
Id
).
eq
(
"is_deleted"
,
false
);
queryWrapper
.
eq
(
"
user_id"
,
user
Id
).
eq
(
"is_deleted"
,
false
);
List
<
AiPositionRecommendRecordVo
>
positions
=
positionRecommendMapper
.
selectPositionList
(
analysis
Id
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
List
<
AiPositionRecommendRecordVo
>
positions
=
positionRecommendMapper
.
selectPositionList
(
user
Id
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
if
(
CollectionUtil
.
isEmpty
(
positions
)){
//无岗位推荐数据
...
...
@@ -68,16 +68,16 @@ public class PositionRecommendRedisServiceImpl implements PositionRecommendRedis
}
Map
<
Long
,
FunctionPositionPortraitV2
>
collect
=
portraitV2s
.
stream
().
collect
(
Collectors
.
toMap
(
FunctionPositionPortraitV2:
:
getPositionDataId
,
p
->
p
));
// 构造 Redis Key
String
allKey
=
String
.
format
(
ALL_KEY
,
analysis
Id
);
String
notReadKey
=
String
.
format
(
NOT_READ_KEY
,
analysis
Id
);
String
favoriteKey
=
String
.
format
(
FAVORITE_KEY
,
analysis
Id
);
String
notSuitableKey
=
String
.
format
(
NOT_SUITABLE_KEY
,
analysis
Id
);
String
deliveredKey
=
String
.
format
(
DELIVERED_KEY
,
analysis
Id
);
String
allKey
=
String
.
format
(
ALL_KEY
,
user
Id
);
String
notReadKey
=
String
.
format
(
NOT_READ_KEY
,
user
Id
);
String
favoriteKey
=
String
.
format
(
FAVORITE_KEY
,
user
Id
);
String
notSuitableKey
=
String
.
format
(
NOT_SUITABLE_KEY
,
user
Id
);
String
deliveredKey
=
String
.
format
(
DELIVERED_KEY
,
user
Id
);
delRedisKey
(
allKey
,
notReadKey
,
favoriteKey
,
notSuitableKey
,
deliveredKey
);
// 2. 遍历数据,将其存入 Redis
for
(
AiPositionRecommendRecordVo
position
:
positions
)
{
savePositionToRedis
(
collect
.
get
(
position
.
getPositionId
()),
position
,
analysis
Id
);
savePositionToRedis
(
collect
.
get
(
position
.
getPositionId
()),
position
,
user
Id
);
}
return
true
;
}
...
...
@@ -87,14 +87,14 @@ public class PositionRecommendRedisServiceImpl implements PositionRecommendRedis
}
@Override
public
void
savePositionToRedis
(
FunctionPositionPortraitV2
portraitV2
,
AiPositionRecommendRecordVo
position
,
Long
analysis
Id
)
{
public
void
savePositionToRedis
(
FunctionPositionPortraitV2
portraitV2
,
AiPositionRecommendRecordVo
position
,
Long
user
Id
)
{
// 构造 Redis Key
//String allKey = String.format(ALL_KEY, userId);
String
notReadKey
=
String
.
format
(
NOT_READ_KEY
,
analysis
Id
);
String
favoriteKey
=
String
.
format
(
FAVORITE_KEY
,
analysis
Id
);
String
notSuitableKey
=
String
.
format
(
NOT_SUITABLE_KEY
,
analysis
Id
);
String
deliveredKey
=
String
.
format
(
DELIVERED_KEY
,
analysis
Id
);
String
notReadKey
=
String
.
format
(
NOT_READ_KEY
,
user
Id
);
String
favoriteKey
=
String
.
format
(
FAVORITE_KEY
,
user
Id
);
String
notSuitableKey
=
String
.
format
(
NOT_SUITABLE_KEY
,
user
Id
);
String
deliveredKey
=
String
.
format
(
DELIVERED_KEY
,
user
Id
);
Long
resumeId
=
position
.
getResumeId
();
Long
positionId
=
position
.
getId
();
...
...
@@ -145,7 +145,7 @@ public class PositionRecommendRedisServiceImpl implements PositionRecommendRedis
// 2.3 将 RecommendItem 对象转换为 JSON 字符串并存储到 Redis 中
try
{
String
jsonString
=
JSON
.
toJSONString
(
item
);
redisTemplate
.
opsForValue
().
set
(
String
.
format
(
RECOMMEND_ITEM_KEY
,
analysis
Id
,
positionId
),
jsonString
);
redisTemplate
.
opsForValue
().
set
(
String
.
format
(
RECOMMEND_ITEM_KEY
,
user
Id
,
positionId
),
jsonString
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/RecommendPositionServiceImpl.java
View file @
cef9c004
...
...
@@ -105,7 +105,7 @@ public class RecommendPositionServiceImpl implements RecommendPositionService {
if
(
resumeSketchList
==
null
)
return
;
// 5. 获取历史推荐岗位ID
List
<
Long
>
positionIdList
=
getHistoryPositionIds
(
analysis
Id
);
List
<
Long
>
positionIdList
=
getHistoryPositionIds
(
user
Id
);
// 6. 构建推荐参数
List
<
RcommendParam
>
rcommendParamList
=
buildRecommendParams
(
aiRecommendVo
,
resumeSketchList
);
...
...
@@ -225,7 +225,7 @@ public class RecommendPositionServiceImpl implements RecommendPositionService {
// 更新分析状态和缓存
aiAnalysisMapper
.
updateAnalysis
(
analysisId
,
2
,
userId
,
0
);
PositionRecommendRedisService
recommendRedisService
=
applicationContext
.
getBean
(
PositionRecommendRedisService
.
class
);
recommendRedisService
.
initRedisData
(
analysis
Id
);
recommendRedisService
.
initRedisData
(
user
Id
);
}
/**
...
...
@@ -424,7 +424,7 @@ public class RecommendPositionServiceImpl implements RecommendPositionService {
private
void
sendCozeByPositionData
(
Long
userId
,
FunctionPositionPortraitVo
resultVo
,
AiRecommendVo
aiRecommendVo
,
ResumeVo
resumeVo
,
AtomicInteger
processedCount
,
int
baseProgress
,
double
progressPerJob
,
AtomicLong
lastPushTime
,
List
<
FunctionPositionPortraitVo
>
matchResults
)
throws
Exception
{
if
(
resultVo
.
getPay
()
!=
null
&&
resultVo
.
getPay
()
==
0
){
/*
if (resultVo.getPay() != null && resultVo.getPay() == 0){
//薪资未知,数据二次确认
Map<String, Object> stringObjectMap = MariaDbAdtUtil.queryRecruitQqxbById(resultVo.getPositionDataId());
try {
...
...
@@ -449,7 +449,7 @@ public class RecommendPositionServiceImpl implements RecommendPositionService {
} catch (Exception e) {
log.error("薪资确认错误", e);
}
}
}
*/
JSONObject
workflowObj
=
sendCozeWorkflow
(
resultVo
,
aiRecommendVo
,
resumeVo
);
System
.
out
.
println
(
"工作流返回信息:"
+
workflowObj
);
...
...
@@ -1180,8 +1180,8 @@ public class RecommendPositionServiceImpl implements RecommendPositionService {
/**
* 获取历史推荐岗位ID
*/
private
List
<
Long
>
getHistoryPositionIds
(
Long
analysis
Id
)
{
List
<
Long
>
positionIdList
=
this
.
positionRecommendMapper
.
selectPositionIdList
(
analysis
Id
);
private
List
<
Long
>
getHistoryPositionIds
(
Long
user
Id
)
{
List
<
Long
>
positionIdList
=
this
.
positionRecommendMapper
.
selectPositionIdList
(
user
Id
);
if
(
CollectionUtil
.
isEmpty
(
positionIdList
))
{
positionIdList
=
null
;
}
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/resources/mapper/system/PositionRecommendMapper.xml
View file @
cef9c004
...
...
@@ -11,10 +11,10 @@
ai_position_recommend_record t1, function_resume_base t2
WHERE
t1.is_deleted = 0 and
t1.
analysis_id = #{analysis
Id} and
t1.
user_id = #{user
Id} and
t1.resume_id = t2.id
<if
test=
"queryType == 1 and recommendTime == null"
>
AND t1.recommend_time = (SELECT MAX(recommend_time) FROM ai_position_recommend_record WHERE
analysis_id = #{analysis
Id} AND is_deleted = 0)
AND t1.recommend_time = (SELECT MAX(recommend_time) FROM ai_position_recommend_record WHERE
user_id = #{user
Id} AND is_deleted = 0)
ORDER BY t1.r_score DESC
</if>
<if
test=
"queryType == 1 and recommendTime != null"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment