Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
66fbb0ad
Commit
66fbb0ad
authored
Mar 03, 2025
by
chenyuxi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 部门花名册数+查花名册相关人数
parent
e87ec600
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
379 additions
and
20 deletions
+379
-20
TEmployeeProjectBelongDeptSearchVo.java
.../yifu/archives/vo/TEmployeeProjectBelongDeptSearchVo.java
+3
-0
TEmployeeProjectBelongDeptController.java
...ives/controller/TEmployeeProjectBelongDeptController.java
+71
-0
TEmployeeProjectBelongDeptMapper.java
...ifu/archives/mapper/TEmployeeProjectBelongDeptMapper.java
+10
-0
TEmployeeProjectBelongDeptService.java
...u/archives/service/TEmployeeProjectBelongDeptService.java
+26
-0
TEmployeeProjectBelongDeptServiceImpl.java
...s/service/impl/TEmployeeProjectBelongDeptServiceImpl.java
+48
-4
TEmployeeProjectBelongDeptMapper.xml
...ain/resources/mapper/TEmployeeProjectBelongDeptMapper.xml
+50
-0
SysDeptVo.java
...a/com/yifu.cloud.plus.v1/yifu/admin/api/vo/SysDeptVo.java
+12
-0
DeptController.java
...u/cloud/plus/v1/yifu/admin/controller/DeptController.java
+62
-9
UserDeptPermissionController.java
...1/yifu/admin/controller/UserDeptPermissionController.java
+6
-6
SysDeptMapper.java
...m/yifu/cloud/plus/v1/yifu/admin/mapper/SysDeptMapper.java
+8
-0
SysDeptService.java
...yifu/cloud/plus/v1/yifu/admin/service/SysDeptService.java
+10
-0
SysDeptServiceImpl.java
...d/plus/v1/yifu/admin/service/impl/SysDeptServiceImpl.java
+56
-1
SysDeptMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
+17
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TEmployeeProjectBelongDeptSearchVo.java
View file @
66fbb0ad
...
...
@@ -78,4 +78,7 @@ public class TEmployeeProjectBelongDeptSearchVo extends EmployeeProjectScpVO {
@Schema
(
description
=
"查询limit 数据条数"
)
private
int
limitEnd
;
@Schema
(
description
=
"部门下人员档案数量"
)
private
Integer
empNum
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeProjectBelongDeptController.java
View file @
66fbb0ad
...
...
@@ -26,7 +26,10 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchV
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -34,6 +37,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -113,4 +118,70 @@ public class TEmployeeProjectBelongDeptController {
tEmployeeProjectBelongDeptService
.
listExport
(
response
,
searchVo
);
}
/**
* 获取指定部门下花名册总数
* @param tEmployeeProjectBelongDept 花名册查询
* @return R<Integer> 花名册总数
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/getDeptCount"
)
public
R
<
Integer
>
getDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
)
{
if
(
Common
.
isEmpty
(
tEmployeeProjectBelongDept
.
getEmpDeptId
())){
R
.
failed
(
"所属部门id不能为空"
);
}
if
(
Common
.
isEmpty
(
tEmployeeProjectBelongDept
.
getDeptId
())){
R
.
failed
(
"项目ID不能为空"
);
}
return
R
.
ok
(
tEmployeeProjectBelongDeptService
.
getDeptCount
(
tEmployeeProjectBelongDept
));
}
/**
* 根据权限获取对应部门ID下的花名册总数Map
* @param tEmployeeProjectBelongDept 花名册查询
* @return R<Integer> 花名册总数
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/getDeptCountMap"
)
public
R
<
Map
<
String
,
Integer
>>
getDeptCountMap
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
)
{
if
(
Common
.
isEmpty
(
tEmployeeProjectBelongDept
.
getDeptId
())){
R
.
failed
(
"项目ID不能为空"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
}
List
<
UserPermissionVo
>
cspPermList
=
user
.
getCspPermMap
();
if
(
Common
.
isEmpty
(
cspPermList
)){
return
R
.
failed
(
"获取用户权限失败!"
);
}
// 获取用户在当前项目下的权限
UserPermissionVo
authority
=
null
;
for
(
UserPermissionVo
userPermissionVo
:
cspPermList
)
{
if
(
tEmployeeProjectBelongDept
.
getDeptId
().
equals
(
userPermissionVo
.
getProjectId
())){
authority
=
userPermissionVo
;
}
}
if
(
Common
.
isEmpty
(
authority
)){
return
R
.
failed
(
"获取用户在当前项目下的权限失败!"
);
}
return
R
.
ok
(
tEmployeeProjectBelongDeptService
.
getDeptCountMap
(
tEmployeeProjectBelongDept
,
authority
));
}
/**
* 没有关联部门的花名册总数
* @param tEmployeeProjectBelongDept 花名册查询
* @return R<Integer> 花名册总数
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/getNoneDeptCount"
)
public
R
<
Integer
>
getNoneDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
)
{
if
(
Common
.
isEmpty
(
tEmployeeProjectBelongDept
.
getDeptId
())){
R
.
failed
(
"项目ID不能为空"
);
}
return
R
.
ok
(
tEmployeeProjectBelongDeptService
.
getNoneDeptCount
(
tEmployeeProjectBelongDept
));
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeProjectBelongDeptMapper.java
View file @
66fbb0ad
...
...
@@ -27,6 +27,7 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
/**
* 项目档案所属部门表
...
...
@@ -53,4 +54,13 @@ public interface TEmployeeProjectBelongDeptMapper extends BaseMapper<TEmployeePr
List
<
EmployeeProjectScpVO
>
getTEmployeeProjectBelongDeptList
(
@Param
(
"tEmployeeProjectBelongDept"
)
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
);
// 获取部门下花名册总数
int
getDeptCount
(
@Param
(
"tEmployeeProjectBelongDept"
)
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
);
// 根据权限获取对应部门ID下的花名册总数Map
List
<
TEmployeeProjectBelongDeptSearchVo
>
getDeptCountMap
(
@Param
(
"deptId"
)
String
deptId
,
@Param
(
"departIdSet"
)
Set
<
String
>
departIdSet
);
// 没有关联部门的花名册总数
int
getNoneDeptCount
(
@Param
(
"tEmployeeProjectBelongDept"
)
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeProjectBelongDeptService.java
View file @
66fbb0ad
...
...
@@ -23,8 +23,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectScpVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
/**
* 项目档案所属部门表
...
...
@@ -50,4 +52,28 @@ public interface TEmployeeProjectBelongDeptService extends IService<TEmployeePro
**/
void
listExport
(
HttpServletResponse
response
,
TEmployeeProjectBelongDeptSearchVo
searchVo
);
/**
* 获取部门下花名册总数
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Integer 花名册总数
*/
Integer
getDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
);
/**
* 根据权限获取对应部门ID下的花名册总数Map
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Map<String,Integer> 对应部门ID下的花名册总数Map
*/
Map
<
String
,
Integer
>
getDeptCountMap
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
,
UserPermissionVo
authority
);
/**
* 没有关联部门的花名册总数
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Integer 花名册总数
*/
Integer
getNoneDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectBelongDeptServiceImpl.java
View file @
66fbb0ad
...
...
@@ -22,6 +22,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectBelongDeptMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectBelongDeptService
;
...
...
@@ -34,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DictConverter
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
...
...
@@ -41,10 +43,8 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 项目档案所属部门表
...
...
@@ -147,4 +147,48 @@ public class TEmployeeProjectBelongDeptServiceImpl extends ServiceImpl<TEmployee
}
}
/**
* 获取部门下花名册总数
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Integer 花名册总数
*/
@Override
public
Integer
getDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
)
{
return
baseMapper
.
getDeptCount
(
tEmployeeProjectBelongDept
);
}
/**
* 根据权限获取对应部门ID下的花名册总数Map
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Map<String, Integer> 对应部门ID下的花名册总数Map
*/
@Override
public
Map
<
String
,
Integer
>
getDeptCountMap
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
,
UserPermissionVo
authority
)
{
Map
<
String
,
Integer
>
deptCountMap
=
new
HashMap
<>();
Set
<
String
>
departIdSet
=
authority
.
getDepartIdSet
();
// 有全部权限
if
(
authority
.
isHaveAll
()){
departIdSet
=
new
HashSet
<>();
}
List
<
TEmployeeProjectBelongDeptSearchVo
>
sysDeptList
=
baseMapper
.
getDeptCountMap
(
tEmployeeProjectBelongDept
.
getDeptId
(),
departIdSet
);
if
(
Common
.
isNotNull
(
sysDeptList
))
{
for
(
TEmployeeProjectBelongDeptSearchVo
deptVo
:
sysDeptList
)
{
deptCountMap
.
put
(
deptVo
.
getEmpDeptId
(),
deptVo
.
getEmpNum
());
}
}
return
deptCountMap
;
}
/**
* 没有关联部门的花名册总数
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Integer 花名册总数
*/
@Override
public
Integer
getNoneDeptCount
(
TEmployeeProjectBelongDeptSearchVo
tEmployeeProjectBelongDept
)
{
return
baseMapper
.
getNoneDeptCount
(
tEmployeeProjectBelongDept
);
}
}
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeProjectBelongDeptMapper.xml
View file @
66fbb0ad
...
...
@@ -150,5 +150,55 @@
</if>
</select>
<!-- 获取部门下花名册总数 -->
<select
id=
"getDeptCount"
resultType=
"java.lang.Integer"
>
select count(1)
from t_employee_project_belong_dept b
LEFT JOIN t_employee_project a on b.id = a.id
<where>
a.DELETE_FLAG ='0'
<if
test=
"tEmployeeProjectBelongDept.deptId != null and tEmployeeProjectBelongDept.deptId.trim() != ''"
>
AND a.DEPT_ID = #{tEmployeeProjectBelongDept.deptId}
</if>
<if
test=
"tEmployeeProjectBelongDept.empDeptId != null and tEmployeeProjectBelongDept.empDeptId.trim() != ''"
>
AND b.emp_deptid = #{tEmployeeProjectBelongDept.empDeptId}
</if>
</where>
</select>
<!-- 根据权限获取对应部门ID下的花名册总数Map -->
<select
id=
"getDeptCountMap"
resultType=
"com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchVo"
>
select emp_deptid as empDeptId, count(emp_deptid) as empNum
from t_employee_project_belong_dept b
LEFT JOIN t_employee_project a on b.id = a.id
<where>
a.DELETE_FLAG ='0'
<if
test=
"deptId != null and deptId.trim() != ''"
>
AND a.DEPT_ID = #{deptId}
</if>
<if
test=
"departIdSet != null and departIdSet.size > 0"
>
AND b.emp_deptid in
<foreach
item=
"idStr"
index=
"index"
collection=
"departIdSet"
open=
"("
separator=
","
close=
")"
>
#{idStr}
</foreach>
</if>
</where>
group by emp_deptid
</select>
<!-- 没有关联部门的花名册总数 -->
<select
id=
"getNoneDeptCount"
resultType=
"java.lang.Integer"
>
select count(1)
from t_employee_project a
LEFT JOIN t_employee_project_belong_dept b on a.id=b.id
<where>
a.DELETE_FLAG ='0' and b.id is null
<if
test=
"tEmployeeProjectBelongDept.deptId != null and tEmployeeProjectBelongDept.deptId.trim() != ''"
>
AND a.DEPT_ID = #{tEmployeeProjectBelongDept.deptId}
</if>
</where>
</select>
</mapper>
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/SysDeptVo.java
View file @
66fbb0ad
...
...
@@ -6,6 +6,8 @@ import lombok.Data;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* 客户服务平台——部门包装类
...
...
@@ -28,4 +30,14 @@ public class SysDeptVo extends SysDept {
* 部门人数
*/
private
String
peopleNum
;
/**
* 花名册部门对应的人数
*/
private
Map
<
String
,
Integer
>
deptPeopleNumMap
;
/**
* 部门ID集合
*/
private
Set
<
String
>
departIdSet
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/DeptController.java
View file @
66fbb0ad
...
...
@@ -25,8 +25,11 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -163,11 +166,13 @@ public class DeptController {
/**
* 客户服务平台——获取部门树(用于下拉选择)
* @return 树形菜单
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/csp/list"
)
public
R
<
List
<
DeptTreeSelectVO
>>
cspList
(
SysDeptVo
dept
)
{
if
(
Common
.
isEmpty
(
dept
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
return
R
.
ok
(
sysDeptService
.
cspDeptTreeSelect
(
dept
));
}
...
...
@@ -175,29 +180,67 @@ public class DeptController {
/**
* 客户服务平台——获取部门树(带部门下人数)
* @return 树形菜单
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/csp/tree"
)
public
R
<
List
<
DeptTreeSelectVO
>>
cspTree
(
SysDeptVo
dept
)
{
if
(
Common
.
isEmpty
(
dept
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
return
R
.
ok
(
sysDeptService
.
cspDeptTree
(
dept
));
}
/**
* 客户服务平台——获取花名册的部门树(带部门下人数)
* @return 树形菜单
* @author chenyuxi
* @since 1.9.7
*/
@PostMapping
(
value
=
"/csp/rosterTree"
)
public
R
<
List
<
DeptTreeSelectVO
>>
cspRosterTree
(
@RequestBody
SysDeptVo
dept
)
{
if
(
Common
.
isEmpty
(
dept
.
getProjectNo
())){
return
R
.
failed
(
"项目编码不能为空"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
}
List
<
UserPermissionVo
>
cspPermList
=
user
.
getCspPermMap
();
if
(
Common
.
isEmpty
(
cspPermList
)){
return
R
.
failed
(
"获取用户权限失败!"
);
}
// 获取用户在当前项目下的权限
UserPermissionVo
authority
=
null
;
for
(
UserPermissionVo
userPermissionVo
:
cspPermList
)
{
if
(
dept
.
getProjectNo
().
equals
(
userPermissionVo
.
getProjectNo
())){
authority
=
userPermissionVo
;
}
}
if
(
Common
.
isEmpty
(
authority
)){
return
R
.
failed
(
"获取用户在当前项目下的权限失败!"
);
}
return
R
.
ok
(
sysDeptService
.
cspRosterTree
(
dept
,
authority
));
}
/**
* 客户服务平台——添加部门
* @param sysDept 实体
* @return success/false
* @author chenyuxi
* @since 1.9.7
*/
@SysLog
(
"客户服务平台——添加部门"
)
@PostMapping
(
"/csp"
)
public
R
<
String
>
saveCspDept
(
@RequestBody
SysDept
sysDept
)
{
if
(
Common
.
isEmpty
(
sysDept
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
// todo 名字长度
if
(
Common
.
isEmpty
(
sysDept
.
getName
())){
R
.
failed
(
"部门名称不能为空"
);
return
R
.
failed
(
"部门名称不能为空"
);
}
if
(
sysDept
.
getName
().
length
()>
50
){
return
R
.
failed
(
"部门名称不能超过50个字"
);
}
// 父级不传,默认增顶级部门
if
(
Common
.
isEmpty
(
sysDept
.
getParentId
())){
...
...
@@ -210,15 +253,20 @@ public class DeptController {
* 客户服务平台——编辑部门
* @param sysDept 实体
* @return success/false
* @author chenyuxi
* @since 1.9.7
*/
@SysLog
(
"客户服务平台——编辑部门"
)
@PutMapping
(
"/csp"
)
public
R
<
String
>
updateCspDept
(
@RequestBody
SysDept
sysDept
)
{
if
(
Common
.
isEmpty
(
sysDept
.
getDeptId
())){
R
.
failed
(
"ID不能为空"
);
return
R
.
failed
(
"ID不能为空"
);
}
if
(
Common
.
isEmpty
(
sysDept
.
getName
())){
R
.
failed
(
"部门名称不能为空"
);
return
R
.
failed
(
"部门名称不能为空"
);
}
if
(
sysDept
.
getName
().
length
()>
50
){
return
R
.
failed
(
"部门名称不能超过50个字"
);
}
return
sysDeptService
.
updateCspDept
(
sysDept
);
}
...
...
@@ -227,12 +275,14 @@ public class DeptController {
* 删除
* @param id ID
* @return success/false
* @author chenyuxi
* @since 1.9.7
*/
@SysLog
(
"客户服务平台——删除部门"
)
@DeleteMapping
(
"/csp/{id:\\d+}"
)
public
R
<
String
>
removeCspDeptById
(
@PathVariable
Long
id
)
{
if
(
Common
.
isEmpty
(
id
)){
R
.
failed
(
"项目Id不能为空"
);
return
R
.
failed
(
"项目Id不能为空"
);
}
return
sysDeptService
.
removeCspDeptById
(
id
);
}
...
...
@@ -240,11 +290,13 @@ public class DeptController {
/**
* 客户服务平台——获取项目下部门总数
* @return R<Integer> 部门总数
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping
(
value
=
"/csp/getDeptCount"
)
public
R
<
Integer
>
cspDeptCount
(
SysDeptVo
dept
)
{
if
(
Common
.
isEmpty
(
dept
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
return
R
.
ok
(
sysDeptService
.
cspDeptCount
(
dept
.
getProjectNo
()));
}
...
...
@@ -258,4 +310,5 @@ public class DeptController {
public
R
<
Boolean
>
cspUpdateDept
(
@RequestBody
SysDeptMoveVo
dept
)
{
return
sysDeptService
.
cspUpdateDept
(
dept
);
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/UserDeptPermissionController.java
View file @
66fbb0ad
...
...
@@ -58,10 +58,10 @@ public class UserDeptPermissionController {
@GetMapping
(
"/info"
)
public
R
<
SysUserDeptPermission
>
getInfo
(
SysUserDeptPermission
sysUserDeptPermission
)
{
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getUserId
())){
R
.
failed
(
"用户ID不能为空"
);
return
R
.
failed
(
"用户ID不能为空"
);
}
return
R
.
ok
(
sysUserDeptPermissionService
.
getInfo
(
sysUserDeptPermission
.
getProjectNo
(),
sysUserDeptPermission
.
getUserId
()));
}
...
...
@@ -75,18 +75,18 @@ public class UserDeptPermissionController {
@PostMapping
(
"/permission"
)
public
R
<
String
>
saveUserPermission
(
@RequestBody
SysUserDeptPermission
sysUserDeptPermission
)
{
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getUserId
())){
R
.
failed
(
"用户ID不能为空"
);
return
R
.
failed
(
"用户ID不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getPermissionsType
())){
R
.
failed
(
"数据权限不能为空"
);
return
R
.
failed
(
"数据权限不能为空"
);
}
if
(
CommonConstants
.
THREE_STRING
.
equals
(
sysUserDeptPermission
.
getPermissionsType
())
&&
Common
.
isEmpty
(
sysUserDeptPermission
.
getAppointDeptScope
())
){
R
.
failed
(
"指定部门时,部门范围不能为空"
);
return
R
.
failed
(
"指定部门时,部门范围不能为空"
);
}
return
sysUserDeptPermissionService
.
saveUserPermission
(
sysUserDeptPermission
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/mapper/SysDeptMapper.java
View file @
66fbb0ad
...
...
@@ -24,6 +24,7 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
/**
* <p>
...
...
@@ -63,6 +64,13 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
*/
List
<
SysDeptVo
>
cspDeptUserList
(
@Param
(
"dept"
)
SysDeptVo
dept
);
/**
* 客户服务平台——根据部门集合查询部门管理数据
*
* @param dept 部门信息
*/
List
<
SysDeptVo
>
cspDeptListByDeptIdSet
(
@Param
(
"dept"
)
SysDeptVo
dept
,
@Param
(
"departIdSet"
)
Set
<
String
>
departIdSet
);
/**
* 客户服务平台——查询同项目下同级部门
*
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/SysDeptService.java
View file @
66fbb0ad
...
...
@@ -23,6 +23,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptTreeSelectVO;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptMoveVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
java.util.List
;
...
...
@@ -100,6 +101,15 @@ public interface SysDeptService extends IService<SysDept> {
*/
List
<
DeptTreeSelectVO
>
cspDeptTree
(
SysDeptVo
dept
);
/**
* 客户服务平台——获取花名册的部门树(带部门下人数)
*
* @param dept 部门信息
* @param authority 用户在当前项目下的权限
* @return 部门树列表
*/
List
<
DeptTreeSelectVO
>
cspRosterTree
(
SysDeptVo
dept
,
UserPermissionVo
authority
);
/**
* 客户服务平台——添加部门
*
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysDeptServiceImpl.java
View file @
66fbb0ad
...
...
@@ -40,6 +40,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo
;
import
com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -303,7 +304,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
/**
* 客户服务平台——获取部门树(带部门下人数)
*
*
@param dept 部门信息
* @return 部门树列表
*/
@Override
...
...
@@ -322,6 +323,60 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
return
cspDeptTree
;
}
/**
* 客户服务平台——获取部门树(带部门下人数)
* @param dept 部门信息
* @param authority 用户在当前项目下的权限
* @return 部门树列表
*/
@Override
public
List
<
DeptTreeSelectVO
>
cspRosterTree
(
SysDeptVo
dept
,
UserPermissionVo
authority
)
{
List
<
DeptTreeSelectVO
>
cspDeptTree
=
new
ArrayList
<>();
List
<
SysDeptVo
>
sysDeptList
=
new
ArrayList
<>();
// 有全部权限
if
(
authority
.
isHaveAll
()){
sysDeptList
=
baseMapper
.
cspDeptList
(
dept
);
}
else
{
// 获取用户部门集合
Set
<
String
>
allDepartIdSet
=
new
HashSet
<>();
Set
<
String
>
departIdSet
=
authority
.
getDepartIdSet
();
List
<
SysDeptVo
>
deptVoList
=
baseMapper
.
cspDeptListByDeptIdSet
(
dept
,
departIdSet
);
if
(
Common
.
isNotNull
(
deptVoList
)){
// 将指定部门和祖级部门都存到一个集合里
for
(
SysDeptVo
deptVo
:
deptVoList
)
{
// 先存当前部门ID
allDepartIdSet
.
add
(
deptVo
.
getDeptId
().
toString
());
String
ancestors
=
deptVo
.
getAncestors
();
String
[]
ancestorArr
=
ancestors
.
split
(
CommonConstants
.
COMMA_STRING
);
Set
<
String
>
ancestorDeptIdSet
=
Arrays
.
stream
(
ancestorArr
).
collect
(
Collectors
.
toSet
());
if
(
Common
.
isNotNull
(
ancestorDeptIdSet
)){
allDepartIdSet
.
addAll
(
ancestorDeptIdSet
);
}
}
}
sysDeptList
=
baseMapper
.
cspDeptListByDeptIdSet
(
dept
,
allDepartIdSet
);
}
if
(
Common
.
isNotNull
(
sysDeptList
)){
Map
<
String
,
Integer
>
deptPeopleNumMap
=
dept
.
getDeptPeopleNumMap
();
for
(
SysDeptVo
deptVo
:
sysDeptList
)
{
Integer
peopleNum
=
deptPeopleNumMap
.
get
(
deptVo
.
getDeptId
().
toString
());
if
(
Common
.
isEmpty
(
peopleNum
)){
peopleNum
=
0
;
}
deptVo
.
setPeopleNum
(
peopleNum
.
toString
());
}
// 组装部门树
List
<
SysDeptVo
>
deptTrees
=
buildDeptTree
(
sysDeptList
);
if
(
Common
.
isNotNull
(
sysDeptList
)){
// 数据库查到的对象到视图对象的映射
cspDeptTree
=
deptTrees
.
stream
().
map
(
DeptTreeSelectVO:
:
new
).
collect
(
Collectors
.
toList
());
}
}
return
cspDeptTree
;
}
/**
* 客户服务平台——组装部门树
*
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
View file @
66fbb0ad
...
...
@@ -93,6 +93,23 @@
order by d.sort_order asc,d.create_time desc
</select>
<select
id=
"cspDeptListByDeptIdSet"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo"
>
select d.dept_id, d.name, d.parent_id,d.ancestors,sort_order
from sys_dept d
where d.del_flag = '0'
<if
test=
"dept.projectNo != null and dept.projectNo != ''"
>
AND d.project_no = #{dept.projectNo}
</if>
<if
test=
"departIdSet != null and departIdSet.size > 0"
>
AND d.dept_id in
<foreach
item=
"idStr"
index=
"index"
collection=
"departIdSet"
open=
"("
separator=
","
close=
")"
>
#{idStr}
</foreach>
</if>
order by d.sort_order asc,d.create_time desc
</select>
<select
id=
"checkDeptNameUnique"
resultMap=
"BaseResultMap"
>
select dept_id,name from sys_dept
where project_no = #{projectNo} and name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
...
...
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