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
8f047cd0
Commit
8f047cd0
authored
Mar 03, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.7.7' into MVP1.7.7
parents
b989b140
80393951
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
722 additions
and
44 deletions
+722
-44
TSettleDomain.java
...ifu/cloud/plus/v1/yifu/archives/entity/TSettleDomain.java
+0
-6
TEmployeeProjectBelongDeptSearchVo.java
.../yifu/archives/vo/TEmployeeProjectBelongDeptSearchVo.java
+3
-0
TEmployeeProjectBelongDeptController.java
...ives/controller/TEmployeeProjectBelongDeptController.java
+71
-0
TSettleDomainController.java
.../v1/yifu/archives/controller/TSettleDomainController.java
+0
-1
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
UserPermissionVo.java
...u/cloud/plus/v1/yifu/common/core/vo/UserPermissionVo.java
+6
-0
EmployeeRegistration.java
...m/yifu/cloud/plus/v1/csp/entity/EmployeeRegistration.java
+14
-1
WxConfig.java
...main/java/com/yifu/cloud/plus/v1/csp/config/WxConfig.java
+161
-0
EmployeeRegistrationServiceImpl.java
.../v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
+89
-7
application-prd.yml
yifu-csp/yifu-csp-biz/src/main/resources/application-prd.yml
+8
-1
application-test.yml
...-csp/yifu-csp-biz/src/main/resources/application-test.yml
+7
-0
TInsuranceUnpurchaseApplyServiceImpl.java
...ry/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
+1
-1
TSalaryAccountServiceImpl.java
...1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
+2
-2
SysUserDeptPermission.java
....plus.v1/yifu/admin/api/entity/SysUserDeptPermission.java
+4
-0
SysDeptVo.java
...a/com/yifu.cloud.plus.v1/yifu/admin/api/vo/SysDeptVo.java
+12
-0
UserCspVO.java
...a/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserCspVO.java
+4
-0
DeptController.java
...u/cloud/plus/v1/yifu/admin/controller/DeptController.java
+62
-9
UserController.java
...u/cloud/plus/v1/yifu/admin/controller/UserController.java
+12
-0
UserDeptPermissionController.java
...1/yifu/admin/controller/UserDeptPermissionController.java
+13
-10
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
SysUserService.java
...yifu/cloud/plus/v1/yifu/admin/service/SysUserService.java
+9
-0
SysDeptServiceImpl.java
...d/plus/v1/yifu/admin/service/impl/SysDeptServiceImpl.java
+56
-1
SysUserDeptPermissionServiceImpl.java
.../admin/service/impl/SysUserDeptPermissionServiceImpl.java
+2
-0
SysUserServiceImpl.java
...d/plus/v1/yifu/admin/service/impl/SysUserServiceImpl.java
+14
-0
SysDeptMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
+17
-0
SysUserDeptPermissionMapper.xml
...src/main/resources/mapper/SysUserDeptPermissionMapper.xml
+3
-1
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TSettleDomain.java
View file @
8f047cd0
...
...
@@ -66,12 +66,6 @@ public class TSettleDomain extends BaseEntity {
@Schema
(
description
=
"项目名称"
)
private
String
departName
;
/**
* 登录账号
*/
@Schema
(
description
=
"登录账号"
)
private
String
loginName
;
/**
* 是否是新业务(0是/1否)
*/
...
...
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TEmployeeProjectBelongDeptSearchVo.java
View file @
8f047cd0
...
...
@@ -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 @
8f047cd0
...
...
@@ -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/controller/TSettleDomainController.java
View file @
8f047cd0
...
...
@@ -462,7 +462,6 @@ public class TSettleDomainController {
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
log
.
error
(
"jsonStr:"
+
jsonStr
);
List
<
TDomainUpCsVo
>
list
=
JSONObject
.
parseArray
(
jsonStr
,
TDomainUpCsVo
.
class
);
return
tSettleDomainService
.
updateProjectCsInfo
(
list
);
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeProjectBelongDeptMapper.java
View file @
8f047cd0
...
...
@@ -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 @
8f047cd0
...
...
@@ -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 @
8f047cd0
...
...
@@ -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
;
/**
* 项目档案所属部门表
...
...
@@ -149,4 +149,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 @
8f047cd0
...
...
@@ -164,5 +164,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-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/vo/UserPermissionVo.java
View file @
8f047cd0
...
...
@@ -41,4 +41,10 @@ public class UserPermissionVo implements Serializable {
* 关联项目名称 fxj 2025-02-25
*/
private
String
projectName
;
/**
* 关联项目ID fxj 2025-02-25
*/
private
String
projectId
;
}
yifu-csp/yifu-csp-api/src/main/java/com/yifu/cloud/plus/v1/csp/entity/EmployeeRegistration.java
View file @
8f047cd0
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.csp.entity;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
...
...
@@ -82,9 +83,21 @@ public class EmployeeRegistration extends BaseEntity {
@Schema
(
description
=
"客服姓名"
)
private
String
customerUsername
;
@Schema
(
description
=
"客服姓名"
)
@Schema
(
description
=
"客服登录名"
)
private
String
customerUserLoginname
;
@Schema
(
description
=
"项目立项时间"
)
@TableField
(
exist
=
false
)
private
LocalDateTime
projectCreateTime
;
@Schema
(
description
=
"入职登记人数"
)
@TableField
(
exist
=
false
)
private
int
inNum
;
@Schema
(
description
=
"离职登记人数"
)
@TableField
(
exist
=
false
)
private
int
outNum
;
}
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/config/WxConfig.java
0 → 100644
View file @
8f047cd0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
csp
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.authentication.AuthenticationServiceException
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
* @Author: huyc
* @Date: 2023/7/28
* @Description:
* @return: 企业微信配置
**/
@Configuration
@Data
@Slf4j
public
class
WxConfig
{
@Value
(
"${wx.corpid}"
)
private
String
corpid
;
@Value
(
"${wx.corpsecret}"
)
private
String
corpsecret
;
@Value
(
"${wx.agentid}"
)
private
String
agentid
;
@Value
(
"${wx.authUrl}"
)
private
String
authUrl
;
@Value
(
"${wx.domainName}"
)
private
String
domainName
;
@Autowired
private
RedisTemplate
redisTemplate
;
//未授权
private
String
accossTokenInvliad
=
"40014"
;
/**
* @param
* @Author: huyc
* @Date: 2023/7/28
* @Description: 获取微信accos_token
* @return: java.lang.String
**/
public
String
getAccessToken
(
RestTemplate
restTemplate
)
{
if
(
Common
.
isNotNull
(
agentid
))
{
return
this
.
getToken
(
restTemplate
,
CacheConstants
.
WX_ACCOSS_TOKEN
.
concat
(
agentid
),
corpsecret
);
}
return
this
.
getToken
(
restTemplate
,
CacheConstants
.
WX_ACCOSS_TOKEN
,
corpsecret
);
}
public
String
getAccessToken
(
RestTemplate
restTemplate
,
String
corpsecret
)
throws
AuthenticationServiceException
{
if
(
Common
.
isEmpty
(
corpsecret
)){
throw
new
AuthenticationServiceException
(
"未找到对应的corpsecret请联系管理员配置"
);
}
return
this
.
getToken
(
restTemplate
,
CacheConstants
.
WX_ACCOSS_TOKEN
.
concat
(
agentid
),
corpsecret
);
}
/**
* @param restTemplate
* @param tokenKey
* @param corpsecretKey
* @Description: 获取token
* @Author: huyc
* @Date: 2023/7/28 14:46
* @return: java.lang.String
**/
public
String
getToken
(
RestTemplate
restTemplate
,
String
tokenKey
,
String
corpsecretKey
)
{
Object
wxToken
=
redisTemplate
.
opsForValue
().
get
(
tokenKey
);
if
(
null
!=
wxToken
)
{
return
String
.
valueOf
(
wxToken
);
}
String
requestTokenUrl
=
String
.
format
(
SecurityConstants
.
WX_GET_ACCOSS_TOKEN
,
corpid
,
corpsecretKey
);
String
result
=
restTemplate
.
getForObject
(
requestTokenUrl
,
String
.
class
);
if
(
Common
.
isEmpty
(
result
))
{
throw
new
CheckedException
(
"微信授权失败"
);
}
String
token
=
JSON
.
parseObject
(
result
).
getString
(
"access_token"
);
if
(
Common
.
isEmpty
(
token
))
{
log
.
info
(
result
);
throw
new
CheckedException
(
"获取微信token失败"
);
}
redisTemplate
.
opsForValue
().
set
(
tokenKey
,
token
);
redisTemplate
.
expire
(
tokenKey
,
3600
,
TimeUnit
.
SECONDS
);
return
token
;
}
/**
* @param
* @Author: huyc
* @Date: 2023/7/28 14:43
* @Description: 移除微信accossToken
* @return: java.lang.String
**/
public
void
removeAccessToken
()
{
redisTemplate
.
delete
(
CacheConstants
.
WX_ACCOSS_TOKEN
);
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:48
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public
boolean
sendTextCard
(
RestTemplate
restTemplate
,
Map
<
String
,
Object
>
requestMap
)
{
// 必须加上header说明
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
Gson
gson
=
new
Gson
();
log
.
debug
(
"发企业微信===请求:{}"
,
gson
.
toJson
(
requestMap
));
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
gson
.
toJson
(
requestMap
),
headers
);
String
accessToken
=
getAccessToken
(
restTemplate
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
String
.
format
(
SecurityConstants
.
WX_SEND_MESSAGE
,
accessToken
),
requestEntity
,
String
.
class
);
log
.
debug
(
"发企业微信===返回:{}"
,
JSON
.
toJSONString
(
responseEntity
));
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
responseEntity
));
JSONObject
jsonBody
=
jsonObject
.
getJSONObject
(
"body"
);
if
(
jsonBody
!=
null
)
{
String
errcode
=
jsonBody
.
getString
(
"errcode"
);
if
(
accossTokenInvliad
.
equals
(
errcode
))
{
//删除accossToken缓存
removeAccessToken
();
return
false
;
}
if
(!
CommonConstants
.
ZERO_STRING
.
equals
(
errcode
))
{
//非正常,则打印错误日志
log
.
info
(
jsonObject
.
toJSONString
());
}
}
else
{
log
.
info
(
jsonObject
.
toJSONString
());
}
return
true
;
}
/**
* 功能描述: 获取微信accos_token
* @Author: huyc
* @Date: 2023/7/28 14:50
* @return: java.lang.String
*/
public
String
getAppAccessToken
(
RestTemplate
restTemplate
)
{
return
this
.
getToken
(
restTemplate
,
CacheConstants
.
WX_ACCOSS_TOKEN
,
corpsecret
);
}
}
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
View file @
8f047cd0
...
...
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.csp.config.WxConfig
;
import
com.yifu.cloud.plus.v1.csp.constants.RegistConstants
;
import
com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistration
;
import
com.yifu.cloud.plus.v1.csp.mapper.EmployeeRegistrationMapper
;
...
...
@@ -21,6 +22,7 @@ import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationExportVo;
import
com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationHrExportVo
;
import
com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationSearchVo
;
import
com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpProjectStatusVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
...
...
@@ -30,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil
;
import
lombok.AllArgsConstructor
;
...
...
@@ -37,6 +40,7 @@ import lombok.extern.log4j.Log4j2;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -69,6 +73,12 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
@Autowired
private
ArchivesDaprUtil
archivesDaprUtil
;
@Autowired
private
WxConfig
wxConfig
;
@Autowired
private
UpmsDaprUtils
upmsDaprUtils
;
private
final
TOperationLogService
logService
;
/**
...
...
@@ -185,8 +195,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
YifuUser
user
=
SecurityUtils
.
getUser
();
//获取项目信息
R
<
TSettleDomainSelectVo
>
domainR
=
archivesDaprUtil
.
getSettleDomainSelectVoById
(
deptId
);
if
(
null
==
domainR
||
null
==
domainR
.
getData
())
{
errorMessageList
.
add
(
new
ErrorMessage
(-
1
,
"访问员工基础服务异常:"
));
return
R
.
ok
(
errorMessageList
);
}
TSettleDomainSelectVo
selectVo
=
domainR
.
getData
();
// 写法2:
...
...
@@ -197,7 +209,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
1
;
/**
*临时存储
*/
...
...
@@ -245,9 +257,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
private
void
importEmployeeRegistration
(
List
<
EmployeeRegistrationVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
,
YifuUser
user
,
TSettleDomainSelectVo
selectVo
)
{
List
<
EmployeeRegistration
>
successList
=
new
ArrayList
<>();
Map
<
String
,
String
>
exitMap
=
new
HashMap
<>();
EmployeeRegistrationVo
excel
;
int
inNum
=
0
;
int
outNum
=
0
;
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
// 插入
...
...
@@ -273,12 +286,26 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
continue
;
}
initRegistInfo
(
insert
,
user
,
selectVo
);
successList
.
add
(
insert
);
}
// 执行数据插入操作 组装
if
(!
successList
.
isEmpty
())
{
this
.
saveBatch
(
successList
);
//新增记录,新增操作记录
baseMapper
.
insert
(
insert
);
if
(
CommonConstants
.
ONE_STRING
.
equals
(
insert
.
getFeedbackType
()))
{
inNum
++;
}
else
{
outNum
++;
}
logService
.
saveLog
(
insert
.
getId
(),
CommonConstants
.
ZERO_STRING
,
RegistConstants
.
MESSAGE_REGIST
,
LocalDateTime
.
now
(),
insert
.
getRegistorUsername
(),
null
);
}
//发送企业微信待办
EmployeeRegistration
msgRegistration
=
new
EmployeeRegistration
();
msgRegistration
.
setInNum
(
inNum
);
msgRegistration
.
setOutNum
(
outNum
);
msgRegistration
.
setCustomerUserLoginname
(
selectVo
.
getCsLoginName
());
msgRegistration
.
setDeptName
(
selectVo
.
getDepartName
());
msgRegistration
.
setDeptNo
(
selectVo
.
getDepartNo
());
//企业微信消息提醒
sendMessageToWx
(
msgRegistration
,
CommonConstants
.
THREE_STRING
);
}
public
R
registAdd
(
EmployeeRegistration
registration
)
{
...
...
@@ -291,6 +318,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
else
{
baseMapper
.
insert
(
registration
);
}
//企业微信消息提醒
sendMessageToWx
(
registration
,
registration
.
getFeedbackType
());
//操作记录
logService
.
saveLog
(
registration
.
getId
(),
CommonConstants
.
ZERO_STRING
,
RegistConstants
.
MESSAGE_REGIST
,
LocalDateTime
.
now
(),
registration
.
getRegistorUsername
(),
null
);
...
...
@@ -389,9 +418,62 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
insert
.
setEmpDeptname
(
user
.
getDeptName
());
insert
.
setCustomerPhone
(
selectVo
.
getCsPhone
());
insert
.
setCustomerUsername
(
selectVo
.
getCsName
());
insert
.
setCustomerUserLoginname
(
selectVo
.
getCsLoginName
());
insert
.
setDeptNo
(
selectVo
.
getDepartNo
());
insert
.
setDeptName
(
selectVo
.
getDepartName
());
insert
.
setDeptId
(
selectVo
.
getId
());
}
//发送企业微信待办
private
void
sendMessageToWx
(
EmployeeRegistration
registration
,
String
type
)
{
//获取前端客服
SysUser
user
;
R
<
SysUser
>
res
=
upmsDaprUtils
.
getSimpleUserByLoginName
(
registration
.
getCustomerUserLoginname
());
if
(
Common
.
isNotNull
(
res
)
&&
Common
.
isNotNull
(
res
.
getData
())){
user
=
res
.
getData
();
}
else
{
return
;
}
StringBuilder
sendUser
=
null
;
if
(
Common
.
isNotKong
(
user
.
getWxMessage
()))
{
sendUser
=
new
StringBuilder
(
user
.
getWxMessage
());
}
if
(
sendUser
!=
null
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
Map
<
String
,
Object
>
requestMap
=
new
HashMap
<>();
// String authUrl = null;
Map
<
String
,
Object
>
textcard
=
new
HashMap
<>();
// authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName()+"/auth/oauth/wxLogin", "01"+registration.getId());
StringBuilder
description
=
new
StringBuilder
();
String
title
=
""
;
if
(
CommonConstants
.
ONE_STRING
.
equals
(
type
)
||
CommonConstants
.
TWO_STRING
.
equals
(
type
))
{
title
=
"人员入职提醒"
;
description
.
append
(
CommonConstants
.
ONE_STRING
.
equals
(
type
)
?
"入职日期:"
:
"离职日期:"
)
.
append
(
registration
.
getJoinLeaveDate
()).
append
(
"<br>"
);
description
.
append
(
"项目名称:"
).
append
(
registration
.
getDeptName
()).
append
(
"<br>"
);
description
.
append
(
"项目编码:"
).
append
(
registration
.
getDeptNo
()).
append
(
"<br>"
);
description
.
append
(
"员工姓名:"
).
append
(
registration
.
getEmployeeName
()).
append
(
"<br>"
);
description
.
append
(
"身份证号:"
).
append
(
registration
.
getEmpIdcard
()).
append
(
"<br>"
);
description
.
append
(
"手机号码:"
).
append
(
registration
.
getEmpPhone
()).
append
(
"<br>"
);
}
else
{
title
=
"人员批量入离职提醒"
;
description
.
append
(
"项目名称:"
).
append
(
registration
.
getDeptName
()).
append
(
"<br>"
);
description
.
append
(
"项目编码:"
).
append
(
registration
.
getDeptNo
()).
append
(
"<br>"
);
description
.
append
(
"入职人数:"
).
append
(
registration
.
getInNum
()).
append
(
"<br>"
);
description
.
append
(
"离职人数:"
).
append
(
registration
.
getOutNum
()).
append
(
"<br>"
);
}
textcard
.
put
(
"title"
,
title
);
// textcard.put("url", authUrl);
textcard
.
put
(
"description"
,
description
.
toString
());
requestMap
.
put
(
"touser"
,
sendUser
);
requestMap
.
put
(
"agentid"
,
wxConfig
.
getAgentid
());
requestMap
.
put
(
"msgtype"
,
"textcard"
);
requestMap
.
put
(
"textcard"
,
textcard
);
// 必须加上header说明
if
(!
wxConfig
.
sendTextCard
(
restTemplate
,
requestMap
))
{
wxConfig
.
sendTextCard
(
restTemplate
,
requestMap
);
}
}
}
}
yifu-csp/yifu-csp-biz/src/main/resources/application-prd.yml
View file @
8f047cd0
...
...
@@ -37,4 +37,11 @@ security:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
\ No newline at end of file
-
/swagger-ui/**
wx
:
corpid
:
wwbcb090af0dfe50e5
corpsecret
:
R0nKkvsY-oF41fuQvUXZ-kFG3_g_Ce0bpZt6mByx524
agentid
:
1000009
authUrl
:
https://wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName
:
https://wx.worfu.com
\ No newline at end of file
yifu-csp/yifu-csp-biz/src/main/resources/application-test.yml
View file @
8f047cd0
...
...
@@ -38,3 +38,10 @@ security:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
wx
:
corpid
:
wwbcb090af0dfe50e5
corpsecret
:
16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid
:
1000010
authUrl
:
https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName
:
https://test-wx.worfu.com
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
View file @
8f047cd0
...
...
@@ -423,7 +423,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
submitAuditRecord
.
setEntityName
(
tInsuranceUnpurchaseApply
.
getApplyNo
());
auditRecordService
.
save
(
submitAuditRecord
);
}
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tInsuranceUnpurchaseApply
.
getReasonType
())){
if
(
CommonConstants
.
TWO_STRING
.
equals
(
tInsuranceUnpurchaseApply
.
getReasonType
())
&&
CommonConstants
.
THREE_STRING
.
equals
(
tInsuranceUnpurchaseApply
.
getStatus
())
){
// 是“人员已离职”并且 申请已审核通过
// 记录提交审核日志
TAuditRecord
submitAuditRecord
=
new
TAuditRecord
();
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryAccountServiceImpl.java
View file @
8f047cd0
...
...
@@ -156,7 +156,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
//非管理员导出 大于100W 提示“导出量过大,请选择更多查询条件!如果确定要导出这些数据请联系系统管理员操作”
if
(
count
>
1
5
0000
)
{
if
(
count
>
1
00
0000
)
{
out
.
write
(
CommonConstants
.
SOCIAL_EXPORT_LIMIT
.
getBytes
(
"GBK"
));
out
.
close
();
return
;
...
...
@@ -234,7 +234,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
//非管理员导出 大于100W 提示“导出量过大,请选择更多查询条件!如果确定要导出这些数据请联系系统管理员操作”
if
(
count
>
15
0000
)
{
if
(
count
>
60
0000
)
{
out
.
write
(
CommonConstants
.
SOCIAL_EXPORT_LIMIT
.
getBytes
(
"GBK"
));
out
.
close
();
return
;
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysUserDeptPermission.java
View file @
8f047cd0
...
...
@@ -57,6 +57,10 @@ public class SysUserDeptPermission extends Model<SysUserDeptPermission> {
@Schema
(
description
=
"关联项目名称"
)
private
String
projectName
;
@NotBlank
(
message
=
"关联项目ID 不能为空"
)
@Schema
(
description
=
"关联项目ID"
)
private
String
projectId
;
@Schema
(
description
=
"归属系统 yifu-mvp、yifu-csp"
)
private
String
client
;
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/SysDeptVo.java
View file @
8f047cd0
...
...
@@ -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-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserCspVO.java
View file @
8f047cd0
...
...
@@ -79,6 +79,10 @@ public class UserCspVO implements Serializable {
@Schema
(
description
=
"关联项目名称"
)
private
String
projectName
;
@NotBlank
(
message
=
"关联项目ID 不能为空"
)
@Schema
(
description
=
"关联项目ID"
)
private
String
projectId
;
@Schema
(
description
=
"归属系统 0 yifu-mvp 1 yifu-csp"
)
private
String
client
;
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/DeptController.java
View file @
8f047cd0
...
...
@@ -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/UserController.java
View file @
8f047cd0
...
...
@@ -224,6 +224,18 @@ public class UserController {
return
userService
.
updatePassword
(
vo
);
}
/**
* 修改密码
*
* @param vo 用户信息
* @return R
*/
@SysLog
(
"重置密码"
)
@PostMapping
(
"/resetPassword"
)
public
R
<
String
>
resetPassword
(
@RequestBody
UserPasswordVo
vo
)
{
return
userService
.
resetPassword
(
vo
);
}
/**
* 分页查询用户
*
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/UserDeptPermissionController.java
View file @
8f047cd0
...
...
@@ -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
);
}
...
...
@@ -100,16 +100,19 @@ public class UserDeptPermissionController {
@PostMapping
(
"/relation"
)
public
R
<
String
>
relationUser
(
@RequestBody
SysUserDeptPermission
sysUserDeptPermission
)
{
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getProjectNo
())){
R
.
failed
(
"项目编码不能为空"
);
return
R
.
failed
(
"项目编码不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getProjectName
())){
R
.
failed
(
"项目名称不能为空"
);
return
R
.
failed
(
"项目名称不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getUserId
())){
R
.
failed
(
"用户ID不能为空"
);
return
R
.
failed
(
"用户ID不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getDeptId
())){
R
.
failed
(
"部门ID不能为空"
);
return
R
.
failed
(
"部门ID不能为空"
);
}
if
(
Common
.
isEmpty
(
sysUserDeptPermission
.
getProjectId
())){
return
R
.
failed
(
"项目ID不能为空"
);
}
return
sysUserDeptPermissionService
.
relationUser
(
sysUserDeptPermission
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/mapper/SysDeptMapper.java
View file @
8f047cd0
...
...
@@ -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 @
8f047cd0
...
...
@@ -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/SysUserService.java
View file @
8f047cd0
...
...
@@ -86,6 +86,15 @@ public interface SysUserService extends IService<SysUser> {
**/
R
<
String
>
updatePassword
(
UserPasswordVo
vo
);
/**
* @param vo
* @Description: 重置密码
* @Author: hgw
* @Date: 2025/3/3 9:25
* @return: java.lang.Boolean
**/
R
<
String
>
resetPassword
(
UserPasswordVo
vo
);
/**
* 通过ID查询用户信息
* @param id 用户ID
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysDeptServiceImpl.java
View file @
8f047cd0
...
...
@@ -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/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysUserDeptPermissionServiceImpl.java
View file @
8f047cd0
...
...
@@ -338,6 +338,7 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
authority
.
setProjectNo
(
projectNoStr
);
authority
.
setProjectName
(
tPermissionInfo
.
getProjectName
());
authority
.
setUserType
(
tPermissionInfo
.
getUserType
());
authority
.
setProjectId
(
tPermissionInfo
.
getProjectId
());
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
tPermissionInfo
.
getPermissionsType
()))
{
// 全部数据
authority
.
setHaveAll
(
true
);
...
...
@@ -453,6 +454,7 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
permission
.
setProjectName
(
entity
.
getProjectName
());
permission
.
setProjectNo
(
entity
.
getProjectNo
());
permission
.
setUserType
(
entity
.
getUserType
());
permission
.
setProjectId
(
entity
.
getProjectId
());
baseMapper
.
insert
(
permission
);
if
(
Common
.
isNotNull
(
permission
)
&&
Common
.
isNotNull
(
permission
.
getUserId
())){
return
R
.
ok
(
Boolean
.
TRUE
,
CommonConstants
.
SAVE_SUCCESS
);
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
8f047cd0
...
...
@@ -329,6 +329,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return
R
.
ok
();
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
CacheConstants
.
USER_DETAILS
,
key
=
"#vo.userName"
)
public
R
<
String
>
resetPassword
(
UserPasswordVo
vo
)
{
SysUser
sysUser
=
this
.
getOne
(
Wrappers
.<
SysUser
>
query
().
lambda
()
.
eq
(
SysUser:
:
getUserId
,
vo
.
getUserId
())
.
eq
(
SysUser:
:
getType
,
CommonConstants
.
FOUR_STRING
));
if
(
Common
.
isNotNull
(
sysUser
))
{
sysUser
.
setPassword
(
ENCODER
.
encode
(
"123456"
));
}
this
.
updateById
(
sysUser
);
return
R
.
ok
();
}
/**
* 查询上级部门的用户信息
* @param username 用户名
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysDeptMapper.xml
View file @
8f047cd0
...
...
@@ -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
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysUserDeptPermissionMapper.xml
View file @
8f047cd0
...
...
@@ -29,6 +29,7 @@
<result
column=
"user_type"
property=
"userType"
/>
<result
column=
"permissions_type"
property=
"permissionsType"
/>
<result
column=
"appoint_dept_scope"
property=
"appointDeptScope"
/>
<result
column=
"project_id"
property=
"projectId"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -40,7 +41,8 @@
a.client,
a.user_type,
a.permissions_type,
a.appoint_dept_scope
a.appoint_dept_scope,
a.project_id
</sql>
<select
id=
"getUserDeptPermission"
resultMap=
"BaseResultMap"
>
...
...
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