Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
17164769
Commit
17164769
authored
Apr 17, 2020
by
邓实川
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://120.24.24.239:8082/8timerv2/8timerapiv200.git
into dsc
parents
013380e3
b3f28de6
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
660 additions
and
6 deletions
+660
-6
src/main/java/cn/timer/api/config/swagger/Swagger2Config.java
+7
-2
src/main/java/cn/timer/api/controller/spmk/SpmkServiceImpl.java
+104
-4
src/main/java/cn/timer/api/dto/spmk/Condition.java
+22
-0
src/main/java/cn/timer/api/dto/spmk/Relation.java
+33
-0
src/main/java/cn/timer/api/dto/spmk/Router.java
+51
-0
src/main/java/cn/timer/api/dto/spmk/Spmk.java
+19
-0
src/main/java/cn/timer/api/dto/spmk/User.java
+20
-0
src/main/java/cn/timer/api/utils/RouterUtils.java
+404
-0
No files found.
src/main/java/cn/timer/api/config/swagger/Swagger2Config.java
View file @
17164769
...
@@ -32,8 +32,13 @@ public class Swagger2Config {
...
@@ -32,8 +32,13 @@ public class Swagger2Config {
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
@Bean
@Bean
public
ApiInfo
apiInfo
()
{
public
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
().
title
(
"8小时-Api接口文档"
).
description
(
"快速进行Api接口调试"
).
termsOfServiceUrl
(
"127.0.0.1:8080"
)
return
new
ApiInfoBuilder
()
.
contact
(
"TangZhaoQian"
).
version
(
"1.0"
).
build
();
.
title
(
"8小时-Api接口文档"
)
.
description
(
"快速进行Api接口调试"
)
.
termsOfServiceUrl
(
"127.0.0.1:8080"
)
.
contact
(
"TangZhaoQian"
)
.
version
(
"1.0"
)
.
build
();
}
}
/**
/**
...
...
src/main/java/cn/timer/api/controller/spmk/SpmkServiceImpl.java
View file @
17164769
package
cn
.
timer
.
api
.
controller
.
spmk
;
package
cn
.
timer
.
api
.
controller
.
spmk
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -21,9 +22,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -21,9 +22,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.lang.Console
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.timer.api.bean.spmk.SpmkIcon
;
import
cn.timer.api.bean.spmk.SpmkIcon
;
import
cn.timer.api.bean.spmk.SpmkJqgz
;
import
cn.timer.api.bean.spmk.SpmkJqgz
;
import
cn.timer.api.bean.spmk.SpmkLcjd
;
import
cn.timer.api.bean.spmk.SpmkLcjd
;
...
@@ -33,12 +37,15 @@ import cn.timer.api.bean.spmk.SpmkSpcz;
...
@@ -33,12 +37,15 @@ import cn.timer.api.bean.spmk.SpmkSpcz;
import
cn.timer.api.bean.spmk.SpmkSpgl
;
import
cn.timer.api.bean.spmk.SpmkSpgl
;
import
cn.timer.api.bean.spmk.SpmkSpz
;
import
cn.timer.api.bean.spmk.SpmkSpz
;
import
cn.timer.api.bean.spmk.SpmkSxpz
;
import
cn.timer.api.bean.spmk.SpmkSxpz
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enums.CommonEnum
;
import
cn.timer.api.config.enums.CommonEnum
;
import
cn.timer.api.dao.spmk.SpmkSpglMapper
;
import
cn.timer.api.dao.spmk.SpmkSpglMapper
;
import
cn.timer.api.dao.spmk.SpmkSpzMapper
;
import
cn.timer.api.dao.spmk.SpmkSpzMapper
;
import
cn.timer.api.dto.spmk.SpmkMbKjDto
;
import
cn.timer.api.dto.spmk.SpmkMbKjDto
;
import
cn.timer.api.dto.spmk.Router
;
import
cn.timer.api.dto.spmk.Spmk
;
import
cn.timer.api.dto.spmk.SpmkSpglDto
;
import
cn.timer.api.dto.spmk.SpmkSpglDto
;
import
cn.timer.api.dto.spmk.SpmkSpglMoveDto
;
import
cn.timer.api.dto.spmk.SpmkSpglMoveDto
;
import
cn.timer.api.dto.spmk.SpmkSpglSortDto
;
import
cn.timer.api.dto.spmk.SpmkSpglSortDto
;
...
@@ -47,6 +54,7 @@ import cn.timer.api.dto.spmk.SpmkSpzSortDto;
...
@@ -47,6 +54,7 @@ import cn.timer.api.dto.spmk.SpmkSpzSortDto;
import
cn.timer.api.dto.spmk.SpmkSpzSpglDto
;
import
cn.timer.api.dto.spmk.SpmkSpzSpglDto
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.RouterUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -392,12 +400,104 @@ public class SpmkServiceImpl {
...
@@ -392,12 +400,104 @@ public class SpmkServiceImpl {
Integer
orgCode
=
userBean
.
getOrgCode
();
Integer
orgCode
=
userBean
.
getOrgCode
();
IPage
<
SpmkJqgz
>
sPage
=
SpmkJqgz
.
builder
().
build
().
selectPage
(
p
,
new
QueryWrapper
<
SpmkJqgz
>().
eq
(
"org_code"
,
orgCode
));
IPage
<
SpmkJqgz
>
sPage
=
SpmkJqgz
.
builder
().
build
().
selectPage
(
p
,
new
QueryWrapper
<
SpmkJqgz
>().
eq
(
"org_code"
,
orgCode
));
List
<
SpmkJqgz
>
spmkJqgzs
=
sPage
.
getRecords
();
List
<
SpmkJqgz
>
spmkJqgzs
=
sPage
.
getRecords
();
sPage
.
getCurrent
();
sPage
.
getPages
();
sPage
.
getTotal
();
sPage
.
getSize
();
return
ResultUtil
.
data
(
sPage
,
spmkJqgzs
,
"获取假期规则列表成功"
);
return
ResultUtil
.
data
(
sPage
,
spmkJqgzs
,
"获取假期规则列表成功"
);
}
}
/**
* 流程节点解析
*/
@PostMapping
(
value
=
"/jsonparse"
)
@ApiOperation
(
value
=
"流程节点解析"
,
httpMethod
=
"POST"
,
notes
=
"流程节点解析"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
jsonToObj
(
@RequestBody
Object
jsonObj
){
JSONObject
obj
=
JSONUtil
.
parseObj
(
jsonObj
,
false
,
true
);
Router
Router
=
obj
.
get
(
"router"
,
Router
.
class
);
Console
.
log
(
"obj:"
+
obj
.
toStringPretty
());
Console
.
log
(
"Router:"
+
Router
.
toPrettyString
());
Console
.
log
(
"Router:"
+
Router
.
toJSONString
());
return
ResultUtil
.
success
(
"解析成功!"
);
}
/**
* 流程节点解析
*/
@PostMapping
(
value
=
"/jsonparse_plus"
)
@ApiOperation
(
value
=
"流程节点解析_plus"
,
httpMethod
=
"POST"
,
notes
=
"流程节点解析_plus"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
jsonToObj2
(
@RequestBody
Router
jsonObj
){
Console
.
log
(
"jsonObj:"
+
jsonObj
);
Console
.
log
(
"jsonObj:"
+
jsonObj
.
getChildren
());
return
ResultUtil
.
data
(
jsonObj
,
"解析成功!"
);
}
/**
* 流程节点解析
*/
@PostMapping
(
value
=
"/jsonparse_plusx"
)
@ApiOperation
(
value
=
"流程节点解析_plus"
,
httpMethod
=
"POST"
,
notes
=
"流程节点解析_plus"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
jsonToObj3
(
@RequestBody
Object
jsonObj
){
JSONObject
obj
=
JSONUtil
.
parseObj
(
jsonObj
,
false
,
true
);
obj
.
put
(
"orgCode"
,
4
);
Console
.
log
(
"jsonObj:"
+
obj
.
get
(
"name"
));
Console
.
log
(
"jsonObj:"
+
obj
.
get
(
"id"
));
Console
.
log
(
"jsonObj:"
+
obj
.
get
(
"aaa"
));
return
ResultUtil
.
data
(
jsonObj
,
"解析成功!"
);
}
/**
* 部门id 查询 员工
*/
@PostMapping
(
value
=
"/deptSelectEmp"
)
@ApiOperation
(
value
=
"部门id 查询 员工"
,
httpMethod
=
"POST"
,
notes
=
"流程节点解析_plus"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
selectEmpBydept
(
@RequestParam
Integer
id
){
List
<
YgglMainEmp
>
ygglMainEmp
=
RouterUtils
.
selectOtherlistent
(
4
,
id
);
return
ResultUtil
.
data
(
ygglMainEmp
,
"解析成功!"
);
}
/**
* 流程节点解析123
*/
@PostMapping
(
value
=
"/jsonparse_plus_plus"
)
@ApiOperation
(
value
=
"流程节点解析_plus"
,
httpMethod
=
"POST"
,
notes
=
"流程节点解析_plus"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
jsonToObj123
(
@RequestBody
Spmk
spmk
){
List
<
Router
>
listRouter
=
new
ArrayList
<
Router
>();
listRouter
.
add
(
spmk
.
getRouter
());
return
ResultUtil
.
data
(
RouterUtils
.
NextNode
(
listRouter
,
spmk
.
getData
()),
"解析成功!"
);
}
}
}
src/main/java/cn/timer/api/dto/spmk/Condition.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
java.util.List
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
Condition
{
private
String
key
;
private
String
format
;
private
String
value
;
}
src/main/java/cn/timer/api/dto/spmk/Relation.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
java.util.List
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
Relation
{
/**
* 类型
*/
private
String
type
;
/**
* 名称
*/
private
String
name
;
/**
* 部门ID
*/
private
String
departmentId
;
/**
* 用户
*/
private
List
<
User
>
users
;
}
src/main/java/cn/timer/api/dto/spmk/Router.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
java.util.List
;
import
cn.hutool.json.JSONSupport
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
Router
extends
JSONSupport
{
/**
* 节点类型
* 1.creator-发起
* 2.audit-审批
* 3.copy-抄送
* 4.rules-规则
*/
private
String
className
;
/**
* 执行
*/
private
String
execute
;
/**
* 通过
*/
private
Boolean
flow
;
/**
* 关系
*/
private
List
<
Relation
>
relation
;
/**
* 条件
*/
private
List
<
Condition
>
condition
;
/**
* 下一级
*/
private
List
<
Router
>
children
;
}
src/main/java/cn/timer/api/dto/spmk/Spmk.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
cn.hutool.json.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
Spmk
{
private
Router
router
;
private
JSONObject
data
;
}
src/main/java/cn/timer/api/dto/spmk/User.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
User
{
private
String
name
;
private
String
id
;
private
String
execute
;
}
src/main/java/cn/timer/api/utils/RouterUtils.java
0 → 100644
View file @
17164769
package
cn
.
timer
.
api
.
utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper
;
import
cn.hutool.core.lang.Console
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.timer.api.bean.qyzx.QyzxEmpLogin
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.bean.zcgl.ZcglAssoZcgx
;
import
cn.timer.api.bean.zzgl.ZzglBmgwM
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dao.zzgl.ZzglBmgwMMapper
;
import
cn.timer.api.dto.spmk.Condition
;
import
cn.timer.api.dto.spmk.Relation
;
import
cn.timer.api.dto.spmk.Router
;
import
cn.timer.api.dto.spmk.User
;
/**
* 流程节点工具类
*
* @author Administrator
*
*/
public
class
RouterUtils
{
private
final
static
String
UNEXECUTED
=
"0"
;
private
final
static
String
EXECUTING
=
"1"
;
private
final
static
String
EXECUTED
=
"2"
;
private
final
static
String
CREATOR
=
"creator"
;
private
final
static
String
RULES
=
"rules"
;
private
final
static
String
AUDIT
=
"audit"
;
private
final
static
String
COPY
=
"copy"
;
private
final
static
String
RELATION_TYPE_DEPARTMENT
=
"department"
;
private
final
static
String
RELATION_TYPE_USERS
=
"users"
;
// 执行下一个节点
public
static
List
<
Router
>
NextNode
(
List
<
Router
>
listRouter
,
JSONObject
obj
)
{
Router
router
;
if
(
listRouter
!=
null
&&
listRouter
.
size
()
!=
0
)
{
// 非条件节点
if
(
listRouter
.
size
()
==
1
)
{
router
=
listRouter
.
get
(
0
);
// 0未执行 1执行中 2已执行
switch
(
router
.
getExecute
())
{
case
UNEXECUTED:
switch
(
router
.
getClassName
())
{
case
CREATOR:
Console
.
log
(
"发起人逻辑"
);
router
.
setExecute
(
EXECUTED
);
router
.
setFlow
(
true
);
router
.
getRelation
().
get
(
0
).
setName
(
obj
.
get
(
"name"
,
String
.
class
));
NextNode
(
router
.
getChildren
(),
obj
);
break
;
case
AUDIT:
Console
.
log
(
"审批人逻辑"
);
router
.
setExecute
(
EXECUTING
);
router
.
setFlow
(
true
);
List
<
User
>
listUser
=
router
.
getRelation
().
get
(
0
).
getUsers
();
user:
for
(
int
i
=
0
;
i
<
listUser
.
size
();
i
++)
{
String
execute
=
listUser
.
get
(
i
).
getExecute
();
switch
(
execute
)
{
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
break
user
;
case
EXECUTING:
listUser
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
}
}
break
;
case
COPY:
Console
.
log
(
"抄送人逻辑"
);
router
.
setExecute
(
EXECUTED
);
router
.
setFlow
(
true
);
List
<
Relation
>
listRelations
=
router
.
getRelation
();
for
(
int
i
=
0
;
i
<
listRelations
.
size
();
i
++)
{
// 装配 部门人员
if
(
RELATION_TYPE_DEPARTMENT
.
equals
(
listRelations
.
get
(
i
).
getType
()))
{
List
<
YgglMainEmp
>
listYgglMainEmp
=
selectOtherlistent
(
obj
.
get
(
"orgCode"
,
Integer
.
class
),
Integer
.
valueOf
(
listRelations
.
get
(
i
).
getDepartmentId
()));
List
<
User
>
listUsers
=
new
ArrayList
<
User
>();
for
(
YgglMainEmp
emp
:
listYgglMainEmp
)
{
User
user
=
new
User
();
user
.
setName
(
emp
.
getName
());
user
.
setId
(
String
.
valueOf
(
emp
.
getEmpNum
()));
listUsers
.
add
(
user
);
}
}
else
if
(
RELATION_TYPE_USERS
.
equals
(
listRelations
.
get
(
i
).
getType
()))
{
}
}
NextNode
(
router
.
getChildren
(),
obj
);
break
;
default
:
break
;
}
break
;
case
EXECUTING:
switch
(
router
.
getClassName
())
{
case
AUDIT:
Console
.
log
(
"下一个审批人逻辑"
);
router
.
setFlow
(
true
);
boolean
executeFlog
=
true
;
List
<
User
>
listUser
=
router
.
getRelation
().
get
(
0
).
getUsers
();
user:
for
(
int
i
=
0
;
i
<
listUser
.
size
();
i
++)
{
String
execute
=
listUser
.
get
(
i
).
getExecute
();
switch
(
execute
)
{
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
if
(!
EXECUTED
.
equals
(
listUser
.
get
(
i
).
getExecute
()))
{
executeFlog
=
false
;
}
break
user
;
case
EXECUTING:
listUser
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
}
}
if
(
executeFlog
)
{
router
.
setExecute
(
EXECUTED
);
}
NextNode
(
router
.
getChildren
(),
obj
);
break
;
default
:
break
;
}
break
;
case
EXECUTED:
Console
.
log
(
"下一个节点"
);
NextNode
(
router
.
getChildren
(),
obj
);
break
;
}
}
else
{
// 条件节点
rulefor:
for
(
Router
routerRule
:
listRouter
)
{
switch
(
routerRule
.
getExecute
())
{
case
UNEXECUTED:
boolean
condition_b
=
true
;
List
<
Condition
>
listCondition
=
routerRule
.
getCondition
();
if
(
listCondition
==
null
||
listCondition
.
size
()
==
0
)
{
routerRule
.
setFlow
(
true
);
}
else
{
for
(
Condition
condition
:
listCondition
)
{
// 判断条件
if
(!
stringCompare
(
obj
.
get
(
condition
.
getKey
(),
String
.
class
),
condition
.
getValue
(),
condition
.
getFormat
()))
{
condition_b
=
false
;
}
}
}
routerRule
.
setFlow
(
condition_b
);
routerRule
.
setExecute
(
EXECUTED
);
if
(
routerRule
.
getFlow
()
==
true
)
{
Console
.
log
(
"条件逻辑"
);
NextNode
(
routerRule
.
getChildren
(),
obj
);
}
break
;
case
EXECUTED:
NextNode
(
routerRule
.
getChildren
(),
obj
);
break
rulefor
;
}
}
Console
.
log
(
"特殊情况!"
);
}
}
return
listRouter
;
};
// 执行下一个节点
public
static
List
<
Router
>
NextNodeing
(
List
<
Router
>
listRouter
,
JSONObject
obj
)
{
Router
router
;
if
(
listRouter
!=
null
&&
listRouter
.
size
()
!=
0
)
{
// 非条件节点
if
(
listRouter
.
size
()
==
1
)
{
router
=
listRouter
.
get
(
0
);
// 0未执行 1执行中 2已执行
switch
(
router
.
getExecute
())
{
case
UNEXECUTED:
switch
(
router
.
getClassName
())
{
case
CREATOR:
Console
.
log
(
"发起人逻辑"
);
router
.
setExecute
(
EXECUTED
);
router
.
setFlow
(
true
);
router
.
getRelation
().
get
(
0
).
setName
(
obj
.
get
(
"name"
,
String
.
class
));
NextNode
(
router
.
getChildren
(),
obj
);
break
;
case
AUDIT:
Console
.
log
(
"审批人逻辑"
);
router
.
setExecute
(
EXECUTING
);
router
.
setFlow
(
true
);
List
<
User
>
listUser
=
router
.
getRelation
().
get
(
0
).
getUsers
();
user:
for
(
int
i
=
0
;
i
<
listUser
.
size
();
i
++)
{
String
execute
=
listUser
.
get
(
i
).
getExecute
();
switch
(
execute
)
{
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
break
user
;
case
EXECUTING:
listUser
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
}
}
break
;
case
COPY:
Console
.
log
(
"抄送人逻辑"
);
router
.
setExecute
(
EXECUTED
);
router
.
setFlow
(
true
);
List
<
Relation
>
listRelations
=
router
.
getRelation
();
for
(
int
i
=
0
;
i
<
listRelations
.
size
();
i
++)
{
// 装配 部门人员
if
(
RELATION_TYPE_DEPARTMENT
.
equals
(
listRelations
.
get
(
i
).
getType
()))
{
List
<
YgglMainEmp
>
listYgglMainEmp
=
selectOtherlistent
(
obj
.
get
(
"orgCode"
,
Integer
.
class
),
Integer
.
valueOf
(
listRelations
.
get
(
i
).
getDepartmentId
()));
List
<
User
>
listUsers
=
new
ArrayList
<
User
>();
for
(
YgglMainEmp
emp
:
listYgglMainEmp
)
{
User
user
=
new
User
();
user
.
setName
(
emp
.
getName
());
user
.
setId
(
String
.
valueOf
(
emp
.
getEmpNum
()));
listUsers
.
add
(
user
);
}
}
else
if
(
RELATION_TYPE_USERS
.
equals
(
listRelations
.
get
(
i
).
getType
()))
{
}
}
NextNode
(
router
.
getChildren
(),
obj
);
break
;
default
:
break
;
}
break
;
case
EXECUTING:
switch
(
router
.
getClassName
())
{
case
AUDIT:
Console
.
log
(
"下一个审批人逻辑"
);
router
.
setFlow
(
true
);
boolean
executeFlog
=
true
;
List
<
User
>
listUser
=
router
.
getRelation
().
get
(
0
).
getUsers
();
user:
for
(
int
i
=
0
;
i
<
listUser
.
size
();
i
++)
{
String
execute
=
listUser
.
get
(
i
).
getExecute
();
switch
(
execute
)
{
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
break
user
;
case
EXECUTING:
listUser
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
}
if
(!
EXECUTED
.
equals
(
listUser
.
get
(
i
).
getExecute
()))
{
executeFlog
=
false
;
}
}
if
(
executeFlog
)
{
router
.
setExecute
(
EXECUTED
);
}
NextNode
(
router
.
getChildren
(),
obj
);
break
;
default
:
break
;
}
break
;
case
EXECUTED:
Console
.
log
(
"下一个节点"
);
NextNode
(
router
.
getChildren
(),
obj
);
break
;
}
}
else
{
// 条件节点
rulefor:
for
(
Router
routerRule
:
listRouter
)
{
switch
(
routerRule
.
getExecute
())
{
case
UNEXECUTED:
boolean
condition_b
=
true
;
List
<
Condition
>
listCondition
=
routerRule
.
getCondition
();
if
(
listCondition
==
null
||
listCondition
.
size
()
==
0
)
{
routerRule
.
setFlow
(
true
);
}
else
{
for
(
Condition
condition
:
listCondition
)
{
// 判断条件
if
(!
stringCompare
(
obj
.
get
(
condition
.
getKey
(),
String
.
class
),
condition
.
getValue
(),
condition
.
getFormat
()))
{
condition_b
=
false
;
}
}
}
routerRule
.
setFlow
(
condition_b
);
routerRule
.
setExecute
(
EXECUTED
);
if
(
routerRule
.
getFlow
()
==
true
)
{
Console
.
log
(
"条件逻辑"
);
NextNode
(
routerRule
.
getChildren
(),
obj
);
}
break
;
case
EXECUTED:
NextNode
(
routerRule
.
getChildren
(),
obj
);
break
rulefor
;
}
}
Console
.
log
(
"特殊情况!"
);
}
}
return
listRouter
;
};
public
static
List
<
YgglMainEmp
>
selectOtherlistent
(
Integer
orgCode
,
Integer
id
){
ArrayList
<
Integer
>
list
=
new
ArrayList
<
Integer
>();
QueryWrapper
<
ZzglBmgwM
>
queryWrapper
=
new
QueryWrapper
<
ZzglBmgwM
>();
queryWrapper
.
eq
(
"org_code"
,
orgCode
);
List
<
ZzglBmgwM
>
zzglBmgwMs
=
ZzglBmgwM
.
builder
().
build
().
selectList
(
queryWrapper
);
list
.
add
(
id
);
ZzglBmgwM
.
getDepts
(
list
,
id
,
zzglBmgwMs
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
null
;
}
else
{
LambdaQueryWrapper
<
YgglMainEmp
>
ygglMainEmpsLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
ygglMainEmpsLambdaQueryWrapper
.
select
(
YgglMainEmp:
:
getId
,
YgglMainEmp:
:
getEmpNum
,
YgglMainEmp:
:
getName
,
YgglMainEmp:
:
getPhone
,
YgglMainEmp:
:
getBmgwId
)
.
eq
(
YgglMainEmp:
:
getOrgCode
,
orgCode
).
and
(
i
->
i
.
in
(
YgglMainEmp:
:
getBmgwId
,
list
.
toArray
()));
List
<
YgglMainEmp
>
ygglMainEmps
=
YgglMainEmp
.
builder
().
build
().
selectList
(
ygglMainEmpsLambdaQueryWrapper
);
return
ygglMainEmps
;
}
}
private
static
boolean
stringCompare
(
String
s1
,
String
s2
,
String
symbol
)
{
double
d1
;
double
d2
;
switch
(
symbol
)
{
case
"<"
:
d1
=
Double
.
parseDouble
(
s1
);
d2
=
Double
.
parseDouble
(
s2
);
if
(
NumberUtil
.
compare
(
d1
,
d2
)
==
-
1
)
return
true
;
break
;
case
"<="
:
d1
=
Double
.
parseDouble
(
s1
);
d2
=
Double
.
parseDouble
(
s2
);
if
(
NumberUtil
.
compare
(
d1
,
d2
)
==
-
1
||
NumberUtil
.
compare
(
d1
,
d2
)
==
0
)
return
true
;
break
;
case
"="
:
if
(
s2
.
equals
(
s1
))
return
true
;
break
;
case
">"
:
d1
=
Double
.
parseDouble
(
s1
);
d2
=
Double
.
parseDouble
(
s2
);
if
(
NumberUtil
.
compare
(
d1
,
d2
)
==
1
)
return
true
;
break
;
case
">="
:
d1
=
Double
.
parseDouble
(
s1
);
d2
=
Double
.
parseDouble
(
s2
);
if
(
NumberUtil
.
compare
(
d1
,
d2
)
==
0
||
NumberUtil
.
compare
(
d1
,
d2
)
==
1
)
return
true
;
break
;
}
return
false
;
};
}
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