Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
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
邬友楠
test
Commits
2a80034c
Commit
2a80034c
authored
Apr 22, 2021
by
李驰骋
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/1.2.x' into 1.2.x
parents
400b0c01
e90ee7f7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
37 deletions
+125
-37
UserTaskConverter.java
...om/huigou/explorer/converters/bpmn/UserTaskConverter.java
+5
-1
AbstractAttachmentSecretInfoResolver.java
...pplication/impl/AbstractAttachmentSecretInfoResolver.java
+38
-16
TestAttachmentSecretInfoResolver.java
...nt/application/impl/TestAttachmentSecretInfoResolver.java
+1
-1
CommonController.java
...rc/main/java/com/huigou/uasp/client/CommonController.java
+65
-9
UaspRequestMappingHandlerMapping.java
...uasp/handlerMapping/UaspRequestMappingHandlerMapping.java
+11
-5
bpm.xml
huigou-uasp/src/main/resources/config/uasp/query/bmp/bpm.xml
+1
-1
pom.xml
huigou-xt/pom.xml
+2
-2
pom.xml
pom.xml
+2
-2
No files found.
huigou-explorer/src/main/java/com/huigou/explorer/converters/bpmn/UserTaskConverter.java
View file @
2a80034c
...
...
@@ -23,7 +23,11 @@ public class UserTaskConverter extends AbstractElementConverter implements Eleme
public
final
static
String
CUSTOM_PROPERTY_PREVIEW_HANDLER
=
"previewHandler"
;
public
final
static
String
CUSTOM_PROPERTY_ASSISTANT_MUST_APPROVE
=
"assistantMustApprove"
;
public
final
static
String
CUSTOM_PROPERTY_MERGE_HANDLER_KIND
=
"mergeHandlerKind"
;
public
final
static
List
<
String
>
CUSTOM_PROPERTIES
=
Arrays
.
asList
(
CUSTOM_PROPERTY_NEED_TIMING
,
CUSTOM_PROPERTY_LIMIT_TIME
,
CUSTOM_PROPERTY_PREVIEW_HANDLER
,
CUSTOM_PROPERTY_ASSISTANT_MUST_APPROVE
,
CUSTOM_PROPERTY_MERGE_HANDLER_KIND
);
/**
* 用户任务描述表达式
*/
public
final
static
String
CUSTOM_PROPERTY_USER_TASK_DESCRIPTION_EXPRESSION
=
"descriptionExpression"
;
public
final
static
List
<
String
>
CUSTOM_PROPERTIES
=
Arrays
.
asList
(
CUSTOM_PROPERTY_NEED_TIMING
,
CUSTOM_PROPERTY_LIMIT_TIME
,
CUSTOM_PROPERTY_PREVIEW_HANDLER
,
CUSTOM_PROPERTY_ASSISTANT_MUST_APPROVE
,
CUSTOM_PROPERTY_MERGE_HANDLER_KIND
,
CUSTOM_PROPERTY_USER_TASK_DESCRIPTION_EXPRESSION
);
public
UserTaskConverter
()
{
super
(
Collections
.
singletonList
(
Shape
.
USER_TASK
));
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/doc/attachment/application/impl/AbstractAttachmentSecretInfoResolver.java
View file @
2a80034c
...
...
@@ -21,6 +21,14 @@ public abstract class AbstractAttachmentSecretInfoResolver implements Attachment
private
AttachmentConfigurationRepository
attachmentConfigurationRepository
;
private
OrgApplication
orgApplication
;
private
SecrecyLevelComparator
secrecyLevelComparator
;
/**
* 默认开启密级检查
*/
private
boolean
defaultEnableSecret
;
public
void
setDefaultEnableSecret
(
boolean
defaultEnableSecret
)
{
this
.
defaultEnableSecret
=
defaultEnableSecret
;
}
@Autowired
public
void
setAttachmentConfigurationRepository
(
AttachmentConfigurationRepository
attachmentConfigurationRepository
)
{
...
...
@@ -40,25 +48,39 @@ public abstract class AbstractAttachmentSecretInfoResolver implements Attachment
@Override
public
String
resolve
(
FileInfo
fileInfo
)
{
AttachmentConfiguration
attachmentConfiguration
=
attachmentConfigurationRepository
.
findByCode
(
fileInfo
.
getBizCode
());
if
(
attachmentConfiguration
==
null
)
{
if
(
attachmentConfiguration
==
null
&&
!
defaultEnableSecret
)
{
return
null
;
}
if
(!
Objects
.
equals
(
attachmentConfiguration
.
getEnableSecret
(),
1
))
{
// 未启用密级
return
null
;
if
(
enableSecret
(
attachmentConfiguration
))
{
// 1、解析附件密级
String
attachmentSecurityLevel
=
resolveAttachmentSecurityLevel
(
fileInfo
);
// 2、校验附件密级是否与人员密级匹配
Person
person
=
orgApplication
.
loadPerson
(
ThreadLocalUtil
.
getOperator
().
getUserId
());
boolean
personSecurityGradeGreaterThanAttachmentSecurityGrade
=
secrecyLevelComparator
.
compare
(
person
.
getPersonSecurityGrade
(),
attachmentSecurityLevel
)
>
-
1
;
Assert
.
isTrue
(
personSecurityGradeGreaterThanAttachmentSecurityGrade
,
"附件密级与人员密级不匹配"
);
// 3、校验附件密级是否与表单密级匹配
Assert
.
hasText
(
fileInfo
.
getFormSecretLevel
(),
"表单密级不能为空"
);
boolean
formSecurityGradeThanAttachmentSecurityGrade
=
secrecyLevelComparator
.
compare
(
fileInfo
.
getFormSecretLevel
(),
attachmentSecurityLevel
)
>
-
1
;
Assert
.
isTrue
(
formSecurityGradeThanAttachmentSecurityGrade
,
"附件密级与表单密级不匹配"
);
// 4、返回附件密级
return
attachmentSecurityLevel
;
}
// 未启用密级
return
null
;
}
private
boolean
enableSecret
(
AttachmentConfiguration
attachmentConfiguration
)
{
boolean
enableSecret
;
if
(
attachmentConfiguration
==
null
)
{
enableSecret
=
defaultEnableSecret
;
}
else
{
if
(
attachmentConfiguration
.
getEnableSecret
()
==
null
)
{
enableSecret
=
defaultEnableSecret
;
}
else
{
enableSecret
=
Objects
.
equals
(
attachmentConfiguration
.
getEnableSecret
(),
1
);
}
}
// 1、解析附件密级
String
attachmentSecurityLevel
=
resolveAttachmentSecurityLevel
(
fileInfo
);
// 2、校验附件密级是否与人员密级匹配
Person
person
=
orgApplication
.
loadPerson
(
ThreadLocalUtil
.
getOperator
().
getUserId
());
boolean
personSecurityGradeGreaterThanAttachmentSecurityGrade
=
secrecyLevelComparator
.
compare
(
person
.
getPersonSecurityGrade
(),
attachmentSecurityLevel
)
>
-
1
;
Assert
.
isTrue
(
personSecurityGradeGreaterThanAttachmentSecurityGrade
,
"附件密级与人员密级不匹配"
);
// 3、校验附件密级是否与表单密级匹配
Assert
.
hasText
(
fileInfo
.
getFormSecretLevel
(),
"表单密级不能为空"
);
boolean
formSecurityGradeThanAttachmentSecurityGrade
=
secrecyLevelComparator
.
compare
(
fileInfo
.
getFormSecretLevel
(),
attachmentSecurityLevel
)
>
-
1
;
Assert
.
isTrue
(
formSecurityGradeThanAttachmentSecurityGrade
,
"附件密级与表单密级不匹配"
);
// 4、返回附件密级
return
attachmentSecurityLevel
;
return
enableSecret
;
}
/**
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/doc/attachment/application/impl/TestAttachmentSecretInfoResolver.java
View file @
2a80034c
...
...
@@ -34,7 +34,7 @@ public class TestAttachmentSecretInfoResolver extends AbstractAttachmentSecretIn
@Override
protected
String
resolveAttachmentSecurityLevel
(
FileInfo
fileInfo
)
{
Matcher
matcher
=
FILE_NAME_PATTERN
.
matcher
(
fileInfo
.
getName
());
Assert
.
isTrue
(
matcher
.
matches
(),
"附件名不合法"
);
Assert
.
isTrue
(
matcher
.
matches
(),
"附件名不合法
,合法的附件名为:【密级】文件名,如:【非密】报销单.pdf
"
);
String
attachmentSecurityGradeName
=
matcher
.
group
(
1
);
Assert
.
hasText
(
attachmentSecurityGradeName
,
"附件名中未包含附件密级信息"
);
DictionaryDesc
attachmentSecurityGrade
=
SystemCache
.
getDictionary
(
securityGradeDictionaryCode
).
values
()
...
...
huigou-uasp/src/main/java/com/huigou/uasp/client/CommonController.java
View file @
2a80034c
package
com
.
huigou
.
uasp
.
client
;
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collection
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.Entity
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -243,7 +241,7 @@ public class CommonController extends ControllerBase {
}
protected
String
blank
(
Status
status
,
String
message
,
Object
data
)
{
Map
<
String
,
Object
>
object
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
object
=
new
HashMap
<>();
object
.
put
(
"status"
,
status
.
ordinal
());
// 状态
if
(!
StringUtil
.
isBlank
(
message
))
{
object
.
put
(
"message"
,
message
);
// 信息
...
...
@@ -251,21 +249,79 @@ public class CommonController extends ControllerBase {
if
(
data
!=
null
)
{
// 数据
if
(
data
instanceof
Page
<?>)
{
Page
<?>
page
=
(
Page
<?>)
data
;
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>(
3
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
3
);
List
<?>
rows
=
page
.
getContent
().
stream
()
.
map
(
this
::
bindDictionaryTextView
)
.
collect
(
Collectors
.
toList
());
result
.
put
(
Constants
.
RECORD
,
page
.
getTotalElements
());
result
.
put
(
Constants
.
ROWS
,
page
.
getContent
()
);
result
.
put
(
Constants
.
ROWS
,
rows
);
object
.
put
(
Constants
.
DATA
,
result
);
}
else
if
(
data
instanceof
SDO
)
{
object
.
put
(
Constants
.
DATA
,
((
SDO
)
data
).
getProperties
());
}
else
if
(
ClassHelper
.
isBaseType
(
data
.
getClass
()))
{
object
.
put
(
Constants
.
DATA
,
data
.
toString
());
}
else
{
if
(
data
instanceof
Collection
)
{
data
=
((
Collection
)
data
).
stream
()
.
map
(
this
::
bindDictionaryTextView
)
.
collect
(
Collectors
.
toList
());
}
else
if
(
data
instanceof
Map
)
{
List
<?>
rows
=
(
List
<?>)
((
Map
)
data
).
get
(
Constants
.
ROWS
);
if
(
rows
!=
null
)
{
rows
=
rows
.
stream
().
map
(
this
::
bindDictionaryTextView
).
collect
(
Collectors
.
toList
());
((
Map
)
data
).
put
(
Constants
.
ROWS
,
rows
);
}
}
else
{
data
=
bindDictionaryTextView
(
data
);
}
object
.
put
(
Constants
.
DATA
,
data
);
}
}
return
blank
(
JSONUtil
.
toString
(
object
));
}
/**
* 绑定字典的name。
* 只会对jpa实体类的被 @Dictionary 注解标记了的字段进行处理。
*
* @return 处理之后的结果。
*/
private
Object
bindDictionaryTextView
(
Object
item
)
{
if
(
item
==
null
)
{
return
null
;
}
Entity
entityAnnotation
=
item
.
getClass
().
getAnnotation
(
Entity
.
class
);
if
(
entityAnnotation
==
null
)
{
return
item
;
}
Map
<
String
,
Object
>
map
=
ClassHelper
.
beanToMap
(
item
);
Map
<
String
,
String
>
textViews
=
Arrays
.
stream
(
item
.
getClass
().
getDeclaredFields
())
.
filter
(
f
->
f
.
getAnnotation
(
com
.
topsunit
.
query
.
annotations
.
Dictionary
.
class
)
!=
null
)
.
collect
(
Collectors
.
toMap
(
f
->
String
.
join
(
""
,
f
.
getName
(),
"TextView"
),
f
->
mapToTextView
(
item
,
f
)));
map
.
putAll
(
textViews
);
return
map
;
}
private
String
mapToTextView
(
Object
entity
,
Field
field
)
{
com
.
topsunit
.
query
.
annotations
.
Dictionary
dictionaryAnnotation
=
field
.
getAnnotation
(
com
.
topsunit
.
query
.
annotations
.
Dictionary
.
class
);
Object
codeValue
=
null
;
try
{
field
.
setAccessible
(
true
);
codeValue
=
field
.
get
(
entity
);
}
catch
(
Exception
e
)
{
}
if
(
codeValue
==
null
)
{
return
""
;
}
String
textView
=
SystemCache
.
getDictionaryDetailText
(
dictionaryAnnotation
.
value
(),
codeValue
);
// 如果textView为null,这里不能直接返回null值,不然Stream在合并的时候会报空指针异常
return
textView
!=
null
?
textView
:
String
.
valueOf
(
codeValue
);
}
protected
String
success
()
{
return
blank
(
Status
.
SUCCESS_TIPS
,
null
,
"ok"
);
}
...
...
huigou-uasp/src/main/java/com/huigou/uasp/handlerMapping/UaspRequestMappingHandlerMapping.java
View file @
2a80034c
...
...
@@ -14,9 +14,9 @@ import com.huigou.uasp.annotation.ControllerMethodMapping;
/**
* spring mvc 请求路径响应Mapping
*
*
* @author xx
*
替换spring mvc 原有注解扫描功能,在Controller类上使用注解ControllerMapping后自动将类中方法加入到RequestMapping
* 替换spring mvc 原有注解扫描功能,在Controller类上使用注解ControllerMapping后自动将类中方法加入到RequestMapping
*/
public
class
UaspRequestMappingHandlerMapping
extends
RequestMappingHandlerMapping
{
...
...
@@ -25,6 +25,12 @@ public class UaspRequestMappingHandlerMapping extends RequestMappingHandlerMappi
@Override
protected
RequestMappingInfo
getMappingForMethod
(
Method
method
,
Class
<?>
handlerType
)
{
RequestMappingInfo
info
=
null
;
if
(
AnnotationUtils
.
findAnnotation
(
handlerType
,
ControllerMapping
.
class
)
==
null
)
{
info
=
super
.
getMappingForMethod
(
method
,
handlerType
);
if
(
info
!=
null
)
{
return
info
;
}
}
RequestMapping
methodAnnotation
=
AnnotationUtils
.
findAnnotation
(
method
,
RequestMapping
.
class
);
if
(
methodAnnotation
!=
null
)
{
RequestCondition
<?>
methodCondition
=
getCustomMethodCondition
(
method
);
...
...
@@ -68,7 +74,7 @@ public class UaspRequestMappingHandlerMapping extends RequestMappingHandlerMappi
protected
RequestMappingInfo
createRequestMappingInfo
(
ControllerMapping
controllerMapping
,
Class
<?>
handlerType
)
{
String
[]
patterns
=
resolveEmbeddedValuesInPatterns
(
controllerMapping
.
value
());
if
(
patterns
!=
null
&&
(
patterns
.
length
==
0
))
{
patterns
=
new
String
[]
{
this
.
initLower
(
handlerType
.
getSimpleName
())
};
patterns
=
new
String
[]
{
this
.
initLower
(
handlerType
.
getSimpleName
())
};
}
RequestCondition
<?>
customCondition
=
getCustomTypeCondition
(
handlerType
);
return
RequestMappingInfo
.
paths
(
patterns
).
customCondition
(
customCondition
).
options
(
this
.
config
).
build
();
...
...
@@ -77,14 +83,14 @@ public class UaspRequestMappingHandlerMapping extends RequestMappingHandlerMappi
protected
RequestMappingInfo
createRequestMappingInfo
(
ControllerMethodMapping
controllerMethodMapping
,
Method
method
)
{
String
[]
patterns
=
resolveEmbeddedValuesInPatterns
(
controllerMethodMapping
.
value
());
if
(
patterns
!=
null
&&
(
patterns
.
length
==
0
))
{
patterns
=
new
String
[]
{
method
.
getName
()
};
patterns
=
new
String
[]
{
method
.
getName
()
};
}
RequestCondition
<?>
methodCondition
=
getCustomMethodCondition
(
method
);
return
RequestMappingInfo
.
paths
(
patterns
).
methods
(
controllerMethodMapping
.
method
()).
customCondition
(
methodCondition
).
options
(
this
.
config
).
build
();
}
protected
RequestMappingInfo
createRequestMappingInfo
(
Method
method
)
{
String
[]
patterns
=
new
String
[]
{
method
.
getName
()
};
String
[]
patterns
=
new
String
[]
{
method
.
getName
()
};
RequestCondition
<?>
methodCondition
=
getCustomMethodCondition
(
method
);
return
RequestMappingInfo
.
paths
(
patterns
).
customCondition
(
methodCondition
).
options
(
this
.
config
).
build
();
}
...
...
huigou-uasp/src/main/resources/config/uasp/query/bmp/bpm.xml
View file @
2a80034c
...
...
@@ -391,7 +391,7 @@
te.creator_person_member_id_ creator_person_member_id,
te.creator_person_member_name_ creator_person_member_name,
te.start_time_ start_time, te.executor_url_ executor_url,
p.business_key_ biz_id, p.proc_sys_name
p.business_key_ biz_id, p.proc_sys_name
, p.proc_name
from act_hi_taskinst_extension te, v_act_hi_procinst p
where te.proc_inst_id_ = p.proc_inst_id_
and te.task_def_key_ = 'Apply'
...
...
huigou-xt/pom.xml
View file @
2a80034c
...
...
@@ -112,11 +112,11 @@
<artifactId>
huigou-explorer
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<!--
<dependency>
<groupId>com.huigou</groupId>
<artifactId>huigou-bpm</artifactId>
<version>${project.version}</version>
</dependency>
</dependency>
-->
<dependency>
<groupId>
com.huigou
</groupId>
<artifactId>
huigou-rule
</artifactId>
...
...
pom.xml
View file @
2a80034c
...
...
@@ -22,8 +22,8 @@
<module>
huigou-demo
</module>
<module>
huigou-xt
</module>
<module>
query-spring
</module>
<module>
huigou-form
</module
>
<module>
huigou-bpm
</module
>
<!-- <module>huigou-form</module>--
>
<!-- <module>huigou-bpm</module>--
>
<module>
huigou-webservice
</module>
<module>
huigou-rule
</module>
</modules>
...
...
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