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
cb057e5e
Commit
cb057e5e
authored
Jan 16, 2025
by
chenyuxi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 审批代码+流程配置提交
parent
89fcbc77
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
1021 additions
and
558 deletions
+1021
-558
ProcessDaprUtils.java
...cloud/plus/v1/yifu/common/dapr/util/ProcessDaprUtils.java
+36
-4
UpmsDaprUtils.java
...fu/cloud/plus/v1/yifu/common/dapr/util/UpmsDaprUtils.java
+9
-4
spring.factories
...-common-dapr/src/main/resources/META-INF/spring.factories
+2
-1
daprConfig.properties
...yifu-common-dapr/src/main/resources/daprConfig.properties
+5
-1
ProcessConstants.java
...cloud/plus/v1/yifu/process/constant/ProcessConstants.java
+2
-6
TNodePrimission.java
...fu/cloud/plus/v1/yifu/process/entity/TNodePrimission.java
+1
-1
CommonProcessUserUtil.java
...loud/plus/v1/yifu/process/util/CommonProcessUserUtil.java
+0
-36
ProcessAuditUtil.java
...ifu/cloud/plus/v1/yifu/process/util/ProcessAuditUtil.java
+38
-35
TProcessApprovalConfController.java
...fu/process/controller/TProcessApprovalConfController.java
+0
-47
TProcessController.java
...d/plus/v1/yifu/process/controller/TProcessController.java
+20
-11
TProcessService.java
...u/cloud/plus/v1/yifu/process/service/TProcessService.java
+7
-8
TProcessServiceImpl.java
...lus/v1/yifu/process/service/impl/TProcessServiceImpl.java
+51
-58
TAuditNodeProcess.java
...u/cloud/plus/v1/yifu/salary/entity/TAuditNodeProcess.java
+2
-2
WxConfig.java
...a/com/yifu/cloud/plus/v1/yifu/salary/config/WxConfig.java
+194
-0
TAuditNodeProocessController.java
.../yifu/salary/controller/TAuditNodeProocessController.java
+12
-12
TAuditNodeProcessMapper.java
...d/plus/v1/yifu/salary/mapper/TAuditNodeProcessMapper.java
+2
-2
TAuditNodeProcessService.java
...plus/v1/yifu/salary/service/TAuditNodeProcessService.java
+2
-2
AbastractAuditProcess.java
...us/v1/yifu/salary/service/impl/AbastractAuditProcess.java
+266
-223
TAuditNodeProcessServiceImpl.java
...ifu/salary/service/impl/TAuditNodeProcessServiceImpl.java
+21
-0
TInsuranceUnpurchaseApplyServiceImpl.java
...ry/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
+28
-10
TInsuranceUnpurchaseApplyAuditProcess.java
...e/impl/process/TInsuranceUnpurchaseApplyAuditProcess.java
+107
-94
application-test.yml
...y/yifu-salary-biz/src/main/resources/application-test.yml
+7
-1
TAuditNodeProcessMapper.xml
...biz/src/main/resources/mapper/TAuditNodeProcessMapper.xml
+105
-0
UserApprovalRoleVO.java
...u.cloud.plus.v1/yifu/admin/api/vo/UserApprovalRoleVO.java
+21
-0
UserController.java
...u/cloud/plus/v1/yifu/admin/controller/UserController.java
+27
-0
SysUserMapper.java
...m/yifu/cloud/plus/v1/yifu/admin/mapper/SysUserMapper.java
+4
-0
SysUserService.java
...yifu/cloud/plus/v1/yifu/admin/service/SysUserService.java
+5
-0
SysUserServiceImpl.java
...d/plus/v1/yifu/admin/service/impl/SysUserServiceImpl.java
+10
-0
SysUserMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
+37
-0
No files found.
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/ProcessDaprUtils.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
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.dapr.config.DaprProcessProperties
;
import
com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
/**
*
@Author huyc
* @
Date 2022-07-18
* @
Description
* @
Version 1.0
*
流程
* @
author chenyuxi
* @
date 2025-01-10 17:47:32
* @
since 1.7.5
*/
@Log4j2
@EnableConfigurationProperties
(
DaprProcessProperties
.
class
)
...
...
@@ -18,4 +22,32 @@ public class ProcessDaprUtils {
@Autowired
private
DaprProcessProperties
daprProcessProperties
;
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
public
R
<
ProcessVo
>
getProcessVoByType
(
String
processType
)
{
R
<
ProcessVo
>
processVoR
=
HttpDaprUtil
.
invokeMethodPost
(
daprProcessProperties
.
getAppUrl
(),
daprProcessProperties
.
getAppId
(),
"/tprocess/inner/getProcessVoByType"
,
processType
,
ProcessVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
processVoR
)){
return
R
.
failed
(
"根据流程类型查询ProcessVo失败!"
);
}
return
processVoR
;
}
/**
* 根据流程Id查询ProcessVo
* @param processId 流程ID
* @return R<ProcessVo>
* @since mvp1.7.5
**/
public
R
<
ProcessVo
>
getProcessVoById
(
String
processId
)
{
R
<
ProcessVo
>
processVoR
=
HttpDaprUtil
.
invokeMethodPost
(
daprProcessProperties
.
getAppUrl
(),
daprProcessProperties
.
getAppId
(),
"/tprocess/inner/getProcessVoByProcessId"
,
processId
,
ProcessVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
processVoR
)){
return
R
.
failed
(
"根据流程ID查询ProcessVo失败!"
);
}
return
processVoR
;
}
}
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/UpmsDaprUtils.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
util
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
...
...
@@ -113,4 +110,12 @@ public class UpmsDaprUtils {
}
return
userR
;
}
public
R
<
SysUserListVo
>
getUserByRoleIdForCrm
(
UserApprovalRoleVO
userByApprovalRole
)
{
R
<
SysUserListVo
>
allUserVoR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
(),
"/user/inner/getUser/getUserByRoleIdForCrm"
,
userByApprovalRole
,
SysUserListVo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
allUserVoR
)){
return
R
.
failed
(
"查询流程配置审批角色对应的审批人失败!"
);
}
return
allUserVoR
;
}
}
yifu-common/yifu-common-dapr/src/main/resources/META-INF/spring.factories
View file @
cb057e5e
...
...
@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.InsuranceDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SalaryDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.EkpDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.PermissionDaprUtil
com.yifu.cloud.plus.v1.yifu.common.dapr.util.PermissionDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.ProcessDaprUtils
yifu-common/yifu-common-dapr/src/main/resources/daprConfig.properties
View file @
cb057e5e
...
...
@@ -38,10 +38,14 @@ dapr.permission.appId=yifu-permission
dapr.ekp.appUrl
=
http://yifu-ekp.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.ekp.appId
=
yifu-ekp
dapr.process.appUrl
=
http://yifu-process.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.process.appId
=
yifu-process
#\u6D4B\u8BD5\u73AF\u5883-\u85AA\u8D44\u670D\u52A1
#dapr.salary.appUrl=http://yifu-salary.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
#dapr.salary.appId=yifu-salary
#\u6D4B\u8BD5\u73AF\u5883-\u793E\u4FDD\u670D\u52A1
#dapr.social.appUrl=http://yifu-social.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
#
dapr.social.appId
=
yifu-social
\ No newline at end of file
#dapr.social.appId=yifu-social
yifu-common/yifu-common-process/src/main/java/com/yifu/cloud/plus/v1/yifu/process/constant/ProcessConstants.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
process
.
constant
;
/**
* @auth
er wangan
* @
date 2020/9/17
* @auth
or chenyuxi
* @
since 1.7.5
*/
public
class
ProcessConstants
{
//审批中心各个节点类型
...
...
@@ -14,9 +13,6 @@ public class ProcessConstants {
public
static
final
String
PROCESS_NODE_EMBED
=
"embed"
;
public
static
final
String
PROCESS_NODE_SERVICE
=
"service"
;
// 【含风险项目商险不购买申请流程】条件判断审批节点名称
public
static
final
String
PROCESS_NODE_INSURANCEUNPURCHASE_REASON_TYPE
=
"是否为已购买社保"
;
public
static
final
String
PROCESS_NODE_INSURANCEUNPURCHASE_DEPT_PROPERTY
=
"是否属于子分公司"
;
...
...
yifu-common/yifu-common-process/src/main/java/com/yifu/cloud/plus/v1/yifu/process/entity/TNodePrimission.java
View file @
cb057e5e
...
...
@@ -84,7 +84,7 @@ public class TNodePrimission extends Model<TNodePrimission> {
private
String
approvalRole
;
@Length
(
max
=
10
,
message
=
"指定事业部配置表负责人标识不能超过10个字符"
)
@Schema
(
description
=
"指定事业部配置表负责人标识"
)
@Schema
(
description
=
"指定事业部配置表负责人标识
(0事业部条线负责人;1事业部负责人;2分管副总)
"
)
private
String
divisionIdentification
;
@Length
(
max
=
1
,
message
=
"是否允许直接通过不能超过1个字符"
)
...
...
yifu-common/yifu-common-process/src/main/java/com/yifu/cloud/plus/v1/yifu/process/util/CommonProcessUserUtil.java
View file @
cb057e5e
...
...
@@ -23,40 +23,4 @@ public class CommonProcessUserUtil {
public
static
final
String
FEGIN_USER_FAIL
=
"调用用户服务失败"
;
public
static
final
String
FEGIN_USER_RETURN_FAIL
=
"调用用户服务回失败"
;
/**
* 获取crm部门审核人
* @param nodePrimission
* @param departId
* @return List<SysUser>
**/
public
static
List
<
SysUser
>
getDepartAuditUser
(
TNodePrimission
nodePrimission
,
String
departId
)
{
SysUser
remoteSysUser
=
null
;
List
<
SysUser
>
remoteSysUserList
=
new
ArrayList
<>();
if
(
CommonConstants
.
THREE_INT
==
nodePrimission
.
getType
().
intValue
())
{
//3.指定用户
if
(
Common
.
isEmpty
(
nodePrimission
.
getUser
()))
{
throw
new
CheckedException
(
"未查询当前流程权限对应的用户"
);
}
// 查找当前用户
// todo 通过用户id查询用户角色
// remoteSysUser = RemoteRequestUtil.getSysUser(remoteUserService, Integer.parseInt(nodePrimission.getUser()));
remoteSysUserList
.
add
(
remoteSysUser
);
}
else
if
(
CommonConstants
.
TWO_INT
==
nodePrimission
.
getType
().
intValue
())
{
//2.指定角色
if
(
Common
.
isEmpty
(
nodePrimission
.
getRole
()))
{
throw
new
CheckedException
(
"未查询当前流程对应的组织权限"
);
}
//如果下个节点是角色这要取下个角色是否存在
// remoteSysUser = RemoteRequestUtil.getUserManagerByRoleAndDepartId(remoteUserService, departId, nodePrimission.getRole());
remoteSysUserList
.
add
(
remoteSysUser
);
}
else
if
(
CommonConstants
.
FIVE_INT
==
nodePrimission
.
getType
().
intValue
()){
// 5.指定角色(crm)
if
(
Common
.
isEmpty
(
nodePrimission
.
getApprovalRole
()))
{
throw
new
CheckedException
(
"未查询当前节点配置的审核角色"
);
}
// remoteSysUserList = RemoteRequestUtil.getUserByRoleIdForCrm(remoteUserService, departId, nodePrimission.getApprovalRole());
}
return
remoteSysUserList
;
}
}
yifu-common/yifu-common-process/src/main/java/com/yifu/cloud/plus/v1/yifu/process/util/ProcessAuditUtil.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
process
.
util
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException
;
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.process.constant.ProcessConstants
;
import
com.yifu.cloud.plus.v1.yifu.process.entity.TNodeRoute
;
...
...
@@ -10,6 +12,7 @@ import com.yifu.cloud.plus.v1.yifu.process.entity.TProcessNode;
import
com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
...
...
@@ -30,41 +33,43 @@ public class ProcessAuditUtil {
public
static
final
String
BEGIN_NODE_NO_FOUND
=
"未找到开始节点"
;
/**
* @param
* @param processId
* @Author: wangan
* @Date: 2020/9/21
* @Description: 获通过流程id, 获取流程
* @return: com.yifu.cloud.plus.v1.process.api.vo.ProcessVo
**/
public
static
ProcessVo
getProcessVo
(
String
processId
)
{
// todo 改成dapr请求
//R<ProcessVo> processVoR = remoteProcessService.getProcessVoByName(processId, SecurityConstants.FROM_IN);
R
<
ProcessVo
>
processVoR
=
new
R
<>();
if
(
processVoR
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回为空"
);
}
if
(
CommonConstants
.
SUCCESS
!=
processVoR
.
getCode
())
{
throw
new
CheckedException
(
"调用流程服务返回失败"
);
}
ProcessVo
processVo
=
processVoR
.
getData
();
if
(
processVo
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回数据为空"
);
}
return
processVo
;
}
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
// public static ProcessVo getProcessVoByType(ProcessDaprUtils processDaprUtils, String processType) {
// // todo 改成dapr请求
// //R<ProcessVo> processVoR = remoteProcessService.getProcessVoByName(processId, SecurityConstants.FROM_IN);
// R<SysUserListVo> res = upmsDaprUtils.getUserIdsByUserNames(domain.getServiceTeam());
// if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())){
// // 先清理缓存
// this.removeSettleCache(null, res.getData().getUserIds());
// saveForEkp(res.getData().getUserList(), domain);
// }
// R<ProcessVo> processVoR = new R<>();
//
// if (processVoR == null) {
// throw new CheckedException("调用流程服务返回为空");
// }
// if (CommonConstants.SUCCESS != processVoR.getCode()) {
// throw new CheckedException("调用流程服务返回失败");
// }
// ProcessVo processVo = processVoR.getData();
// if (processVo == null) {
// throw new CheckedException("调用流程服务返回数据为空");
// }
// return processVo;
// }
/**
* @param nodeRouteList
* 通过条件表达式判断路由的下一个节点
* @param nodeRouteList
* @param nodeRouteConditionList
* @param object
* @Author: wangan
* @Date: 2020/9/17
* @Description: 条件节点:通过条件表达式判断路由的下一个节点
* @return: com.yifu.cloud.plus.v1.process.api.entity.TNodeRoute
**/
public
static
TNodeRoute
getTNodeRoteByExpress
(
List
<
TNodeRoute
>
nodeRouteList
,
List
<
TNodeRouteCondition
>
nodeRouteConditionList
,
Object
object
,
Class
<?>
parameterTypes
)
{
TNodeRoute
matchNodeRoute
=
null
;
...
...
@@ -149,10 +154,8 @@ public class ProcessAuditUtil {
throw
new
CheckedException
(
END_PRE_NODE_NO_FOUND
);
}
return
preEndTProcessNode
;
}
/**
* @param processVo
* @Author: wangan
...
...
@@ -164,16 +167,16 @@ public class ProcessAuditUtil {
//获取当前节点的下个节点
List
<
TProcessNode
>
processNodeList
=
processVo
.
getProcessNodeList
();
//开始节点
TProcessNode
start
T
ProcessNode
=
null
;
TProcessNode
startProcessNode
=
null
;
for
(
TProcessNode
processNode
:
processNodeList
)
{
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_BEGIN
,
processNode
.
getType
()))
{
startT
ProcessNode
=
processNode
;
start
ProcessNode
=
processNode
;
}
}
if
(
start
T
ProcessNode
==
null
)
{
if
(
startProcessNode
==
null
)
{
throw
new
CheckedException
(
BEGIN_NODE_NO_FOUND
);
}
return
start
T
ProcessNode
;
return
startProcessNode
;
}
...
...
yifu-process/yifu-process-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/process/controller/TProcessApprovalConfController.java
View file @
cb057e5e
...
...
@@ -99,53 +99,6 @@ public class TProcessApprovalConfController {
return
new
R
<>(
tProcessApprovalConfService
.
removeById
(
id
));
}
/**
* todo
* @param type
* @param parentId
* @Author: wangan
* @Date: 2020/12/7
* @Description: 通过类型和父类名称去获取字段名称
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<TProcessApprovalConf>
* @see com.yifu.cloud.plus.v1.process.controller
**/
@Inner
@GetMapping
(
"/inner/getRecord/byTypeAndParentId"
)
public
R
<
TProcessApprovalConf
>
getRecordbyTypeAndParentId
(
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"parentId"
)
String
parentId
)
{
List
<
TProcessApprovalConf
>
list
=
tProcessApprovalConfService
.
list
(
Wrappers
.<
TProcessApprovalConf
>
query
().
lambda
()
.
eq
(
TProcessApprovalConf:
:
getType
,
type
)
.
eq
(
TProcessApprovalConf:
:
getParentId
,
parentId
)
.
eq
(
TProcessApprovalConf:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
if
(
list
.
isEmpty
())
{
return
new
R
<>(
null
);
}
return
new
R
<>(
list
.
get
(
CommonConstants
.
ZERO_INT
));
}
/**
* todo
* @param type
* @param parentId
* @Author: wangan
* @Date: 2020/12/7
* @Description: 通过相关条件获取正确的一个主流程
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<TProcessApprovalConf>
* @see com.yifu.cloud.plus.v1.process.controller
**/
@Inner
@GetMapping
(
"/inner/getRecord/byCondition"
)
public
R
<
TProcessApprovalConf
>
getRecordByCondition
(
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"parentId"
)
String
parentId
,
@RequestParam
(
"fieldName"
)
String
fieldName
,
@RequestParam
(
"fieldValue"
)
String
fieldValue
)
{
return
tProcessApprovalConfService
.
getRecordByCondition
(
type
,
parentId
,
fieldName
,
fieldValue
);
}
/**
* todo
* @param processId
...
...
yifu-process/yifu-process-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/process/controller/TProcessController.java
View file @
cb057e5e
...
...
@@ -26,7 +26,7 @@ import java.time.LocalDateTime;
/**
* 主流程表
*
* @author
hgw
* @author
chenyuxi
* @date 2020-07-16 15:44:02
*/
@RestController
...
...
@@ -89,20 +89,29 @@ public class TProcessController {
}
/**
* todo
* @param processId 流程名称
* @Description: 根据流程名称查询ProcessVo
* @Author: hgw
* @Date: 2020-7-22 18:17:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<ProcessVo>
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@Operation
(
summary
=
"根据流程名称查询ProcessVo"
)
@PostMapping
(
"/inner/getProcessVoByName"
)
@PostMapping
(
"/inner/getProcessVoByType"
)
@Inner
public
R
<
ProcessVo
>
getProcessVoByName
(
String
processId
)
{
return
tProcessService
.
getProcessVoBy
Name
(
processId
);
public
ProcessVo
getProcessVoByType
(
String
processType
)
{
return
tProcessService
.
getProcessVoBy
Type
(
processType
);
}
/**
* 根据流程Id查询ProcessVo
* @param processId 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@PostMapping
(
"/inner/getProcessVoByProcessId"
)
@Inner
public
ProcessVo
getProcessVoByProcessId
(
String
processId
)
{
return
tProcessService
.
getProcessVoById
(
processId
);
}
/**
* 新增记录
* @param processVo
...
...
yifu-process/yifu-process-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/process/service/TProcessService.java
View file @
cb057e5e
...
...
@@ -33,14 +33,13 @@ public interface TProcessService extends IService<TProcess> {
**/
ProcessVo
getProcessVoById
(
String
id
);
/**
* @param processId
* @Description: 返回ProcessVo
* @Author: hgw
* @Date: 2020-7-22 18:18:42
* @return: ProcessVo
**/
R
<
ProcessVo
>
getProcessVoByName
(
String
processId
);
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
*
* @return R<ProcessVo>
**/
ProcessVo
getProcessVoByType
(
String
processType
);
/**
* @param processVo
...
...
yifu-process/yifu-process-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/process/service/impl/TProcessServiceImpl.java
View file @
cb057e5e
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.process.vo.DeleteProcessIdsVo;
import
com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo
;
import
com.yifu.cloud.plus.v1.yifu.process.vo.TProcessViewVo
;
import
com.yifu.cloud.plus.v1.yifu.process.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -44,6 +45,7 @@ import static com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants.F
* @date 2020-07-16 15:44:02
*/
@Service
@Slf4j
public
class
TProcessServiceImpl
extends
ServiceImpl
<
TProcessMapper
,
TProcess
>
implements
TProcessService
{
@Resource
...
...
@@ -230,76 +232,67 @@ public class TProcessServiceImpl extends ServiceImpl<TProcessMapper, TProcess> i
return
processVo
;
}
/**
* @param processId
* @Description: 获取包装类
* @Author: hgw
* @Date: 2020/7/17 11:05
* @return: ProcessVo
**/
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
@Override
public
R
<
ProcessVo
>
getProcessVoByName
(
String
processId
)
{
// 主流程表
public
ProcessVo
getProcessVoByType
(
String
processType
)
{
TProcessApprovalConf
approvalConf
=
processApprovalConfService
.
getOne
(
Wrappers
.<
TProcessApprovalConf
>
query
().
lambda
()
.
eq
(
TProcessApprovalConf:
:
getType
,
processType
)
.
eq
(
TProcessApprovalConf:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
).
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
if
(
Common
.
isEmpty
(
approvalConf
)){
log
.
error
(
"根据类型获取流程配置失败>>processType={}"
,
processType
);
return
null
;
}
// 获取主流程信息
ProcessVo
processVo
=
new
ProcessVo
();
TProcess
process
=
this
.
getById
(
processId
);
if
(
process
==
null
)
{
return
R
.
failed
(
"获取流程失败"
);
TProcess
process
=
this
.
getById
(
approvalConf
.
getProcessId
());
if
(
Common
.
isEmpty
(
process
))
{
log
.
error
(
"获取主流程信息失败>>processId={}"
,
approvalConf
.
getProcessId
());
return
null
;
}
String
processId
=
process
.
getId
();
processVo
.
setProcessId
(
processId
);
processVo
.
setName
(
process
.
getName
());
// 节点
TProcessNode
processNode
=
new
TProcessNode
();
processNode
.
setProcessId
(
processId
);
// 节点查询
QueryWrapper
<
TProcessNode
>
queryWrapperPn
=
new
QueryWrapper
<>();
queryWrapperPn
.
setEntity
(
processNode
);
// 节点列表
List
<
TProcessNode
>
processNodeList
=
processNodeService
.
list
(
queryWrapperPn
);
if
(
processNodeList
!=
null
&&
!
processNodeList
.
isEmpty
())
{
// 权限
TNodePrimission
nodePrimission
;
// 权限查询
QueryWrapper
<
TNodePrimission
>
queryWrapperNp
;
// 权限列表
// 获取节点列表信息
List
<
TProcessNode
>
processNodeList
=
processNodeService
.
list
(
Wrappers
.<
TProcessNode
>
query
().
lambda
()
.
eq
(
TProcessNode:
:
getProcessId
,
processId
));
if
(
Common
.
isNotNull
(
processNodeList
))
{
// 定义审批用户列表
List
<
TNodePrimission
>
nodePrimissionList
;
// 抄送
TNodeReaderPromission
nodeReaderPromission
;
// 抄送查询
QueryWrapper
<
TNodeReaderPromission
>
queryWrapperNrp
;
// 抄送列表
// 定义抄送用户列表
List
<
TNodeReaderPromission
>
nodeReaderPromissionList
;
for
(
TProcessNode
proNode
:
processNodeList
)
{
nodePrimission
=
new
TNodePrimission
();
nodePrimission
.
setNodeId
(
proNode
.
getId
());
queryWrapperNp
=
new
QueryWrapper
<>();
queryWrapperNp
.
setEntity
(
nodePrimission
);
nodePrimissionList
=
nodePrimissionService
.
list
(
queryWrapperNp
);
proNode
.
setNodePrimissionList
(
nodePrimissionList
);
nodeReaderPromission
=
new
TNodeReaderPromission
();
nodeReaderPromission
.
setNodeId
(
proNode
.
getId
());
queryWrapperNrp
=
new
QueryWrapper
<>();
queryWrapperNrp
.
setEntity
(
nodeReaderPromission
);
nodeReaderPromissionList
=
nodeReaderPromissionService
.
list
(
queryWrapperNrp
);
proNode
.
setNodeReaderPromissionList
(
nodeReaderPromissionList
);
//子流程
proNode
.
setNodeTransferConfigs
(
nodeTransferConfigService
.
list
(
Wrappers
.<
TNodeTransferConfig
>
query
().
lambda
().
eq
(
TNodeTransferConfig:
:
getNodeId
,
proNode
.
getId
())));
for
(
TProcessNode
nodeInfo
:
processNodeList
)
{
// 赋值审批用户列表
nodePrimissionList
=
nodePrimissionService
.
list
(
Wrappers
.<
TNodePrimission
>
query
().
lambda
()
.
eq
(
TNodePrimission:
:
getNodeId
,
nodeInfo
.
getId
()));
nodeInfo
.
setNodePrimissionList
(
nodePrimissionList
);
// 赋值抄送用户列表
nodeReaderPromissionList
=
nodeReaderPromissionService
.
list
(
Wrappers
.<
TNodeReaderPromission
>
query
().
lambda
()
.
eq
(
TNodeReaderPromission:
:
getNodeId
,
nodeInfo
.
getId
()));
nodeInfo
.
setNodeReaderPromissionList
(
nodeReaderPromissionList
);
}
}
processVo
.
setProcessNodeList
(
processNodeList
);
// 路由
TNodeRoute
nodeRoute
=
new
TNodeRoute
();
nodeRoute
.
setProcessId
(
processId
);
// 路由查询
QueryWrapper
<
TNodeRoute
>
queryWrapperNr
=
new
QueryWrapper
<>();
queryWrapperNr
.
setEntity
(
nodeRoute
);
// 路由列表
List
<
TNodeRoute
>
nodeRouteList
=
nodeRouteService
.
list
(
queryWrapperNr
);
for
(
TNodeRoute
tNodeRoute
:
nodeRouteList
)
{
tNodeRoute
.
setNodeRouteConditionList
(
nodeRouteConditionService
.
list
(
Wrappers
.<
TNodeRouteCondition
>
query
().
lambda
().
eq
(
TNodeRouteCondition:
:
getNodeRouteId
,
tNodeRoute
.
getId
())));
}
processVo
.
setNodeRouteList
(
nodeRouteList
);
return
new
R
<>(
processVo
);
List
<
TNodeRoute
>
nodeRouteList
=
nodeRouteService
.
list
(
Wrappers
.<
TNodeRoute
>
query
().
lambda
()
.
eq
(
TNodeRoute:
:
getProcessId
,
processId
));
// 路由条件判断列表
if
(
Common
.
isNotNull
(
nodeRouteList
))
{
List
<
TNodeRouteCondition
>
nodeRouteConditionList
;
for
(
TNodeRoute
tNodeRoute
:
nodeRouteList
)
{
nodeRouteConditionList
=
nodeRouteConditionService
.
list
(
Wrappers
.<
TNodeRouteCondition
>
query
().
lambda
().
eq
(
TNodeRouteCondition:
:
getNodeRouteId
,
tNodeRoute
.
getId
()));
tNodeRoute
.
setNodeRouteConditionList
(
nodeRouteConditionList
);
}
processVo
.
setNodeRouteList
(
nodeRouteList
);
}
return
processVo
;
}
/**
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TAuditNodePro
o
cess.java
→
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TAuditNodeProcess.java
View file @
cb057e5e
...
...
@@ -21,10 +21,10 @@ import java.time.LocalDateTime;
* @since 1.7.5
*/
@Data
@TableName
(
"t_audit_node_pro
o
cess"
)
@TableName
(
"t_audit_node_process"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Schema
(
description
=
"审批主流程记录表节点表"
)
public
class
TAuditNodePro
o
cess
extends
BaseEntity
{
public
class
TAuditNodeProcess
extends
BaseEntity
{
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/config/WxConfig.java
0 → 100644
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
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
;
@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
.
info
(
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
.
info
(
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
;
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:50
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public
boolean
sendAppTextCard
(
RestTemplate
restTemplate
,
Map
<
String
,
Object
>
requestMap
)
{
// 必须加上header说明
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
Gson
gson
=
new
Gson
();
log
.
info
(
"发企业微信===请求:{}"
,
gson
.
toJson
(
requestMap
));
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
gson
.
toJson
(
requestMap
),
headers
);
String
accessToken
=
getAppAccessToken
(
restTemplate
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
String
.
format
(
SecurityConstants
.
WX_SEND_MESSAGE
,
accessToken
),
requestEntity
,
String
.
class
);
log
.
info
(
"发企业微信===返回:{}"
,
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-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TAuditNodeProocessController.java
View file @
cb057e5e
...
...
@@ -2,8 +2,8 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePro
o
cess
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodePro
o
cessService
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProcessService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
@Tag
(
name
=
"审批主流程记录表节点表管理"
)
public
class
TAuditNodeProocessController
{
private
final
TAuditNodeProocessService
tAuditNodePro
ocessService
;
private
final
TAuditNodeProcessService
tAuditNodePr
ocessService
;
/**
* 通过id查询审批主流程记录表节点表
...
...
@@ -34,34 +34,34 @@ public class TAuditNodeProocessController {
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('insurances_tauditnodeproocess_get')"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('insurances_tauditnodeproocess_get')"
)
public
R
<
TAuditNodePro
o
cess
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tAuditNodePro
o
cessService
.
getById
(
id
));
public
R
<
TAuditNodeProcess
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
tAuditNodeProcessService
.
getById
(
id
));
}
/**
* 新增审批主流程记录表节点表
* @param tAuditNodePro
o
cess 审批主流程记录表节点表
* @param tAuditNodeProcess 审批主流程记录表节点表
* @return R
*/
@Operation
(
summary
=
"新增审批主流程记录表节点表"
,
description
=
"新增审批主流程记录表节点表:hasPermission('insurances_tauditnodeproocess_add')"
)
@SysLog
(
"新增审批主流程记录表节点表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('insurances_tauditnodeproocess_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
TAuditNodePro
ocess
tAuditNodePro
ocess
)
{
return
R
.
ok
(
tAuditNodePro
ocessService
.
save
(
tAuditNodePro
ocess
));
public
R
<
Boolean
>
save
(
@RequestBody
TAuditNodePro
cess
tAuditNodePr
ocess
)
{
return
R
.
ok
(
tAuditNodePro
cessService
.
save
(
tAuditNodePr
ocess
));
}
/**
* 修改审批主流程记录表节点表
* @param tAuditNodePro
o
cess 审批主流程记录表节点表
* @param tAuditNodeProcess 审批主流程记录表节点表
* @return R
*/
@Operation
(
summary
=
"修改审批主流程记录表节点表"
,
description
=
"修改审批主流程记录表节点表:hasPermission('insurances_tauditnodeproocess_edit')"
)
@SysLog
(
"修改审批主流程记录表节点表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('insurances_tauditnodeproocess_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
TAuditNodePro
ocess
tAuditNodePro
ocess
)
{
return
R
.
ok
(
tAuditNodePro
ocessService
.
updateById
(
tAuditNodePro
ocess
));
public
R
<
Boolean
>
updateById
(
@RequestBody
TAuditNodePro
cess
tAuditNodePr
ocess
)
{
return
R
.
ok
(
tAuditNodePro
cessService
.
updateById
(
tAuditNodePr
ocess
));
}
/**
...
...
@@ -74,7 +74,7 @@ public class TAuditNodeProocessController {
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('insurances_tauditnodeproocess_del')"
)
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
)
{
return
R
.
ok
(
tAuditNodePro
o
cessService
.
removeById
(
id
));
return
R
.
ok
(
tAuditNodeProcessService
.
removeById
(
id
));
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TAuditNodePro
o
cessMapper.java
→
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TAuditNodeProcessMapper.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePro
o
cess
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
import
org.apache.ibatis.annotations.Mapper
;
/**
...
...
@@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
* @since 1.7.5
*/
@Mapper
public
interface
TAuditNodePro
ocessMapper
extends
BaseMapper
<
TAuditNodePro
ocess
>
{
public
interface
TAuditNodePro
cessMapper
extends
BaseMapper
<
TAuditNodePr
ocess
>
{
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TAuditNodePro
o
cessService.java
→
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TAuditNodeProcessService.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePro
o
cess
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
/**
* 审批主流程记录表节点表
...
...
@@ -10,6 +10,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess;
* @date 2025-01-10 17:47:32
* @since 1.7.5
*/
public
interface
TAuditNodePro
ocessService
extends
IService
<
TAuditNodePro
ocess
>
{
public
interface
TAuditNodePro
cessService
extends
IService
<
TAuditNodePr
ocess
>
{
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/AbastractAuditProcess.java
View file @
cb057e5e
...
...
@@ -3,22 +3,26 @@ package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.google.common.collect.Lists
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserApprovalRoleVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException
;
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.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.ProcessDaprUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditRecord
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditRecordService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodePro
o
cessService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProcessService
;
import
com.yifu.cloud.plus.v1.yifu.process.constant.ProcessConstants
;
import
com.yifu.cloud.plus.v1.yifu.process.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.process.util.CommonProcessUserUtil
;
import
com.yifu.cloud.plus.v1.yifu.process.util.ProcessAuditUtil
;
import
com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
...
...
@@ -34,15 +38,21 @@ import java.util.*;
public
abstract
class
AbastractAuditProcess
<
T
,
E
extends
T
>
{
@Resource
protected
TAuditNodePro
ocessService
auditNodePro
ocessService
;
protected
TAuditNodePro
cessService
auditNodePr
ocessService
;
@Resource
protected
TAuditRecordService
a
pproval
RecordService
;
protected
TAuditRecordService
a
udit
RecordService
;
public
static
final
String
BIGIN_NODE_NO_FOUND
=
"未找到开始审批节点,请联系管理员"
;
public
static
final
String
NEXT_NODE_USER_NULL
=
"未查询到下个节点的用户,请联系管理员"
;
public
static
final
String
NEXT_AUDIT_NODE_NOT_FOUND
=
"未查询到下一个审核节点,请联系管理员"
;
@Autowired
private
ProcessDaprUtils
processDaprUtils
;
@Autowired
private
UpmsDaprUtils
upmsDaprUtils
;
/**
* 审核成功并结束逻辑
* @param entity 业务实体
...
...
@@ -75,7 +85,7 @@ public abstract class AbastractAuditProcess<T,E extends T> {
* @return TProcessNode
**/
abstract
public
TProcessNode
choiceGetNode
(
ProcessVo
processVo
,
List
<
TNodeRoute
>
nodeRouteList
,
List
<
TNodeRouteCondition
>
nodeRouteConditionList
,
TProcessNode
currentNode
,
T
entity
,
String
t
ype
,
YifuUser
loginUser
);
TProcessNode
currentNode
,
T
entity
,
String
auditT
ype
,
YifuUser
loginUser
);
/**
* 审批发消息
...
...
@@ -97,48 +107,38 @@ public abstract class AbastractAuditProcess<T,E extends T> {
/**
* 获取当前节点的审批人
* @param sysUserTprocessNode 当前节点
* @param departId 部门id
* @param entityId 实体id
*
* @param processVo 审批流程完整配置
* @param currentProcessNode 当前节点
* @param departId 部门id
* @param entityId 实体id
* @param auditType 审核类型 0不购买商险审核
* @return List<SysUser>
**/
private
List
<
SysUser
>
getAuditUse
rByTprocessNode
(
TProcessNode
sysUserTp
rocessNode
,
String
departId
,
String
entityId
,
String
auditType
,
private
List
<
SysUser
>
getAuditUse
ListByProcessNode
(
ProcessVo
processVo
,
TProcessNode
currentP
rocessNode
,
String
departId
,
String
entityId
,
String
auditType
,
T
entity
,
TAuditRecord
approvalRecord
)
{
// todo 获取当前流程 改成dapr写法
R
<
ProcessVo
>
processVoByName
=
null
;
// remoteProcessService.getProcessVoByName(sysUserTprocessNode.getProcessId());
// todo 临时
if
(
processVoByName
==
null
){
throw
new
CheckedException
(
"未找到审批节点,请联系管理员"
);
}
ProcessVo
processVo
=
processVoByName
.
getData
();
List
<
TNodePrimission
>
nodePrimissions
=
null
;
// 定义审批用户
List
<
TNodePrimission
>
nodePrimissionList
=
null
;
for
(
TProcessNode
processNode
:
processVo
.
getProcessNodeList
())
{
if
(
StringUtils
.
equals
(
sysUserTprocessNode
.
getLogoTitle
(),
processNode
.
getLogoTitle
()))
{
List
<
TNodePrimission
>
nodePrimissionList
=
processNode
.
getNodePrimissionList
();
if
(
nodePrimissionList
!=
null
&&
!
nodePrimissionList
.
isEmpty
())
{
nodePrimissions
=
nodePrimissionList
;
}
if
(
StringUtils
.
equals
(
currentProcessNode
.
getLogoTitle
(),
processNode
.
getLogoTitle
()))
{
nodePrimissionList
=
processNode
.
getNodePrimissionList
();
}
}
if
(
nodePrimissions
==
null
)
{
throw
new
CheckedException
(
"未找到审批节点,请联系管理员"
);
if
(
Common
.
isEmpty
(
nodePrimissionList
))
{
throw
new
CheckedException
(
"未找到审批用户信息,请联系管理员"
);
}
// 获取所有审批用户
List
<
SysUser
>
sysUserList
=
new
ArrayList
<>();
// 节点是否允许跳过(0:不允许,1允许)
Integer
isPass
=
CommonConstants
.
ZERO_INT
;
for
(
TNodePrimission
nodePrimission
:
nodePrimission
s
)
{
// 审核用户改造;
2指定权限;3指定用户;5指定角色(crm);6指定事业部配置表
for
(
TNodePrimission
nodePrimission
:
nodePrimission
List
)
{
// 审核用户改造;
3指定用户;5指定角色(crm)
if
(
CommonConstants
.
THREE_INT
==
nodePrimission
.
getType
().
intValue
()
||
CommonConstants
.
TWO_INT
==
nodePrimission
.
getType
().
intValue
()
||
CommonConstants
.
FIVE_INT
==
nodePrimission
.
getType
().
intValue
())
{
// todo
sysUserList
=
CommonProcessUserUtil
.
getDepartAuditUser
(
nodePrimission
,
departId
);
sysUserList
=
this
.
getDepartAuditUser
(
nodePrimission
,
departId
);
}
// 6指定事业部配置表
if
(
CommonConstants
.
SIX_INT
==
nodePrimission
.
getType
().
intValue
())
{
// todo 根据事业部条线获取审批用户
sysUserList
=
this
.
getDivisionAuditUser
(
nodePrimission
,
entity
);
...
...
@@ -153,28 +153,28 @@ public abstract class AbastractAuditProcess<T,E extends T> {
// 标记节点可以跳过
isPass
=
CommonConstants
.
ONE_INT
;
// todo 系统自动给当前节点完成审核,将审核通过
//
sysAutoAudit(sysUserTprocessNode,entity,processVo);
//
sysAutoAudit(sysUserTprocessNode,entity,processVo);
}
else
{
if
(
Common
.
isEmpty
(
sysUserList
))
{
throw
new
CheckedException
(
"未找到审批用户"
);
}
//微信审批通知发送
//发送审批消息
//
微信审批通知发送
//
todo
发送审批消息
sendMessage
(
sysUserList
,
entity
,
CommonConstants
.
ONE_STRING
,
approvalRecord
);
for
(
SysUser
sysUser
:
sysUserList
)
{
// 新增指派审核流程记录
TAuditRecord
newEntity
=
new
TAuditRecord
();
newEntity
.
setDomainId
(
entityId
);
newEntity
.
setFlowId
(
sysUserTp
rocessNode
.
getProcessId
());
newEntity
.
setNodeId
(
sysUserTp
rocessNode
.
getId
());
newEntity
.
setFlowId
(
currentP
rocessNode
.
getProcessId
());
newEntity
.
setNodeId
(
currentP
rocessNode
.
getId
());
newEntity
.
setApprovalMan
(
String
.
valueOf
(
sysUser
.
getUserId
()));
newEntity
.
setApprovalManName
(
sysUser
.
getNickname
());
newEntity
.
setDeleteFlag
(
CommonConstants
.
NOT_DELETE_FLAG
);
newEntity
.
setPreFlag
(
CommonConstants
.
ONE_STRING
);
newEntity
.
setApprovalResult
(
CommonConstants
.
TWO_STRING
);
newEntity
.
setNodeName
(
sysUserTp
rocessNode
.
getName
());
newEntity
.
setNodeName
(
currentP
rocessNode
.
getName
());
// 获取提交人信息
TAuditRecord
tAuditRecord
=
a
pproval
RecordService
.
getOne
(
Wrappers
.<
TAuditRecord
>
query
().
lambda
().
eq
(
TAuditRecord:
:
getDomainId
,
entityId
)
TAuditRecord
tAuditRecord
=
a
udit
RecordService
.
getOne
(
Wrappers
.<
TAuditRecord
>
query
().
lambda
().
eq
(
TAuditRecord:
:
getDomainId
,
entityId
)
.
eq
(
TAuditRecord:
:
getAuditType
,
auditType
)
.
eq
(
TAuditRecord:
:
getPreFlag
,
CommonConstants
.
ONE_STRING
)
.
eq
(
TAuditRecord:
:
getApprovalResult
,
CommonConstants
.
THREE_STRING
)
...
...
@@ -188,9 +188,8 @@ public abstract class AbastractAuditProcess<T,E extends T> {
newEntity
.
setAuditType
(
tAuditRecord
.
getAuditType
());
}
newEntity
.
setCreateTime
(
LocalDateTime
.
now
());
a
pproval
RecordService
.
save
(
newEntity
);
a
udit
RecordService
.
save
(
newEntity
);
}
// todo 存当前审核人信息[AUDIT_USER]多个用逗号隔开
}
...
...
@@ -208,44 +207,41 @@ public abstract class AbastractAuditProcess<T,E extends T> {
/**
* 提交审核:获取审核人
* @param
id
实体id
* @param
entityId
实体id
* @param loginUser 当前登录人
* @param departId 部门id 通过该部门获取审批流程
* @param processType 流程类型 1不购买商险申请
* @param auditType 审核类型 0不购买商险审核
* @param reason 申请原因(非必填)
* @param entityName 实体标识信息
* @return R<List<SysUser>>
**/
public
R
<
List
<
SysUser
>>
commitAuditUserList
(
String
i
d
,
YifuUser
loginUser
,
String
departId
,
String
processType
,
String
auditType
,
public
R
<
List
<
SysUser
>>
getAuditUserList
(
String
entityI
d
,
YifuUser
loginUser
,
String
departId
,
String
processType
,
String
auditType
,
String
reason
,
String
entityName
,
T
entity
,
Class
<
T
>
clazz
)
{
//获取合同审批流程与下一个审核人节点
ProcessVo
processVo
=
null
;
//获取正确流程
TProcessApprovalConf
processApprovalConf
=
getProcessApprovalConf
(
processType
);
// todo 改成dapr获取
//processVo = ProcessAuditUtil.getProcessVo(remoteProcessService, processApprovalConf.getProcessId());
if
(
processVo
==
null
)
{
// 获取审批流程完整配置
ProcessVo
processVo
=
this
.
getProcessVoByType
(
processType
);
if
(
Common
.
isEmpty
(
processVo
))
{
throw
new
CheckedException
(
"未找到满足条件的主流程,请联系管理员"
);
}
//获取开始节点
TProcessNode
start
T
ProcessNode
=
ProcessAuditUtil
.
getBeginProcessNode
(
processVo
);
if
(
startTProcessNode
==
null
)
{
//
获取开始节点
TProcessNode
startProcessNode
=
ProcessAuditUtil
.
getBeginProcessNode
(
processVo
);
if
(
Common
.
isEmpty
(
startProcessNode
)
)
{
return
R
.
failed
(
BIGIN_NODE_NO_FOUND
);
}
String
currentNode
=
startT
ProcessNode
.
getLogoTitle
();
// 保存TAuditNodePro
o
cess节点信息
saveNodeProcess
(
processVo
,
currentNode
,
i
d
,
auditType
);
String
startNodeLogo
=
start
ProcessNode
.
getLogoTitle
();
// 保存TAuditNodeProcess节点信息
saveNodeProcess
(
processVo
,
startNodeLogo
,
entityI
d
,
auditType
);
// 获取开始节点下一个审核节点
TProcessNode
sysUserTprocessNode
=
getNextNode
(
processVo
,
currentNode
,
i
d
,
auditType
,
entity
,
loginUser
);
if
(
sysUserTprocessNode
==
null
)
{
TProcessNode
nextProcessNode
=
getNextNode
(
processVo
,
startNodeLogo
,
entityI
d
,
auditType
,
entity
,
loginUser
);
if
(
Common
.
isEmpty
(
nextProcessNode
)
)
{
throw
new
CheckedException
(
NEXT_AUDIT_NODE_NOT_FOUND
);
}
// 记录提交审核日志
TAuditRecord
submitAuditRecord
=
new
TAuditRecord
();
submitAuditRecord
.
setDomainId
(
i
d
);
submitAuditRecord
.
setFlowId
(
start
T
ProcessNode
.
getProcessId
());
submitAuditRecord
.
setNodeId
(
start
T
ProcessNode
.
getId
());
submitAuditRecord
.
setDomainId
(
entityI
d
);
submitAuditRecord
.
setFlowId
(
startProcessNode
.
getProcessId
());
submitAuditRecord
.
setNodeId
(
startProcessNode
.
getId
());
submitAuditRecord
.
setApprovalMan
(
String
.
valueOf
(
loginUser
.
getId
()));
submitAuditRecord
.
setApprovalManName
(
loginUser
.
getNickname
());
// 审批结果为“提交”
...
...
@@ -256,19 +252,20 @@ public abstract class AbastractAuditProcess<T,E extends T> {
submitAuditRecord
.
setPreFlag
(
CommonConstants
.
ONE_STRING
);
submitAuditRecord
.
setSubmitMan
(
String
.
valueOf
(
loginUser
.
getId
()));
submitAuditRecord
.
setSubmitManName
(
loginUser
.
getNickname
());
//申请原因
//
申请原因
submitAuditRecord
.
setReason
(
reason
);
//审核类型
//
审核类型
submitAuditRecord
.
setAuditType
(
auditType
);
submitAuditRecord
.
setCreateTime
(
LocalDateTime
.
now
());
submitAuditRecord
.
setNodeName
(
"提交"
);
// 提交节点名称
submitAuditRecord
.
setNodeName
(
startProcessNode
.
getName
());
submitAuditRecord
.
setSubmitCreateTime
(
LocalDateTime
.
now
());
submitAuditRecord
.
setEntityName
(
entityName
);
a
pproval
RecordService
.
save
(
submitAuditRecord
);
a
udit
RecordService
.
save
(
submitAuditRecord
);
// 获取节点审核人
List
<
SysUser
>
remoteSysUserList
=
getAuditUse
rByTprocessNode
(
sysUserTprocessNode
,
departId
,
id
,
auditType
,
entity
,
submitAuditRecord
);
if
(
remoteSysUserList
==
null
)
{
List
<
SysUser
>
remoteSysUserList
=
getAuditUse
ListByProcessNode
(
processVo
,
nextProcessNode
,
departId
,
entityId
,
auditType
,
entity
,
submitAuditRecord
);
if
(
Common
.
isEmpty
(
remoteSysUserList
)
)
{
throw
new
CheckedException
(
NEXT_NODE_USER_NULL
);
}
return
new
R
<>(
remoteSysUserList
);
...
...
@@ -289,24 +286,24 @@ public abstract class AbastractAuditProcess<T,E extends T> {
String
auditType
,
T
entity
,
String
departId
)
{
String
loginUserId
=
loginUser
.
getId
();
// 判断当前审核是否为最新待审核记录
List
<
TAuditRecord
>
a
pprovalRecords
=
approval
RecordService
.
list
List
<
TAuditRecord
>
a
uditRecordList
=
audit
RecordService
.
list
(
Wrappers
.<
TAuditRecord
>
query
().
lambda
().
eq
(
TAuditRecord:
:
getDomainId
,
id
)
.
eq
(
TAuditRecord:
:
getAuditType
,
auditType
)
.
eq
(
TAuditRecord:
:
getDeleteFlag
,
CommonConstants
.
NOT_DELETE_FLAG
)
.
eq
(
TAuditRecord:
:
getApprovalResult
,
CommonConstants
.
TWO_STRING
)
.
eq
(
TAuditRecord:
:
getApprovalMan
,
loginUserId
));
if
(
a
pprovalRecords
.
size
()
!=
CommonConstants
.
ONE_INT
)
{
if
(
a
uditRecordList
.
size
()
!=
CommonConstants
.
ONE_INT
)
{
return
R
.
failed
(
"当前用户不能审核该记录"
);
}
// 更新审核记录信息
TAuditRecord
a
pprovalRecord
=
approvalRecords
.
get
(
0
);
approval
Record
.
setApprovalResult
(
approvalResult
);
approval
Record
.
setApprovalOpinion
(
approvalOpinion
);
approval
Record
.
setApprovalTime
(
LocalDateTime
.
now
());
a
pprovalRecordService
.
updateById
(
approval
Record
);
TAuditRecord
a
uditRecord
=
auditRecordList
.
get
(
0
);
audit
Record
.
setApprovalResult
(
approvalResult
);
audit
Record
.
setApprovalOpinion
(
approvalOpinion
);
audit
Record
.
setApprovalTime
(
LocalDateTime
.
now
());
a
uditRecordService
.
updateById
(
audit
Record
);
// 移除同一个节点的另外审批人。多个节点一个人审批就够了,其他都移除
a
pproval
RecordService
.
remove
(
Wrappers
.<
TAuditRecord
>
query
().
lambda
()
a
udit
RecordService
.
remove
(
Wrappers
.<
TAuditRecord
>
query
().
lambda
()
.
eq
(
TAuditRecord:
:
getDomainId
,
id
)
.
eq
(
TAuditRecord:
:
getAuditType
,
auditType
)
.
isNull
(
TAuditRecord:
:
getApprovalTime
));
...
...
@@ -315,139 +312,131 @@ public abstract class AbastractAuditProcess<T,E extends T> {
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
approvalResult
))
{
// 获取流程,并判断是否是最后一个节点
// 获取流程的主流程
TAuditNodePro
ocess
auditNodeProocess
=
auditNodeProocessService
.
getOne
(
Wrappers
.<
TAuditNodePro
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodePro
o
cess:
:
getDomainId
,
id
)
.
eq
(
TAuditNodePro
o
cess:
:
getType
,
auditType
)
.
eq
(
TAuditNodePro
o
cess:
:
getMainType
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TAuditNodePro
o
cess:
:
getDeleteFlag
,
CommonConstants
.
NOT_DELETE_FLAG
)
.
orderByDesc
(
TAuditNodePro
o
cess:
:
getId
)
TAuditNodePro
cess
auditNodeProocess
=
auditNodeProcessService
.
getOne
(
Wrappers
.<
TAuditNodePr
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
id
)
.
eq
(
TAuditNodeProcess:
:
getType
,
auditType
)
.
eq
(
TAuditNodeProcess:
:
getMainType
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TAuditNodeProcess:
:
getDeleteFlag
,
CommonConstants
.
NOT_DELETE_FLAG
)
.
orderByDesc
(
TAuditNodeProcess:
:
getId
)
.
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
if
(
auditNodeProocess
==
null
)
{
throw
new
CheckedException
(
"未获取到审批记录流程数据"
);
}
// todo 改成dapr获取
ProcessVo
processVo
=
null
;
// ProcessAuditUtil.getProcessVo(remoteProcessService, auditNodeProocess.getProcessId());
// todo 临时
if
(
processVo
==
null
)
{
throw
new
CheckedException
(
"未获取到结束节点"
);
}
// 改成dapr获取
ProcessVo
processVo
=
this
.
getProcessVoById
(
auditNodeProocess
.
getProcessId
());
TProcessNode
endProcessNode
=
ProcessAuditUtil
.
getEndProcessNode
(
processVo
);
if
(
endProcessNode
==
null
)
{
throw
new
CheckedException
(
"未获取到结束节点"
);
}
TProcessNode
preEndTProcessNode
=
ProcessAuditUtil
.
getPreEndTProcessNode
(
processVo
,
endProcessNode
);
if
(
preEndTProcessNode
==
null
)
{
TProcessNode
preEndProcessNode
=
ProcessAuditUtil
.
getPreEndTProcessNode
(
processVo
,
endProcessNode
);
if
(
preEndProcessNode
==
null
)
{
throw
new
CheckedException
(
"未找到结束节点前一个节点"
);
}
// 当前是结束节点前的一个节点
if
(
StringUtils
.
equals
(
preEnd
TProcessNode
.
getId
(),
approval
Record
.
getNodeId
()))
{
if
(
StringUtils
.
equals
(
preEnd
ProcessNode
.
getId
(),
audit
Record
.
getNodeId
()))
{
// 走审核通过处理
return
auditSuccess
(
entity
,
a
pproval
Record
,
loginUser
);
return
auditSuccess
(
entity
,
a
udit
Record
,
loginUser
);
}
else
{
// todo 改成dapr——获取自动下一个审核人
// 获取流程的下一个节点,可能下一个节点是子流程,也可能是主节点,所以重新获取当前执行审批的流程和节点
ProcessVo
processVoByApproval
=
null
;
// ProcessAuditUtil.getProcessVo(remoteProcessService, approvalRecord.getFlowId());
// todo 临时
if
(
processVoByApproval
==
null
)
{
throw
new
CheckedException
(
"未获取到下一个审核人节点"
);
}
// todo 判断当前是否是当前审核节点到下一个审核节点前的加签节点
TProcessNode
currentProcessNode
=
ProcessAuditUtil
.
getCurrentProcessNode
(
processVoByApproval
,
approvalRecord
.
getNodeId
());
TProcessNode
sysUserTprocessNode
=
getNextNode
(
processVoByApproval
,
currentProcessNode
.
getLogoTitle
(),
id
,
auditType
,
entity
,
loginUser
);
if
(
sysUserTprocessNode
==
null
)
{
TProcessNode
currentProcessNode
=
ProcessAuditUtil
.
getCurrentProcessNode
(
processVo
,
auditRecord
.
getNodeId
());
TProcessNode
nextProcessNode
=
getNextNode
(
processVo
,
currentProcessNode
.
getLogoTitle
(),
id
,
auditType
,
entity
,
loginUser
);
if
(
nextProcessNode
==
null
)
{
throw
new
CheckedException
(
NEXT_AUDIT_NODE_NOT_FOUND
);
}
auditNodeProocess
=
auditNodeProocessService
.
getOne
(
Wrappers
.<
TAuditNodeProocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProocess:
:
getDomainId
,
id
)
.
eq
(
TAuditNodeProocess:
:
getType
,
auditType
)
.
eq
(
TAuditNodeProocess:
:
getMainType
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TAuditNodeProocess:
:
getDeleteFlag
,
CommonConstants
.
NOT_DELETE_FLAG
)
.
orderByDesc
(
TAuditNodeProocess:
:
getId
)
auditNodeProocess
=
auditNodeProcessService
.
getOne
(
Wrappers
.<
TAuditNodeProcess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
id
)
.
eq
(
TAuditNodeProcess:
:
getType
,
auditType
)
.
eq
(
TAuditNodeProcess:
:
getMainType
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TAuditNodeProcess:
:
getDeleteFlag
,
CommonConstants
.
NOT_DELETE_FLAG
)
.
orderByDesc
(
TAuditNodeProcess:
:
getId
)
.
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
// 如果返回的是end节点:判断是不是返回的是不是主流程结束节点
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_END
,
sysUserTp
rocessNode
.
getType
())
&&
StringUtils
.
equals
(
auditNodeProocess
.
getProcessId
(),
sysUserTp
rocessNode
.
getProcessId
()))
{
//审核通过流程
return
auditSuccess
(
entity
,
a
pproval
Record
,
loginUser
);
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_END
,
nextP
rocessNode
.
getType
())
&&
StringUtils
.
equals
(
auditNodeProocess
.
getProcessId
(),
nextP
rocessNode
.
getProcessId
()))
{
//
审核通过流程
return
auditSuccess
(
entity
,
a
udit
Record
,
loginUser
);
}
// 获取审批用户
List
<
SysUser
>
remoteSysUserList
=
getAuditUse
rByTprocessNode
(
sysUserTprocessNode
,
departId
,
id
,
auditType
,
entity
,
approval
Record
);
if
(
remoteSysUserList
==
null
)
{
List
<
SysUser
>
remoteSysUserList
=
getAuditUse
ListByProcessNode
(
processVo
,
nextProcessNode
,
departId
,
id
,
auditType
,
entity
,
audit
Record
);
if
(
Common
.
isEmpty
(
remoteSysUserList
)
)
{
throw
new
CheckedException
(
NEXT_NODE_USER_NULL
);
}
// 流程中的审核结束,继续下一个节点
return
auditSuccessAndNex
(
entity
,
remoteSysUserList
,
a
pproval
Record
);
return
auditSuccessAndNex
(
entity
,
remoteSysUserList
,
a
udit
Record
);
}
}
else
{
//审核不通过处理
return
auditFail
(
entity
,
a
pproval
Record
);
return
auditFail
(
entity
,
a
udit
Record
);
}
}
/**
* 获取下一个节点
* @param processVo 流程记录
* @param currentNodeString 当前节点
* @param id 实体id
**/
private
TProcessNode
getNextNode
(
ProcessVo
processVo
,
String
currentNodeString
,
String
id
,
String
auditType
,
T
entity
,
YifuUser
loginUser
)
{
// 判断进行到的节点当前流程是主流程还是子流程,如果是主流程,则进行主流程,如果是子流程,则进行子流程判断
TAuditNodeProocess
auditNodeProocess
=
auditNodeProocessService
.
getOne
(
Wrappers
.<
TAuditNodeProocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProocess:
:
getDomainId
,
id
)
.
eq
(
TAuditNodeProocess:
:
getType
,
auditType
)
.
eq
(
TAuditNodeProocess:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
isNotNull
(
TAuditNodeProocess:
:
getLogoTitle
)
.
orderByDesc
(
TAuditNodeProocess:
:
getId
).
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
// 流程预览功能无需判断当前节点是否一致
if
(
auditNodeProocess
!=
null
&&
!
StringUtils
.
equals
(
currentNodeString
,
auditNodeProocess
.
getLogoTitle
()))
{
/**
* 获取下一个节点信息
* @param processVo 当前流程配置信息
* @param currentNodeLogo 当前节点标识
* @param entityId 实体ID
* @param auditType 审核类型 0不购买商险审核
* @param entity 实体信息
* @param loginUser 登录人信息
* @return TProcessNode
**/
private
TProcessNode
getNextNode
(
ProcessVo
processVo
,
String
currentNodeLogo
,
String
entityId
,
String
auditType
,
T
entity
,
YifuUser
loginUser
)
{
// 获取已经过的节点信息
TAuditNodeProcess
auditNodeProcess
=
auditNodeProcessService
.
getOne
(
Wrappers
.<
TAuditNodeProcess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
entityId
)
.
eq
(
TAuditNodeProcess:
:
getType
,
auditType
)
.
eq
(
TAuditNodeProcess:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
isNotNull
(
TAuditNodeProcess:
:
getLogoTitle
)
.
orderByDesc
(
TAuditNodeProcess:
:
getId
).
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
if
(
Common
.
isNotNull
(
auditNodeProcess
)
&&
!
StringUtils
.
equals
(
currentNodeLogo
,
auditNodeProcess
.
getLogoTitle
()))
{
throw
new
CheckedException
(
"记录的流程节点和当前执行节点不匹配"
);
}
// 当前流程配置节点信息
List
<
TProcessNode
>
processNodeList
=
processVo
.
getProcessNodeList
();
// 当前流程配置路由信息
List
<
TNodeRoute
>
nodeRouteList
=
processVo
.
getNodeRouteList
();
//判断当前节点类型,如果是选择节点则进行条件表达式判断判断
//
判断当前节点类型,如果是选择节点则进行条件表达式判断判断
TProcessNode
currentNode
=
null
;
for
(
TProcessNode
processNode
:
processNodeList
)
{
if
(
StringUtils
.
equals
(
currentNode
String
,
processNode
.
getLogoTitle
()))
{
if
(
StringUtils
.
equals
(
currentNode
Logo
,
processNode
.
getLogoTitle
()))
{
currentNode
=
processNode
;
}
}
if
(
currentNode
==
null
)
{
if
(
Common
.
isEmpty
(
currentNode
)
)
{
throw
new
CheckedException
(
"未获取到当前节点"
);
}
// 当前节点为选择节点,获取当前节点路由类型
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_TYPE_CHOICE
,
currentNode
.
getType
()))
{
// 当前节点为选择节点,获取当前节点路由类型
List
<
TNodeRouteCondition
>
nodeRouteConditionList
=
Lists
.
newArrayList
();
for
(
TNodeRoute
nodeRoute
:
nodeRouteList
)
{
// 获取选择节点下的判断分支信息存到nodeRouteConditionList
if
(
StringUtils
.
equals
(
currentNode
.
getLogoTitle
(),
nodeRoute
.
getPrewNode
()))
{
nodeRouteConditionList
.
addAll
(
nodeRoute
.
getNodeRouteConditionList
());
}
}
// 根据判断条件获取下一个审批节点信息
return
choiceGetNode
(
processVo
,
nodeRouteList
,
nodeRouteConditionList
,
currentNode
,
entity
,
auditType
,
loginUser
);
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_END
,
currentNode
.
getType
()))
{
// 当前到了结束节点
TProcessNode
endNode
=
ProcessAuditUtil
.
getEndProcessNode
(
processVo
);
if
(
StringUtils
.
equals
(
currentNode
.
getId
(),
endNode
.
getId
()))
{
return
endNode
;
}
else
{
throw
new
CheckedException
(
"当前不是结束节点"
);
}
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_BEGIN
,
currentNode
.
getType
())
||
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_SERVICE
,
currentNode
.
getType
()))
{
//查找下个节点
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_BEGIN
,
currentNode
.
getType
())
||
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_SERVICE
,
currentNode
.
getType
()))
{
// 当前是开始节点或者服务节点
try
{
TNodeRoute
nexTNodeRoute
=
ProcessAuditUtil
.
getNexTNodeRoute
(
nodeRouteList
,
currentNodeString
);
saveNodeProcess
(
processVo
,
nexTNodeRoute
.
getNextNode
(),
id
,
auditType
);
return
validateTwoNextNode
(
processVo
,
nexTNodeRoute
.
getNextNode
(),
id
,
nexTNodeRoute
.
getRouteType
(),
auditType
,
entity
,
loginUser
);
// 查找节点后的路由信息
TNodeRoute
nexNodeRoute
=
ProcessAuditUtil
.
getNexTNodeRoute
(
nodeRouteList
,
currentNodeLogo
);
// 存下一个节点的信息
saveNodeProcess
(
processVo
,
nexNodeRoute
.
getNextNode
(),
entityId
,
auditType
);
// 校验即将进入的节点信息,是审批节点返回节点信息,不是继续找下一个节点信息
return
validateNextNode
(
processVo
,
nexNodeRoute
.
getNextNode
(),
entityId
,
nexNodeRoute
.
getRouteType
(),
auditType
,
entity
,
loginUser
);
}
catch
(
Exception
e
){
if
(
Common
.
isEmpty
(
processVo
.
getIsPreview
())){
throw
e
;
}
return
null
;
// todo 优化报错展示形式
throw
e
;
}
}
else
{
throw
new
CheckedException
(
"未知的流程节点类型"
);
...
...
@@ -455,111 +444,165 @@ public abstract class AbastractAuditProcess<T,E extends T> {
}
/**
* 通过表中配置的字段名称去取对应判断条件
* @param type 流程类型:类型 1不购买商险申请
* @return TProcessApprovalConf
**/
private
TProcessApprovalConf
getProcessApprovalConf
(
String
type
)
{
return
null
;
// todo 找到对应的流程查看判断的类名和字段名
// R<TProcessApprovalConf> processApprovalConfR = remoteProcessService.getRecordbyTypeAndParentId(type);
// if (processApprovalConfR != null && processApprovalConfR.getData() != null && CommonConstants.SUCCESS == processApprovalConfR.getCode()) {
// return processApprovalConfR.getData();
// } else {
// throw new CheckedException("未获取到对应流程配置");
// }
// throw new CheckedException("调用流程服务返回数据为空");
}
/**
* 校验下一个节点
* @param processVo 流程配置信息
* @param currentNodeString 当前节点
* @param id 实体id
* @param routeType 上一个路由类型
* 校验即将进入的节点信息,是审批节点返回节点信息,不是继续找下一个节点信息
* @param processVo 流程配置信息
* @param currentNodeLogo 当前节点标识
* @param entityId 实体id
* @param preRouteType 上一个路由类型
* @param auditType 审核类型 0不购买商险审核
* @return TProcessNode
**/
protected
TProcessNode
validate
TwoNextNode
(
ProcessVo
processVo
,
String
currentNodeString
,
String
id
,
String
r
outeType
,
String
auditType
,
protected
TProcessNode
validate
NextNode
(
ProcessVo
processVo
,
String
currentNodeLogo
,
String
entityId
,
String
preR
outeType
,
String
auditType
,
T
entity
,
YifuUser
loginUser
)
{
// 获取节点配置信息
List
<
TProcessNode
>
processNodeList
=
processVo
.
getProcessNodeList
();
//
判断当前节点类型,如果是选择节点则进行条件表达式判断判断
//
获取即将进入的节点信息
TProcessNode
currentNode
=
null
;
for
(
TProcessNode
processNode
:
processNodeList
)
{
if
(
StringUtils
.
equals
(
currentNode
String
,
processNode
.
getLogoTitle
()))
{
if
(
StringUtils
.
equals
(
currentNode
Logo
,
processNode
.
getLogoTitle
()))
{
currentNode
=
processNode
;
}
}
if
(
Common
.
isEmpty
(
currentNode
)){
throw
new
CheckedException
(
"未获取到当前节点,请联系管理员处理"
);
}
//
1.7.5 未引入抄送逻辑:获取下个抄送节点信息(暂未引入)
//
即将进入的节点是选择判断节点,继续往找下一个节点信息
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_TYPE_CHOICE
,
currentNode
.
getType
()))
{
return
getNextNode
(
processVo
,
currentNode
String
,
i
d
,
auditType
,
entity
,
loginUser
);
return
getNextNode
(
processVo
,
currentNode
Logo
,
entityI
d
,
auditType
,
entity
,
loginUser
);
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_SERVICE
,
currentNode
.
getType
()))
{
if
(
StringUtils
.
equals
(
routeType
,
CommonConstants
.
ONE_STRING
))
{
// 是审批节点
// 即将进入的节点是选择服务节点,继续根据路由判断
if
(
StringUtils
.
equals
(
preRouteType
,
CommonConstants
.
ONE_STRING
))
{
// 即将进入的节点是审批节点,返回节点信息
return
currentNode
;
}
else
if
(
StringUtils
.
equals
(
r
outeType
,
CommonConstants
.
THREE_STRING
))
{
}
else
if
(
StringUtils
.
equals
(
preR
outeType
,
CommonConstants
.
THREE_STRING
))
{
// 1.7.5 未引入抄送逻辑
// 继续找下一个节点
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
i
d
,
auditType
,
entity
,
loginUser
);
//
即将进入的节点是抄送节点,
继续找下一个节点
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
entityI
d
,
auditType
,
entity
,
loginUser
);
}
else
{
throw
new
CheckedException
(
"未知的节点"
);
}
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_BEGIN
,
currentNode
.
getType
()))
{
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
i
d
,
auditType
,
entity
,
loginUser
);
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
entityI
d
,
auditType
,
entity
,
loginUser
);
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_END
,
currentNode
.
getType
()))
{
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
i
d
,
auditType
,
entity
,
loginUser
);
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
entityI
d
,
auditType
,
entity
,
loginUser
);
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_EMBED
,
currentNode
.
getType
()))
{
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
i
d
,
auditType
,
entity
,
loginUser
);
return
getNextNode
(
processVo
,
currentNode
.
getLogoTitle
(),
entityI
d
,
auditType
,
entity
,
loginUser
);
}
else
{
throw
new
CheckedException
(
"未知的节点"
);
}
}
/**
* 保存经过流程节点记录
* @param processVo
* @param nextNodeString
* @param entityId
* @param processVo 当前流程配置信息
* @param currentNodeLogo 当前节点标识
* @param entityId 实体ID
* @param type 审核类型 0不购买商险审核
**/
protected
void
saveNodeProcess
(
ProcessVo
processVo
,
String
nextNodeString
,
String
entityId
,
String
type
)
{
protected
void
saveNodeProcess
(
ProcessVo
processVo
,
String
currentNodeLogo
,
String
entityId
,
String
type
)
{
// 当前节点的信息
TProcessNode
processNode
=
null
;
for
(
TProcessNode
node
:
processVo
.
getProcessNodeList
())
{
if
(
StringUtils
.
equals
(
nextNodeString
,
node
.
getLogoTitle
()))
{
if
(
StringUtils
.
equals
(
currentNodeLogo
,
node
.
getLogoTitle
()))
{
processNode
=
node
;
}
}
if
(
processNode
==
null
)
{
throw
new
CheckedException
(
"节点id为空"
);
// todo 优化报错展示形式
if
(
Common
.
isEmpty
(
processNode
))
{
throw
new
CheckedException
(
"保存经过流程节点记录时,节点信息未找到"
);
}
TAuditNodeProocess
auditNodeProocess
=
new
TAuditNodeProocess
();
saveProcessNodeProcess
(
processVo
,
entityId
,
type
,
processNode
,
auditNodeProocess
);
// 保存本次节点记录
TAuditNodeProcess
auditNodeProcess
=
new
TAuditNodeProcess
();
auditNodeProcess
.
setDomainId
(
entityId
);
auditNodeProcess
.
setNodeId
(
processNode
.
getId
());
auditNodeProcess
.
setProcessId
(
processNode
.
getProcessId
());
auditNodeProcess
.
setCreateTime
(
LocalDateTime
.
now
());
// 新版流程审批默认主节点
auditNodeProcess
.
setMainType
(
CommonConstants
.
ZERO_STRING
);
auditNodeProcess
.
setLogoTitle
(
processNode
.
getLogoTitle
());
auditNodeProcess
.
setNodeType
(
processNode
.
getType
());
auditNodeProcess
.
setNodeName
(
processNode
.
getName
());
auditNodeProcess
.
setProcessName
(
processVo
.
getName
());
auditNodeProcess
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
auditNodeProcess
.
setType
(
type
);
auditNodeProcessService
.
save
(
auditNodeProcess
);
}
/**
* 保存经过流程节点记录
* @param processVo
* @param entityId
* @param processNode
* @param auditNodeProocess
**/
private
void
saveProcessNodeProcess
(
ProcessVo
processVo
,
String
entityId
,
String
type
,
TProcessNode
processNode
,
TAuditNodeProocess
auditNodeProocess
)
{
auditNodeProocess
.
setDomainId
(
entityId
);
auditNodeProocess
.
setNodeId
(
processNode
.
getId
());
auditNodeProocess
.
setProcessId
(
processNode
.
getProcessId
());
auditNodeProocess
.
setCreateTime
(
LocalDateTime
.
now
());
// todo 新版流程审批默认主节点
auditNodeProocess
.
setMainType
(
CommonConstants
.
ZERO_STRING
);
auditNodeProocess
.
setLogoTitle
(
processNode
.
getLogoTitle
());
auditNodeProocess
.
setNodeType
(
processNode
.
getType
());
auditNodeProocess
.
setNodeName
(
processNode
.
getName
());
auditNodeProocess
.
setProcessName
(
processVo
.
getName
());
auditNodeProocess
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
auditNodeProocess
.
setType
(
type
);
auditNodeProocessService
.
save
(
auditNodeProocess
);
}
/**
* 根据流程类型查询ProcessVo
* @param processType 流程类型
* @return R<ProcessVo>
* @since mvp1.7.5
**/
private
ProcessVo
getProcessVoByType
(
String
processType
)
{
// 改成dapr请求
R
<
ProcessVo
>
processVoR
=
processDaprUtils
.
getProcessVoByType
(
processType
);
if
(
processVoR
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回为空"
);
}
if
(
CommonConstants
.
SUCCESS
!=
processVoR
.
getCode
())
{
throw
new
CheckedException
(
"调用流程服务返回失败"
);
}
ProcessVo
processVo
=
processVoR
.
getData
();
if
(
processVo
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回数据为空"
);
}
return
processVo
;
}
/**
* 根据流程Id查询ProcessVo
* @param processId 流程Id
* @return R<ProcessVo>
* @since mvp1.7.5
**/
private
ProcessVo
getProcessVoById
(
String
processId
)
{
// 改成dapr请求
R
<
ProcessVo
>
processVoR
=
processDaprUtils
.
getProcessVoById
(
processId
);
if
(
processVoR
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回为空"
);
}
if
(
CommonConstants
.
SUCCESS
!=
processVoR
.
getCode
())
{
throw
new
CheckedException
(
"调用流程服务返回失败"
);
}
ProcessVo
processVo
=
processVoR
.
getData
();
if
(
processVo
==
null
)
{
throw
new
CheckedException
(
"调用流程服务返回数据为空"
);
}
return
processVo
;
}
/**
* 获取crm部门审核人
* @param nodePrimission
* @param departId
* @return List<SysUser>
**/
private
List
<
SysUser
>
getDepartAuditUser
(
TNodePrimission
nodePrimission
,
String
departId
)
{
List
<
SysUser
>
remoteSysUserList
=
new
ArrayList
<>();
if
(
CommonConstants
.
THREE_INT
==
nodePrimission
.
getType
().
intValue
())
{
// 3.指定用户
if
(
Common
.
isEmpty
(
nodePrimission
.
getUser
()))
{
throw
new
CheckedException
(
"未查询当前流程权限对应的用户"
);
}
// 通过用户id查询,查找当前用户
R
<
SysUser
>
simpleUser
=
upmsDaprUtils
.
getSimpleUser
(
nodePrimission
.
getUser
());
if
(
null
!=
simpleUser
&&
null
!=
simpleUser
.
getData
())
{
remoteSysUserList
.
add
(
simpleUser
.
getData
());
}
}
else
if
(
CommonConstants
.
FIVE_INT
==
nodePrimission
.
getType
().
intValue
()){
// 5.指定角色(crm)
if
(
Common
.
isEmpty
(
nodePrimission
.
getApprovalRole
()))
{
throw
new
CheckedException
(
"未查询当前节点配置的审核角色"
);
}
UserApprovalRoleVO
userByApprovalRole
=
new
UserApprovalRoleVO
();
userByApprovalRole
.
setDepartId
(
departId
);
userByApprovalRole
.
setRoleId
(
nodePrimission
.
getApprovalRole
());
R
<
SysUserListVo
>
simpleUserList
=
upmsDaprUtils
.
getUserByRoleIdForCrm
(
userByApprovalRole
);
if
(
null
!=
simpleUserList
&&
null
!=
simpleUserList
.
getData
())
{
remoteSysUserList
=
simpleUserList
.
getData
().
getUserList
();
}
}
return
remoteSysUserList
;
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TAuditNodePro
o
cessServiceImpl.java
→
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TAuditNodeProcessServiceImpl.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePro
o
cess
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodePro
o
cessMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodePro
o
cessService
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProcessMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAuditNodeProcessService
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
...
...
@@ -16,6 +16,6 @@ import org.springframework.stereotype.Service;
*/
@Log4j2
@Service
public
class
TAuditNodePro
ocessServiceImpl
extends
ServiceImpl
<
TAuditNodeProocessMapper
,
TAuditNodeProocess
>
implements
TAuditNodePro
ocessService
{
public
class
TAuditNodePro
cessServiceImpl
extends
ServiceImpl
<
TAuditNodeProcessMapper
,
TAuditNodeProcess
>
implements
TAuditNodePr
ocessService
{
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
View file @
cb057e5e
...
...
@@ -8,9 +8,11 @@ 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.yifu.admin.api.entity.SysUser
;
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.ResultConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException
;
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.OSSUtil
;
...
...
@@ -500,7 +502,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
if
(
entity
==
null
){
return
R
.
failed
(
ResultConstants
.
FAIL_INFO_NO_MODEL
);
}
if
(!
StringUtils
.
equals
(
entity
.
getStatus
(),
CommonConstants
.
ONE_STRING
)){
if
(!
CommonConstants
.
ONE_STRING
.
equals
(
entity
.
getStatus
()
)){
return
R
.
failed
(
"当前记录不为待提交状态"
);
}
String
[]
reasonType
=
{
"1"
,
"2"
};
...
...
@@ -518,12 +520,29 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
if
(
Common
.
isEmpty
(
entity
.
getCreateUserDeptId
())){
return
R
.
failed
(
"申请人所属部门id不能为空"
);
}
// 传流程类型 1不购买商险申请,审核类型 0不购买商险审核
// R<List<SysUser>> auditUserListR = tInsuranceUnpurchaseApplyAuditProcess.commitAuditUserList(id, user, entity.getCreateUserDeptId(), CommonConstants.ONE_STRING, CommonConstants.ZERO_STRING,
// "",entity.getApplyNo(),entity,TInsuranceUnpurchaseApply.class);
// if (auditUserListR == null || auditUserListR.getCode() != CommonConstants.SUCCESS || auditUserListR.getData() == null) {
// throw new CheckedException("获取审批人失败,请联系管理员");
// }
// 传:流程类型 1不购买商险申请;审核类型 0不购买商险审核
R
<
List
<
SysUser
>>
auditUserListR
=
tInsuranceUnpurchaseApplyAuditProcess
.
getAuditUserList
(
id
,
user
,
entity
.
getCreateUserDeptId
(),
CommonConstants
.
ONE_STRING
,
CommonConstants
.
ZERO_STRING
,
""
,
entity
.
getApplyNo
(),
entity
,
TInsuranceUnpurchaseApply
.
class
);
if
(
auditUserListR
==
null
||
auditUserListR
.
getCode
()
!=
CommonConstants
.
SUCCESS
||
auditUserListR
.
getData
()
==
null
)
{
throw
new
CheckedException
(
"获取审批人失败,请联系管理员"
);
}
// 存即将审批人的信息
String
auditUserNameStrs
=
""
;
String
auditUserIdStrs
=
""
;
for
(
SysUser
userInfo
:
auditUserListR
.
getData
()){
auditUserIdStrs
=
auditUserIdStrs
.
concat
(
";"
).
concat
(
userInfo
.
getUserId
());
auditUserNameStrs
=
auditUserNameStrs
.
concat
(
";"
).
concat
(
userInfo
.
getNickname
());
}
if
(
Common
.
isNotNull
(
auditUserNameStrs
)){
auditUserNameStrs
=
auditUserNameStrs
.
substring
(
1
);
}
if
(
Common
.
isNotNull
(
auditUserIdStrs
)){
auditUserIdStrs
=
auditUserIdStrs
.
substring
(
1
);
}
entity
.
setAuditUser
(
auditUserNameStrs
);
entity
.
setAuditUserId
(
auditUserIdStrs
);
entity
.
setStatus
(
CommonConstants
.
TWO_STRING
);
this
.
updateById
(
entity
);
return
R
.
ok
(
null
,
"提交成功"
);
...
...
@@ -532,9 +551,8 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
@Override
@Transactional
public
R
<
String
>
auditAndCommit
(
TInsuranceUnpurchaseApply
insuranceUnpurchaseApply
,
String
approvalResult
,
String
approvalOpinion
,
YifuUser
user
)
{
return
R
.
ok
(
"审核完毕"
);
// return tInsuranceUnpurchaseApplyAuditProcess.auditUserList(insuranceUnpurchaseApply.getId(), approvalResult, approvalOpinion, user, CommonConstants.ZERO_STRING,
// insuranceUnpurchaseApply, insuranceUnpurchaseApply.getCreateUserDeptId());
return
tInsuranceUnpurchaseApplyAuditProcess
.
auditUserList
(
insuranceUnpurchaseApply
.
getId
(),
approvalResult
,
approvalOpinion
,
user
,
CommonConstants
.
ZERO_STRING
,
insuranceUnpurchaseApply
,
insuranceUnpurchaseApply
.
getCreateUserDeptId
());
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/process/TInsuranceUnpurchaseApplyAuditProcess.java
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
.
process
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants
;
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
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpDivisionInfoVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.config.WxConfig
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProcess
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditRecord
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchaseApplyService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.impl.AbastractAuditProcess
;
import
com.yifu.cloud.plus.v1.yifu.process.constant.ProcessConstants
;
import
com.yifu.cloud.plus.v1.yifu.process.entity.TNodePrimission
;
import
com.yifu.cloud.plus.v1.yifu.process.entity.TNodeRoute
;
...
...
@@ -16,15 +25,12 @@ import com.yifu.cloud.plus.v1.yifu.process.entity.TNodeRouteCondition;
import
com.yifu.cloud.plus.v1.yifu.process.entity.TProcessNode
;
import
com.yifu.cloud.plus.v1.yifu.process.util.ProcessAuditUtil
;
import
com.yifu.cloud.plus.v1.yifu.process.vo.ProcessVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodeProocess
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditRecord
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchaseApply
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TInsuranceUnpurchasePerson
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchaseApplyService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchasePersonService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.impl.AbastractAuditProcess
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchaseApplySearchVo
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
...
...
@@ -48,23 +54,26 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
@Resource
private
TInsuranceUnpurchasePersonService
personService
;
@Autowired
private
WxConfig
wxConfig
;
@Override
public
R
<
String
>
auditSuccess
(
TInsuranceUnpurchaseApply
entity
,
TAuditRecord
a
pproval
Record
,
YifuUser
loginUser
)
{
public
R
<
String
>
auditSuccess
(
TInsuranceUnpurchaseApply
entity
,
TAuditRecord
a
udit
Record
,
YifuUser
loginUser
)
{
// 改实体审核状态为审核通过
entity
.
set
AuditFlag
(
CommonConstants
.
THREE_STRING
);
entity
.
set
Status
(
CommonConstants
.
THREE_STRING
);
entity
.
setAuditUser
(
""
);
entity
.
setAuditUserId
(
""
);
boolean
res
=
tInsuranceUnpurchaseApplyService
.
updateById
(
entity
);
if
(
res
)
{
//
todo
删除当前实体所有的流程节点,数据量太大影响审批效率
// 删除当前实体所有的流程节点,数据量太大影响审批效率
// 防止死锁,先查询再删除
TAuditNodePro
ocess
auditNodeProocessInfo
=
auditNodeProocessService
.
getOne
(
Wrappers
.<
TAuditNodePro
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodePro
o
cess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
ocess:
:
getType
,
approval
Record
.
getAuditType
())
TAuditNodePro
cess
auditNodeProcessInfo
=
auditNodeProcessService
.
getOne
(
Wrappers
.<
TAuditNodePr
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
cess:
:
getType
,
audit
Record
.
getAuditType
())
.
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
if
(
Common
.
isNotKong
(
auditNodePro
o
cessInfo
))
{
auditNodePro
ocessService
.
remove
(
Wrappers
.<
TAuditNodeProocess
>
query
().
lambda
().
eq
(
TAuditNodePro
ocess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
ocess:
:
getType
,
approval
Record
.
getAuditType
()));
if
(
Common
.
isNotKong
(
auditNodeProcessInfo
))
{
auditNodePro
cessService
.
remove
(
Wrappers
.<
TAuditNodeProcess
>
query
().
lambda
().
eq
(
TAuditNodePr
ocess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
cess:
:
getType
,
audit
Record
.
getAuditType
()));
}
//huych--更新明细审核状态
...
...
@@ -79,6 +88,24 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
@Override
public
R
<
String
>
auditSuccessAndNex
(
TInsuranceUnpurchaseApply
entity
,
List
<
SysUser
>
remoteSysUserList
,
TAuditRecord
approvalRecord
)
{
if
(
Common
.
isEmpty
(
remoteSysUserList
))
{
throw
new
CheckedException
(
NEXT_NODE_USER_NULL
);
}
// 存即将审批人的信息
String
auditUserNameStrs
=
""
;
String
auditUserIdStrs
=
""
;
for
(
SysUser
userInfo
:
remoteSysUserList
){
auditUserIdStrs
=
auditUserIdStrs
.
concat
(
";"
).
concat
(
userInfo
.
getUserId
());
auditUserNameStrs
=
auditUserNameStrs
.
concat
(
";"
).
concat
(
userInfo
.
getNickname
());
}
if
(
Common
.
isNotNull
(
auditUserNameStrs
)){
auditUserNameStrs
=
auditUserNameStrs
.
substring
(
1
);
}
if
(
Common
.
isNotNull
(
auditUserIdStrs
)){
auditUserIdStrs
=
auditUserIdStrs
.
substring
(
1
);
}
entity
.
setAuditUser
(
auditUserNameStrs
);
entity
.
setAuditUserId
(
auditUserIdStrs
);
return
R
.
ok
(
"审核通过"
);
}
...
...
@@ -86,21 +113,21 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
public
R
<
String
>
auditFail
(
TInsuranceUnpurchaseApply
entity
,
TAuditRecord
approvalRecord
)
{
// 以后有抄送再加逻辑:参照crm-更改之前抄送记录状态为0
// 改实体审核状态为审核不通过
entity
.
set
AuditFlag
(
CommonConstants
.
FOUR_STRING
);
entity
.
set
Status
(
CommonConstants
.
FOUR_STRING
);
entity
.
setAuditUser
(
""
);
entity
.
setAuditUserId
(
""
);
tInsuranceUnpurchaseApplyService
.
updateById
(
entity
);
//
todo
删除当前实体所有的流程节点,数据量太大影响审批效率
// 删除当前实体所有的流程节点,数据量太大影响审批效率
// 防止死锁,先查询再删除
TAuditNodePro
ocess
auditNodeProocessInfo
=
auditNodeProocessService
.
getOne
(
Wrappers
.<
TAuditNodePro
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodePro
o
cess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
o
cess:
:
getType
,
approvalRecord
.
getAuditType
())
TAuditNodePro
cess
auditNodeProocessInfo
=
auditNodeProcessService
.
getOne
(
Wrappers
.<
TAuditNodePr
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodeProcess:
:
getType
,
approvalRecord
.
getAuditType
())
.
last
(
CommonConstants
.
SQL_LIMIT_ONE
));
if
(
Common
.
isNotKong
(
auditNodeProocessInfo
))
{
auditNodePro
ocessService
.
remove
(
Wrappers
.<
TAuditNodePro
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodePro
o
cess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodePro
o
cess:
:
getType
,
approvalRecord
.
getAuditType
()));
auditNodePro
cessService
.
remove
(
Wrappers
.<
TAuditNodePr
ocess
>
query
().
lambda
()
.
eq
(
TAuditNodeProcess:
:
getDomainId
,
entity
.
getId
())
.
in
(
TAuditNodeProcess:
:
getType
,
approvalRecord
.
getAuditType
()));
}
return
R
.
ok
(
"审核成功"
);
...
...
@@ -108,19 +135,23 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
@Override
public
TProcessNode
choiceGetNode
(
ProcessVo
processVo
,
List
<
TNodeRoute
>
nodeRouteList
,
List
<
TNodeRouteCondition
>
nodeRouteConditionList
,
TProcessNode
currentNode
,
TInsuranceUnpurchaseApply
entity
,
String
t
ype
,
YifuUser
loginUser
)
{
TProcessNode
currentNode
,
TInsuranceUnpurchaseApply
entity
,
String
auditT
ype
,
YifuUser
loginUser
)
{
// 根据不购买原因判断 1 已购买社保 2 人员已离职选择
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_INSURANCEUNPURCHASE_REASON_TYPE
,
currentNode
.
getName
())){
// 通过条件表达式判断路由的下一个节点
TNodeRoute
nodeRoute
=
ProcessAuditUtil
.
getTNodeRoteByExpress
(
nodeRouteList
,
nodeRouteConditionList
,
entity
.
getReasonType
(),
null
);
saveNodeProcess
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
type
);
return
validateTwoNextNode
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
nodeRoute
.
getRouteType
(),
type
,
entity
,
loginUser
);
// 存下一个节点的信息
saveNodeProcess
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
auditType
);
// 校验即将进入的节点信息,是审批节点返回节点信息,不是继续找下一个节点信息
return
validateNextNode
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
nodeRoute
.
getRouteType
(),
auditType
,
entity
,
loginUser
);
}
else
if
(
StringUtils
.
equals
(
ProcessConstants
.
PROCESS_NODE_INSURANCEUNPURCHASE_DEPT_PROPERTY
,
currentNode
.
getName
())){
// 根据申请部门 是否属于子分公司
// 通过条件表达式判断路由的下一个节点
TNodeRoute
nodeRoute
=
ProcessAuditUtil
.
getTNodeRoteByExpress
(
nodeRouteList
,
nodeRouteConditionList
,
entity
.
getCompanyFlag
(),
null
);
saveNodeProcess
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
type
);
return
validateTwoNextNode
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
nodeRoute
.
getRouteType
(),
type
,
entity
,
loginUser
);
// 存下一个节点的信息
saveNodeProcess
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
auditType
);
// 校验即将进入的节点信息,是审批节点返回节点信息,不是继续找下一个节点信息
return
validateNextNode
(
processVo
,
nodeRoute
.
getNextNode
(),
entity
.
getId
(),
nodeRoute
.
getRouteType
(),
auditType
,
entity
,
loginUser
);
}
else
{
throw
new
CheckedException
(
"未知的条件节点类型,请联系管理员"
);
}
...
...
@@ -128,7 +159,7 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
@Override
public
R
<
String
>
sendMessage
(
List
<
SysUser
>
users
,
TInsuranceUnpurchaseApply
entity
,
String
type
,
TAuditRecord
approvalRecord
)
{
sendMessageToWx
(
users
,
entity
,
type
,
approvalRecord
);
sendMessageToWx
(
users
,
entity
,
type
);
return
R
.
ok
(
null
,
ResultConstants
.
SUCCESS_INFO
);
}
...
...
@@ -148,87 +179,69 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
throw
new
CheckedException
(
"未查询当前节点配置的事业部审批人标识"
);
}
// todo 根据配置条件查找用户
EkpDivisionInfoVo
divisionInfoVo
=
new
EkpDivisionInfoVo
();
// if(CommonConstants.ZERO_STRING.equals(nodePrimission.getDivisionIdentification())){
//
// }
// remoteSysUserList = RemoteRequestUtil.getUserByDivisionConfig(remoteUserService, advancePaymentEntity.getDivision(), advancePaymentEntity.getDivisionLine(), nodePrimission.getDivisionIdentification());
}
return
remoteSysUserList
;
}
/**
* 功能描述: 企业微信发送通知
* @Param: [users, customerContract, type 发送提示类型 1审批 2抄送]
*/
private
void
sendMessageToWx
(
List
<
SysUser
>
users
,
TInsuranceUnpurchaseApply
insuranceUnpurchaseApply
,
String
type
,
TAuditRecord
approvalRecord
)
{
StringBuilder
sendUser
=
null
;
for
(
SysUser
user
:
users
)
{
if
(
Common
.
isNotKong
(
user
.
getWxMessage
()))
{
if
(
sendUser
==
null
)
{
sendUser
=
new
StringBuilder
(
user
.
getWxMessage
());
}
else
{
sendUser
=
sendUser
.
append
(
"|"
).
append
(
user
.
getWxMessage
());
}
}
}
if
(
sendUser
!=
null
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
Map
<
String
,
Object
>
requestMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
textcard
=
new
HashMap
<>();
private
void
sendMessageToWx
(
List
<
SysUser
>
users
,
TInsuranceUnpurchaseApply
insuranceUnpurchaseApply
,
String
type
)
{
textcard
.
put
(
"title"
,
"含风险项目不购买商险申请"
);
// todo
textcard
.
put
(
"page"
,
"pages/sale/page/businessAuditDetail/businessAuditDetail?businessId="
+
insuranceUnpurchaseApply
.
getId
());
// todo
textcard
.
put
(
"appid"
,
"111"
);
textcard
.
put
(
"emphasis_first_item"
,
false
);
StringBuilder
sendUser
=
null
;
for
(
SysUser
user
:
users
)
{
if
(
Common
.
isNotKong
(
user
.
getWxMessage
()))
{
if
(
sendUser
==
null
)
{
sendUser
=
new
StringBuilder
(
user
.
getWxMessage
());
}
else
{
sendUser
=
sendUser
.
append
(
"|"
).
append
(
user
.
getWxMessage
());
}
}
}
if
(
sendUser
!=
null
)
{
RestTemplate
restTemplate
=
new
RestTemplate
();
Map
<
String
,
Object
>
requestMap
=
new
HashMap
<>();
String
authUrl
=
null
;
Map
<
String
,
Object
>
textcard
=
new
HashMap
<>();
List
<
Map
<
String
,
String
>>
contentItemList
=
new
ArrayList
<>();
Map
<
String
,
String
>
contentItemMap
=
new
HashMap
<>();
contentItemMap
.
put
(
"key"
,
"申请人:"
);
contentItemMap
.
put
(
"value"
,
insuranceUnpurchaseApply
.
getCreateName
().
length
()>
CommonConstants
.
THIRTY_INT
?
insuranceUnpurchaseApply
.
getCreateName
().
substring
(
CommonConstants
.
ZERO_INT
,
CommonConstants
.
TWENTY_SEVEN_INT
)+
"..."
:
insuranceUnpurchaseApply
.
getCreateName
());
contentItemList
.
add
(
contentItemMap
);
contentItemMap
=
new
HashMap
<>();
contentItemMap
.
put
(
"key"
,
"项目编码:"
);
contentItemMap
.
put
(
"value"
,
insuranceUnpurchaseApply
.
getDeptNo
());
contentItemList
.
add
(
contentItemMap
);
authUrl
=
String
.
format
(
SecurityConstants
.
WX_GET_MESSAGE_AUTH_URL
,
wxConfig
.
getCorpid
(),
wxConfig
.
getAuthUrl
(),
CommonConstants
.
SIX_STRING
+
insuranceUnpurchaseApply
.
getId
());
textcard
.
put
(
"title"
,
"含风险项目不购买商险申请"
);
contentItemMap
=
new
HashMap
<>(
);
contentItemMap
.
put
(
"key"
,
"项目名称:"
);
contentItemMap
.
put
(
"value"
,
insuranceUnpurchaseApply
.
getDeptName
().
length
()>
CommonConstants
.
THIRTY_INT
?
insuranceUnpurchaseApply
.
getDeptName
().
substring
(
CommonConstants
.
ZERO_INT
,
CommonConstants
.
TWENTY_SEVEN_INT
)+
"..."
:
insuranceUnpurchaseApply
.
getDeptName
()
);
contentItemList
.
add
(
contentItemMap
);
textcard
.
put
(
"url"
,
authUrl
);
StringBuilder
description
=
new
StringBuilder
(
);
description
.
append
(
"申请人:"
).
append
(
insuranceUnpurchaseApply
.
getCreateName
()).
append
(
"<br>"
);
description
.
append
(
"项目编码:"
).
append
(
insuranceUnpurchaseApply
.
getDeptNo
()).
append
(
"<br>"
);
String
departName
=
insuranceUnpurchaseApply
.
getDeptName
();
if
(
departName
.
length
()>
CommonConstants
.
THIRTY_INT
){
departName
=
insuranceUnpurchaseApply
.
getDeptName
().
substring
(
CommonConstants
.
ZERO_INT
,
CommonConstants
.
TWENTY_SEVEN_INT
)+
"..."
;
}
description
.
append
(
"项目名称:"
).
append
(
departName
).
append
(
"<br>"
);
// 不购买原因 1 已购买社保 2 人员已离职
Map
<
String
,
String
>
reasonTypeMap
=
new
HashMap
<>();
reasonTypeMap
.
put
(
"1"
,
"已购买社保"
);
reasonTypeMap
.
put
(
"2"
,
"人员已离职"
);
contentItemMap
=
new
HashMap
<>();
contentItemMap
.
put
(
"key"
,
"不购买原因:"
);
contentItemMap
.
put
(
"value"
,
reasonTypeMap
.
get
(
insuranceUnpurchaseApply
.
getReasonType
()));
contentItemList
.
add
(
contentItemMap
);
contentItemMap
=
new
HashMap
<>();
contentItemMap
.
put
(
"key"
,
"不购买人数:"
);
contentItemMap
.
put
(
"value"
,
insuranceUnpurchaseApply
.
getUnbuyNum
());
contentItemList
.
add
(
contentItemMap
);
textcard
.
put
(
"content_item"
,
contentItemList
);
requestMap
.
put
(
"touser"
,
sendUser
);
requestMap
.
put
(
"msgtype"
,
"miniprogram_notice"
);
requestMap
.
put
(
"miniprogram_notice"
,
textcard
);
requestMap
.
put
(
"enable_id_trans"
,
0
);
requestMap
.
put
(
"enable_duplicate_check"
,
0
);
requestMap
.
put
(
"duplicate_check_interval"
,
1800
);
// todo 必须加上header说明 等房哥的企微
// if (!wxConfig.sendAppTextCard(restTemplate, requestMap)) {
// wxConfig.sendAppTextCard(restTemplate, requestMap);
// }
}
description
.
append
(
"不购买原因:"
).
append
(
reasonTypeMap
.
get
(
insuranceUnpurchaseApply
.
getReasonType
())).
append
(
"<br>"
);
description
.
append
(
"不购买人数:"
).
append
(
insuranceUnpurchaseApply
.
getUnbuyNum
()).
append
(
"<br>"
);
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-salary/yifu-salary-biz/src/main/resources/application-test.yml
View file @
cb057e5e
...
...
@@ -25,4 +25,10 @@ spring:
idle-timeout
:
60000
# 空闲连接存活最大时间,默认600000(10分钟)
maximum-pool-size
:
12
# 连接池最大连接数,默认是10
auto-commit
:
true
#此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime
:
0
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
\ No newline at end of file
max-lifetime
:
0
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
wx
:
corpid
:
wwbcb090af0dfe50e5
corpsecret
:
16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid
:
1000010
authUrl
:
https://test-worfu.com/yifu-auth/method/oauth/wxLogin
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TAuditNodePro
o
cessMapper.xml
→
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TAuditNodeProcessMapper.xml
View file @
cb057e5e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodePro
o
cessMapper"
>
<mapper
namespace=
"com.yifu.cloud.plus.v1.yifu.salary.mapper.TAuditNodeProcessMapper"
>
<resultMap
id=
"tAuditNodePro
ocessMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePro
ocess"
>
<resultMap
id=
"tAuditNodePro
cessMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TAuditNodePr
ocess"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"processId"
column=
"process_id"
/>
<result
property=
"nodeId"
column=
"node_id"
/>
...
...
@@ -43,61 +43,61 @@
a.add_sign_approval_man,
a.add_sign_approval_man_name
</sql>
<sql
id=
"tAuditNodePro
o
cess_where"
>
<if
test=
"tAuditNodePro
o
cess != null"
>
<if
test=
"tAuditNodePro
ocess.id != null and tAuditNodePro
ocess.id.trim() != ''"
>
AND a.id = #{tAuditNodePro
o
cess.id}
<sql
id=
"tAuditNodeProcess_where"
>
<if
test=
"tAuditNodeProcess != null"
>
<if
test=
"tAuditNodePro
cess.id != null and tAuditNodePr
ocess.id.trim() != ''"
>
AND a.id = #{tAuditNodeProcess.id}
</if>
<if
test=
"tAuditNodePro
ocess.processId != null and tAuditNodePro
ocess.processId.trim() != ''"
>
AND a.process_id = #{tAuditNodePro
o
cess.processId}
<if
test=
"tAuditNodePro
cess.processId != null and tAuditNodePr
ocess.processId.trim() != ''"
>
AND a.process_id = #{tAuditNodeProcess.processId}
</if>
<if
test=
"tAuditNodePro
ocess.nodeId != null and tAuditNodePro
ocess.nodeId.trim() != ''"
>
AND a.node_id = #{tAuditNodePro
o
cess.nodeId}
<if
test=
"tAuditNodePro
cess.nodeId != null and tAuditNodePr
ocess.nodeId.trim() != ''"
>
AND a.node_id = #{tAuditNodeProcess.nodeId}
</if>
<if
test=
"tAuditNodePro
ocess.nodeType != null and tAuditNodePro
ocess.nodeType.trim() != ''"
>
AND a.node_type = #{tAuditNodePro
o
cess.nodeType}
<if
test=
"tAuditNodePro
cess.nodeType != null and tAuditNodePr
ocess.nodeType.trim() != ''"
>
AND a.node_type = #{tAuditNodeProcess.nodeType}
</if>
<if
test=
"tAuditNodePro
o
cess.createTime != null"
>
AND a.create_time = #{tAuditNodePro
o
cess.createTime}
<if
test=
"tAuditNodeProcess.createTime != null"
>
AND a.create_time = #{tAuditNodeProcess.createTime}
</if>
<if
test=
"tAuditNodePro
ocess.domainId != null and tAuditNodePro
ocess.domainId.trim() != ''"
>
AND a.domain_id = #{tAuditNodePro
o
cess.domainId}
<if
test=
"tAuditNodePro
cess.domainId != null and tAuditNodePr
ocess.domainId.trim() != ''"
>
AND a.domain_id = #{tAuditNodeProcess.domainId}
</if>
<if
test=
"tAuditNodePro
ocess.mainType != null and tAuditNodePro
ocess.mainType.trim() != ''"
>
AND a.main_type = #{tAuditNodePro
o
cess.mainType}
<if
test=
"tAuditNodePro
cess.mainType != null and tAuditNodePr
ocess.mainType.trim() != ''"
>
AND a.main_type = #{tAuditNodeProcess.mainType}
</if>
<if
test=
"tAuditNodePro
ocess.logoTitle != null and tAuditNodePro
ocess.logoTitle.trim() != ''"
>
AND a.logo_title = #{tAuditNodePro
o
cess.logoTitle}
<if
test=
"tAuditNodePro
cess.logoTitle != null and tAuditNodePr
ocess.logoTitle.trim() != ''"
>
AND a.logo_title = #{tAuditNodeProcess.logoTitle}
</if>
<if
test=
"tAuditNodePro
ocess.nodeName != null and tAuditNodePro
ocess.nodeName.trim() != ''"
>
AND a.node_name = #{tAuditNodePro
o
cess.nodeName}
<if
test=
"tAuditNodePro
cess.nodeName != null and tAuditNodePr
ocess.nodeName.trim() != ''"
>
AND a.node_name = #{tAuditNodeProcess.nodeName}
</if>
<if
test=
"tAuditNodePro
ocess.processName != null and tAuditNodePro
ocess.processName.trim() != ''"
>
AND a.process_name = #{tAuditNodePro
o
cess.processName}
<if
test=
"tAuditNodePro
cess.processName != null and tAuditNodePr
ocess.processName.trim() != ''"
>
AND a.process_name = #{tAuditNodeProcess.processName}
</if>
<if
test=
"tAuditNodePro
ocess.parentProcessId != null and tAuditNodePro
ocess.parentProcessId.trim() != ''"
>
AND a.parent_process_id = #{tAuditNodePro
o
cess.parentProcessId}
<if
test=
"tAuditNodePro
cess.parentProcessId != null and tAuditNodePr
ocess.parentProcessId.trim() != ''"
>
AND a.parent_process_id = #{tAuditNodeProcess.parentProcessId}
</if>
<if
test=
"tAuditNodePro
ocess.deleteFlag != null and tAuditNodePro
ocess.deleteFlag.trim() != ''"
>
AND a.delete_flag = #{tAuditNodePro
o
cess.deleteFlag}
<if
test=
"tAuditNodePro
cess.deleteFlag != null and tAuditNodePr
ocess.deleteFlag.trim() != ''"
>
AND a.delete_flag = #{tAuditNodeProcess.deleteFlag}
</if>
<if
test=
"tAuditNodePro
ocess.type != null and tAuditNodePro
ocess.type.trim() != ''"
>
AND a.type = #{tAuditNodePro
o
cess.type}
<if
test=
"tAuditNodePro
cess.type != null and tAuditNodePr
ocess.type.trim() != ''"
>
AND a.type = #{tAuditNodeProcess.type}
</if>
<if
test=
"tAuditNodePro
ocess.addSignParentNodeId != null and tAuditNodePro
ocess.addSignParentNodeId.trim() != ''"
>
AND a.add_sign_parent_node_id = #{tAuditNodePro
o
cess.addSignParentNodeId}
<if
test=
"tAuditNodePro
cess.addSignParentNodeId != null and tAuditNodePr
ocess.addSignParentNodeId.trim() != ''"
>
AND a.add_sign_parent_node_id = #{tAuditNodeProcess.addSignParentNodeId}
</if>
<if
test=
"tAuditNodePro
ocess.addSignDepartmentId != null and tAuditNodePro
ocess.addSignDepartmentId.trim() != ''"
>
AND a.add_sign_department_id = #{tAuditNodePro
o
cess.addSignDepartmentId}
<if
test=
"tAuditNodePro
cess.addSignDepartmentId != null and tAuditNodePr
ocess.addSignDepartmentId.trim() != ''"
>
AND a.add_sign_department_id = #{tAuditNodeProcess.addSignDepartmentId}
</if>
<if
test=
"tAuditNodePro
ocess.domainName != null and tAuditNodePro
ocess.domainName.trim() != ''"
>
AND a.domain_name = #{tAuditNodePro
o
cess.domainName}
<if
test=
"tAuditNodePro
cess.domainName != null and tAuditNodePr
ocess.domainName.trim() != ''"
>
AND a.domain_name = #{tAuditNodeProcess.domainName}
</if>
<if
test=
"tAuditNodePro
ocess.addSignApprovalMan != null and tAuditNodePro
ocess.addSignApprovalMan.trim() != ''"
>
AND a.add_sign_approval_man = #{tAuditNodePro
o
cess.addSignApprovalMan}
<if
test=
"tAuditNodePro
cess.addSignApprovalMan != null and tAuditNodePr
ocess.addSignApprovalMan.trim() != ''"
>
AND a.add_sign_approval_man = #{tAuditNodeProcess.addSignApprovalMan}
</if>
<if
test=
"tAuditNodePro
ocess.addSignApprovalManName != null and tAuditNodePro
ocess.addSignApprovalManName.trim() != ''"
>
AND a.add_sign_approval_man_name = #{tAuditNodePro
o
cess.addSignApprovalManName}
<if
test=
"tAuditNodePro
cess.addSignApprovalManName != null and tAuditNodePr
ocess.addSignApprovalManName.trim() != ''"
>
AND a.add_sign_approval_man_name = #{tAuditNodeProcess.addSignApprovalManName}
</if>
</if>
</sql>
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserApprovalRoleVO.java
0 → 100644
View file @
cb057e5e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
api
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author chenyuxi
* @date 2025/01/15
* @since 1.7.5
*/
@Data
public
class
UserApprovalRoleVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
departId
;
private
String
roleId
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/UserController.java
View file @
cb057e5e
...
...
@@ -589,4 +589,31 @@ public class UserController {
public
R
<
String
>
updateUserAndDept
(
HttpServletRequest
request
,
@RequestBody
JSONObject
json
)
{
return
userService
.
updateUserAndDept
(
request
,
json
);
}
/**
* 查询流程配置审批角色对应的审批人
*
* @param userByApprovalRole
* @author chenyuxi
* @date 2025-01-10 17:47:32
* @since 1.7.5
**/
@Inner
@PostMapping
(
"/inner/getUser/getUserByRoleIdForCrm"
)
public
SysUserListVo
getUserByRoleIdForCrm
(
UserApprovalRoleVO
userByApprovalRole
)
{
SysUserListVo
naVo
=
new
SysUserListVo
();
if
(
Common
.
isEmpty
(
userByApprovalRole
.
getDepartId
())
||
Common
.
isEmpty
(
userByApprovalRole
.
getRoleId
()))
{
return
naVo
;
}
List
<
SysUser
>
sysUsers
=
userService
.
getUserByRoleIdForCrm
(
Integer
.
parseInt
(
userByApprovalRole
.
getDepartId
()),
userByApprovalRole
.
getRoleId
());
if
(
Common
.
isEmpty
(
sysUsers
))
{
//如果不存在则取上级所在部门负责人
sysUsers
=
userService
.
getUserManagerByUpDepartIdUp
(
Integer
.
parseInt
(
userByApprovalRole
.
getDepartId
()),
userByApprovalRole
.
getRoleId
());
}
if
(
Common
.
isNotEmpty
(
sysUsers
))
{
naVo
.
setUserList
(
sysUsers
);
}
return
naVo
;
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/mapper/SysUserMapper.java
View file @
cb057e5e
...
...
@@ -77,4 +77,8 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
void
updateUser
(
@Param
(
"list"
)
List
<
Map
<
String
,
Object
>>
list
);
Page
<
BusinessUserVo
>
getBusinessUserVoPage
(
Page
page
,
@Param
(
"query"
)
BusinessUserVo
user
);
List
<
SysUser
>
getUserByRoleIdForCrm
(
@Param
(
"departId"
)
Integer
departId
,
@Param
(
"roleId"
)
String
roleId
);
List
<
SysUser
>
getUserManagerByUpDepartIdUp
(
@Param
(
"departId"
)
Integer
departId
,
@Param
(
"roleId"
)
String
roleId
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/SysUserService.java
View file @
cb057e5e
...
...
@@ -185,4 +185,9 @@ public interface SysUserService extends IService<SysUser> {
* @return R
*/
R
<
String
>
updateUserAndDept
(
HttpServletRequest
request
,
JSONObject
json
);
List
<
SysUser
>
getUserByRoleIdForCrm
(
Integer
departId
,
String
roleId
);
List
<
SysUser
>
getUserManagerByUpDepartIdUp
(
Integer
departId
,
String
roleId
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
cb057e5e
...
...
@@ -942,4 +942,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
}
@Override
public
List
<
SysUser
>
getUserByRoleIdForCrm
(
Integer
departId
,
String
roleId
)
{
return
baseMapper
.
getUserByRoleIdForCrm
(
departId
,
roleId
);
}
@Override
public
List
<
SysUser
>
getUserManagerByUpDepartIdUp
(
Integer
departId
,
String
roleId
)
{
return
baseMapper
.
getUserManagerByUpDepartIdUp
(
departId
,
roleId
);
}
}
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
View file @
cb057e5e
...
...
@@ -342,4 +342,41 @@
</where>
ORDER BY `user`.create_time DESC
</select>
<select
id=
"getUserByRoleIdForCrm"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser"
>
SELECT
*
FROM
sys_user
WHERE
user_id IN (
SELECT
b.user_id
FROM
sys_approval_role a
LEFT JOIN sys_approval_role_user_dept b ON a.role_id = b.approval_role_id
WHERE
b.dept_id = #{departId}
AND approval_role_id = #{roleId}
)
</select>
<select
id=
"getUserManagerByUpDepartIdUp"
resultType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser"
>
SELECT * FROM sys_user WHERE user_id IN(
SELECT
user_id
FROM
sys_approval_role_user_dept
WHERE
dept_id = (
SELECT
ORGAN_PARENT
FROM
sys_organization_info
WHERE
id = #{departId}
)
AND approval_role_id = #{roleId}
)
</select>
</mapper>
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