Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
Nse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
Nse
Commits
2b0c5343
Commit
2b0c5343
authored
Aug 19, 2025
by
wuchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新版本
parent
79bea19a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
28 个修改的文件
包含
2081 行增加
和
0 行删除
+2081
-0
src/main/java/com/chenyang/nse/bussiness/controller/core/AuditLogController.java
+198
-0
src/main/java/com/chenyang/nse/bussiness/controller/core/BatchManageController.java
+85
-0
src/main/java/com/chenyang/nse/bussiness/controller/core/BlobMaskingTaskController.java
+0
-0
src/main/java/com/chenyang/nse/bussiness/controller/core/config/BaseConfigController.java
+192
-0
src/main/java/com/chenyang/nse/bussiness/controller/restfulapi/tools/AuthorizationTool.java
+129
-0
src/main/java/com/chenyang/nse/bussiness/controller/restfulapi/tools/Base64Tool.java
+47
-0
src/main/java/com/chenyang/nse/bussiness/dao/BaseDao.java
+218
-0
src/main/java/com/chenyang/nse/bussiness/dao/BaseDao222.java
+115
-0
src/main/java/com/chenyang/nse/bussiness/dao/table/core/batchmanage/BatchManageDao.java
+9
-0
src/main/java/com/chenyang/nse/bussiness/dao/table/core/rule/conditions/ApplicationConditionsDao.java
+9
-0
src/main/java/com/chenyang/nse/bussiness/dao/table/core/strategy/audit/conditions/AuditDateConditionsDao.java
+9
-0
src/main/java/com/chenyang/nse/bussiness/entity/orm/table/core/batchmanage/BatchManage.java
+40
-0
src/main/java/com/chenyang/nse/bussiness/entity/vo/AutoDetectVO.java
+119
-0
src/main/java/com/chenyang/nse/bussiness/entity/vo/AutoFieldVO.java
+201
-0
src/main/java/com/chenyang/nse/bussiness/interceptor/AuthenticationInterceptor.java
+72
-0
src/main/java/com/chenyang/nse/bussiness/service/core/BatchManageService.java
+19
-0
src/main/java/com/chenyang/nse/bussiness/service/core/BlobMaskingTaskService.java
+26
-0
src/main/java/com/chenyang/nse/bussiness/service/core/config/BaseConfigService.java
+29
-0
src/main/java/com/chenyang/nse/bussiness/service/core/config/impl/BaseConfigServiceImpl.java
+79
-0
src/main/java/com/chenyang/nse/bussiness/service/core/impl/BatchManageServiceImpl.java
+46
-0
src/main/java/com/chenyang/nse/bussiness/thkms/util/gmhelper/BCECUtil.java
+0
-0
src/main/java/com/chenyang/nse/bussiness/tools/audit/AuditLogUtil.java
+81
-0
src/main/java/com/chenyang/nse/bussiness/tools/dataprocess/BatchUpdateDateUtil.java
+99
-0
src/main/java/com/chenyang/nse/bussiness/tools/jdbc/BeanFactory.java
+18
-0
src/main/java/com/chenyang/nse/bussiness/tools/logger/auditlog/AuditLogService.java
+126
-0
src/main/java/com/chenyang/nse/bussiness/tools/permission/AuthUtil.java
+36
-0
src/main/java/com/chenyang/nse/bussiness/webtools/tools/jdbc/BlobAndBase64Util.java
+58
-0
src/main/resources/sql/blobmaskingtask.xml
+21
-0
没有找到文件。
src/main/java/com/chenyang/nse/bussiness/controller/core/AuditLogController.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
controller
.
core
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.chenyang.nse.bussiness.commmon.json.RespHelper
;
import
com.chenyang.nse.bussiness.commmon.json.Response
;
import
com.chenyang.nse.bussiness.config.PropertiesLoaderUtils
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.vo.auditlog.AccessPojo
;
import
com.chenyang.nse.bussiness.entity.vo.auditlog.DbAccessPojo
;
import
com.chenyang.nse.bussiness.tools.audit.AuditLogUtil
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
({
"/core/auditlog"
})
public
class
AuditLogController
{
@RequestMapping
({
"/query"
})
@ResponseBody
public
Response
query
(
@RequestParam
Map
<
String
,
Object
>
params
,
Integer
pageno
,
Integer
pagesize
,
PageInfo
pageInfo
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
pageInfo
.
setPageno
(
pageno
);
pageInfo
.
setPagesize
(
pagesize
);
String
schema
=
(
String
)
params
.
get
(
"schema"
);
String
tablename
=
(
String
)
params
.
get
(
"tablename"
);
String
sqltype
=
(
String
)
params
.
get
(
"sqltype"
);
String
action
=
(
String
)
params
.
get
(
"action"
);
List
<
JSONObject
>
auditlist
=
AuditLogUtil
.
toArrayByFileReader
();
List
<
AccessPojo
>
accessPojoList
=
new
ArrayList
();
auditlist
.
stream
().
forEach
((
audit
)
->
{
AccessPojo
accessPojo
=
(
AccessPojo
)
JSONUtil
.
toBean
(
audit
.
getString
(
"message"
),
AccessPojo
.
class
);
accessPojoList
.
add
(
accessPojo
);
});
List
<
AccessPojo
>
searchList
=
accessPojoList
;
List
<
AccessPojo
>
retList
=
new
ArrayList
();
if
(
accessPojoList
.
size
()
>
0
)
{
if
(
StringUtils
.
isNotBlank
(
schema
))
{
searchList
=
(
List
)
accessPojoList
.
stream
().
filter
((
log
)
->
log
.
getSchema
().
equalsIgnoreCase
(
schema
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
sqltype
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getSqltype
().
equalsIgnoreCase
(
sqltype
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
action
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getAction
().
equalsIgnoreCase
(
action
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
tablename
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getTables
().
contains
(
tablename
)).
collect
(
Collectors
.
toList
());
}
pageInfo
.
setCount
((
long
)
searchList
.
size
());
retList
=
(
List
)
searchList
.
stream
().
skip
((
long
)((
pageno
-
1
)
*
pagesize
)).
limit
((
long
)
pagesize
).
collect
(
Collectors
.
toList
());
}
return
RespHelper
.
updateResp
(
pageInfo
,
retList
);
}
@RequestMapping
({
"/queryDbMatch"
})
@ResponseBody
public
Response
queryDbMatch
(
@RequestParam
Map
<
String
,
Object
>
params
,
Integer
pageno
,
Integer
pagesize
,
PageInfo
pageInfo
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
pageInfo
.
setPageno
(
pageno
);
pageInfo
.
setPagesize
(
pagesize
);
String
accesstool
=
(
String
)
params
.
get
(
"accesstool"
);
String
accessoruser
=
(
String
)
params
.
get
(
"accessoruser"
);
String
sqltype
=
(
String
)
params
.
get
(
"sqltype"
);
String
action
=
(
String
)
params
.
get
(
"action"
);
String
matchstatus
=
(
String
)
params
.
get
(
"matchstatus"
);
String
datasourceid
=
(
String
)
params
.
get
(
"datasourceid"
);
List
<
JSONObject
>
auditlist
=
AuditLogUtil
.
toArrayByFileReaderOfDb
(
"1"
);
List
<
DbAccessPojo
>
dbAccessPojoList
=
new
ArrayList
();
new
ArrayList
();
auditlist
.
stream
().
forEach
((
audit
)
->
{
DbAccessPojo
dbAccessPojo
=
(
DbAccessPojo
)
JSONUtil
.
toBean
(
audit
.
getString
(
"message"
),
DbAccessPojo
.
class
);
dbAccessPojoList
.
add
(
dbAccessPojo
);
});
List
<
DbAccessPojo
>
reversedDbAccessPojoList
=
(
List
)
dbAccessPojoList
.
stream
().
sorted
(
Comparator
.
comparing
(
DbAccessPojo:
:
getAccessDate
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
DbAccessPojo
>
searchList
=
reversedDbAccessPojoList
;
List
<
DbAccessPojo
>
retList
=
new
ArrayList
();
if
(
reversedDbAccessPojoList
.
size
()
>
0
)
{
if
(
StringUtils
.
isNotBlank
(
accessoruser
))
{
searchList
=
(
List
)
reversedDbAccessPojoList
.
stream
().
filter
((
log
)
->
log
.
getAccessOsUser
().
equalsIgnoreCase
(
accessoruser
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
sqltype
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getAccessSqlType
().
equalsIgnoreCase
(
sqltype
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
action
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getImpactAction
().
equalsIgnoreCase
(
action
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
accesstool
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getAccessClient
().
contains
(
accesstool
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
matchstatus
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getStatus
().
equals
(
matchstatus
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
datasourceid
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getStrategyId
().
equals
(
datasourceid
)).
collect
(
Collectors
.
toList
());
}
pageInfo
.
setCount
((
long
)
searchList
.
size
());
retList
=
(
List
)
searchList
.
stream
().
skip
((
long
)((
pageno
-
1
)
*
pagesize
)).
limit
((
long
)
pagesize
).
collect
(
Collectors
.
toList
());
}
return
RespHelper
.
updateResp
(
pageInfo
,
retList
);
}
@RequestMapping
({
"/queryDbAccess"
})
@ResponseBody
public
Response
queryDbAccess
(
@RequestParam
Map
<
String
,
Object
>
params
,
Integer
pageno
,
Integer
pagesize
,
PageInfo
pageInfo
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
pageInfo
.
setPageno
(
pageno
);
pageInfo
.
setPagesize
(
pagesize
);
String
accesstool
=
(
String
)
params
.
get
(
"accesstool"
);
String
accessoruser
=
(
String
)
params
.
get
(
"accessoruser"
);
String
sqltype
=
(
String
)
params
.
get
(
"sqltype"
);
String
action
=
(
String
)
params
.
get
(
"action"
);
String
exestatus
=
(
String
)
params
.
get
(
"exestatus"
);
String
datasourceid
=
(
String
)
params
.
get
(
"datasourceid"
);
List
<
JSONObject
>
auditlist
=
AuditLogUtil
.
toArrayByFileReaderOfDb
(
"0"
);
List
<
DbAccessPojo
>
dbAccessPojoList
=
new
ArrayList
();
new
ArrayList
();
auditlist
.
stream
().
forEach
((
audit
)
->
{
DbAccessPojo
dbAccessPojo
=
(
DbAccessPojo
)
JSONUtil
.
toBean
(
audit
.
getString
(
"message"
),
DbAccessPojo
.
class
);
dbAccessPojoList
.
add
(
dbAccessPojo
);
});
List
<
DbAccessPojo
>
reversedDbAccessPojoList
=
(
List
)
dbAccessPojoList
.
stream
().
sorted
(
Comparator
.
comparing
(
DbAccessPojo:
:
getAccessDate
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
DbAccessPojo
>
searchList
=
reversedDbAccessPojoList
;
List
<
DbAccessPojo
>
retList
=
new
ArrayList
();
if
(
reversedDbAccessPojoList
.
size
()
>
0
)
{
if
(
StringUtils
.
isNotBlank
(
accessoruser
))
{
searchList
=
(
List
)
reversedDbAccessPojoList
.
stream
().
filter
((
log
)
->
log
.
getAccessOsUser
().
equalsIgnoreCase
(
accessoruser
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
sqltype
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getAccessSqlType
().
equalsIgnoreCase
(
sqltype
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
action
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getImpactAction
().
equalsIgnoreCase
(
action
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
accesstool
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getAccessClient
().
contains
(
accesstool
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
exestatus
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getStatus
().
equals
(
exestatus
)).
collect
(
Collectors
.
toList
());
}
if
(
StringUtils
.
isNotBlank
(
datasourceid
))
{
searchList
=
(
List
)
searchList
.
stream
().
filter
((
log
)
->
log
.
getStrategyId
().
equals
(
datasourceid
)).
collect
(
Collectors
.
toList
());
}
pageInfo
.
setCount
((
long
)
searchList
.
size
());
retList
=
(
List
)
searchList
.
stream
().
skip
((
long
)((
pageno
-
1
)
*
pagesize
)).
limit
((
long
)
pagesize
).
collect
(
Collectors
.
toList
());
}
return
RespHelper
.
updateResp
(
pageInfo
,
retList
);
}
@RequestMapping
({
"/querySqlType"
})
@ResponseBody
public
Response
querySqlType
(
@RequestParam
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
Properties
props
=
new
Properties
();
try
{
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
auditlogtype
=
props
.
getProperty
(
"auditlog_type"
);
Object
[]
sqltypeList
=
null
;
if
(
StringUtils
.
isNotBlank
(
auditlogtype
))
{
sqltypeList
=
Arrays
.
stream
(
auditlogtype
.
split
(
","
)).
toArray
();
}
return
RespHelper
.
successResp
(
sqltypeList
);
}
}
src/main/java/com/chenyang/nse/bussiness/controller/core/BatchManageController.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
controller
.
core
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.batchmanage.BatchManage
;
import
com.chenyang.nse.bussiness.entity.vo.DataGridVO
;
import
com.chenyang.nse.bussiness.service.core.BatchManageService
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
({
"/core/batchmanage"
})
public
class
BatchManageController
{
@Autowired
private
BatchManageService
batchManageService
;
@RequestMapping
public
String
index
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
"core/batchmanage/batchmanagelist"
;
}
@ResponseBody
@RequestMapping
({
"/queryBatchManage"
})
public
DataGridVO
<
BatchManage
>
queryBatchManage
(
String
isstart
,
String
engineid
,
String
taskname
,
Integer
page
,
Integer
rows
,
PageInfo
pageInfo
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
pageInfo
.
setPageno
(
page
);
pageInfo
.
setPagesize
(
rows
);
List
<
BatchManage
>
list
=
this
.
batchManageService
.
queryBatchManage
(
pageInfo
);
DataGridVO
<
BatchManage
>
vo
=
new
DataGridVO
<
BatchManage
>(
pageInfo
.
getCount
(),
list
);
return
vo
;
}
@ResponseBody
@RequestMapping
({
"/queryBatchManageAll"
})
public
List
<
HashMap
<
String
,
String
>>
queryBatchManageAll
(
String
isstart
,
String
engineid
,
String
taskname
,
Integer
page
,
Integer
rows
,
PageInfo
pageInfo
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
List
<
HashMap
<
String
,
String
>>
listhash
=
new
ArrayList
();
for
(
BatchManage
batchManage
:
this
.
batchManageService
.
queryBatchManageAll
())
{
HashMap
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"batchdescribe"
,
batchManage
.
getBatchdescribe
());
map
.
put
(
"batchnumber"
,
batchManage
.
getBatchnumber
()
+
""
);
listhash
.
add
(
map
);
}
return
listhash
;
}
@ResponseBody
@RequestMapping
({
"/isrepeatnum"
})
public
boolean
isrepeatnum
(
String
batchmanagenum
,
String
batchmanageid
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
if
(
batchmanagenum
!=
null
&&
!
""
.
equals
(
batchmanagenum
))
{
long
batchManagenum
=
this
.
batchManageService
.
querybatchManagenum
(
batchmanagenum
,
batchmanageid
);
return
batchManagenum
==
0L
;
}
else
{
return
false
;
}
}
@ResponseBody
@RequestMapping
({
"/saveorupdateBatchManage"
})
public
void
saveorupdateBatchManage
(
Integer
batchmanagenum
,
String
batchmanagedesc
,
String
batchmanageid
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
BatchManage
batchManage
=
new
BatchManage
();
batchManage
.
setBatchnumber
(
batchmanagenum
);
batchManage
.
setCreatetime
(
new
Date
());
batchManage
.
setBatchdescribe
(
batchmanagedesc
);
if
(
batchmanageid
!=
null
&&
!
""
.
equals
(
batchmanageid
))
{
batchManage
.
setId
(
batchmanageid
);
}
this
.
batchManageService
.
updateorsaveBatchManage
(
batchManage
);
}
@ResponseBody
@RequestMapping
({
"/removeBatchManage"
})
public
void
removeBatchManage
(
String
batchmanageid
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
this
.
batchManageService
.
removeBatchManage
(
batchmanageid
);
}
}
src/main/java/com/chenyang/nse/bussiness/controller/core/BlobMaskingTaskController.java
0 → 100644
View file @
2b0c5343
差异被折叠。
点击展开。
src/main/java/com/chenyang/nse/bussiness/controller/core/config/BaseConfigController.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
controller
.
core
.
config
;
import
com.chenyang.nse.bussiness.config.PropertiesLoaderUtils
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.cache.LoginUser
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.config.TcoreBaseConfig
;
import
com.chenyang.nse.bussiness.entity.vo.ComboboxVO
;
import
com.chenyang.nse.bussiness.entity.vo.DataGridVO
;
import
com.chenyang.nse.bussiness.service.core.PropertiesEditService
;
import
com.chenyang.nse.bussiness.service.core.config.BaseConfigService
;
import
com.chenyang.nse.bussiness.tools.io.FileTool
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Properties
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.dom4j.DocumentException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
({
"/core/config"
})
public
class
BaseConfigController
{
public
static
final
String
USER_NAME
=
"admin"
;
@Autowired
private
PropertiesEditService
propertiesEditService
;
@Autowired
private
BaseConfigService
baseConfigService
;
@RequestMapping
public
String
index
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
LoginUser
loginUser
=
(
LoginUser
)
request
.
getSession
().
getAttribute
(
"loginUser"
);
String
username
=
loginUser
.
getTsysUser
().
getUsername
();
boolean
u
=
false
;
if
(
username
!=
null
&&
"admin"
.
equals
(
username
))
{
u
=
true
;
}
else
{
u
=
false
;
}
model
.
addAttribute
(
"loginUser111"
,
u
);
return
"core/config/configlist"
;
}
@RequestMapping
({
"/getUser"
})
@ResponseBody
public
boolean
getUser
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
LoginUser
loginUser
=
(
LoginUser
)
request
.
getSession
().
getAttribute
(
"loginUser"
);
String
username
=
loginUser
.
getTsysUser
().
getUsername
();
return
username
!=
null
&&
"admin"
.
equals
(
username
);
}
@RequestMapping
({
"/configList"
})
@ResponseBody
public
DataGridVO
<
TcoreBaseConfig
>
configList
(
Integer
page
,
Integer
rows
,
PageInfo
pageInfo
,
String
groupName
,
String
categoryName
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
pageInfo
.
setPageno
(
page
);
pageInfo
.
setPagesize
(
rows
);
List
<
TcoreBaseConfig
>
list
=
this
.
baseConfigService
.
getConfigList
(
pageInfo
,
groupName
,
categoryName
);
DataGridVO
<
TcoreBaseConfig
>
vo
=
new
DataGridVO
<
TcoreBaseConfig
>(
pageInfo
.
getCount
(),
list
);
return
vo
;
}
@ResponseBody
@RequestMapping
({
"/getConfigById"
})
public
TcoreBaseConfig
getConfigById
(
String
id
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
return
this
.
baseConfigService
.
getConfigById
(
id
);
}
@RequestMapping
({
"/addConfig"
})
@ResponseBody
public
void
addConfig
(
String
id
,
String
configName
,
String
configNote
,
String
configValue
,
int
isEffectiveImmediately
,
String
groupName
,
String
categoryName
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
TcoreBaseConfig
tcoreBaseConfig
=
new
TcoreBaseConfig
();
if
(
id
!=
null
)
{
tcoreBaseConfig
=
this
.
baseConfigService
.
getConfigById
(
id
);
}
tcoreBaseConfig
.
setConfig_value
(
configValue
);
tcoreBaseConfig
.
setUpdate_time
(
new
Date
());
tcoreBaseConfig
.
setGroup_name
(
groupName
);
tcoreBaseConfig
.
setConfig_note
(
configNote
);
tcoreBaseConfig
.
setConfig_name
(
configName
);
tcoreBaseConfig
.
setCategory_name
(
categoryName
);
tcoreBaseConfig
.
setIs_effective_immediately
(
isEffectiveImmediately
);
if
(
id
==
null
)
{
tcoreBaseConfig
.
setConfig_demo
(
configValue
);
tcoreBaseConfig
.
setCreate_time
(
new
Date
());
this
.
baseConfigService
.
addConfig
(
tcoreBaseConfig
);
}
else
{
tcoreBaseConfig
.
setCategory_name
(
categoryName
);
tcoreBaseConfig
.
setId
(
id
);
this
.
baseConfigService
.
updateConfig
(
tcoreBaseConfig
);
if
(
tcoreBaseConfig
.
getCategory_name
().
equals
(
"数据库配置"
)
&&
tcoreBaseConfig
.
getConfig_name
().
indexOf
(
"db-"
)
==
0
)
{
try
{
FileTool
.
updateXml
(
tcoreBaseConfig
.
getGroup_name
().
toUpperCase
()
+
"/"
+
tcoreBaseConfig
.
getConfig_name
(),
tcoreBaseConfig
.
getConfig_value
());
}
catch
(
IOException
|
DocumentException
e
)
{
((
Exception
)
e
).
printStackTrace
();
}
}
else
{
try
{
FileTool
.
updateProperties
(
tcoreBaseConfig
.
getConfig_name
(),
tcoreBaseConfig
.
getConfig_value
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
@RequestMapping
({
"/reduction"
})
@ResponseBody
public
void
reduction
(
String
id
)
{
new
TcoreBaseConfig
();
TcoreBaseConfig
tcoreBaseConfig
=
this
.
baseConfigService
.
getConfigById
(
id
);
tcoreBaseConfig
.
setConfig_value
(
tcoreBaseConfig
.
getConfig_demo
());
this
.
baseConfigService
.
updateConfig
(
tcoreBaseConfig
);
if
(
tcoreBaseConfig
.
getCategory_name
().
equals
(
"数据库配置"
)
&&
tcoreBaseConfig
.
getConfig_name
().
indexOf
(
"db-"
)
==
0
)
{
try
{
FileTool
.
updateXml
(
tcoreBaseConfig
.
getGroup_name
().
toUpperCase
()
+
"/"
+
tcoreBaseConfig
.
getConfig_name
(),
tcoreBaseConfig
.
getConfig_value
());
}
catch
(
IOException
|
DocumentException
e
)
{
((
Exception
)
e
).
printStackTrace
();
}
}
else
{
try
{
FileTool
.
updateProperties
(
tcoreBaseConfig
.
getConfig_name
(),
tcoreBaseConfig
.
getConfig_value
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
@RequestMapping
({
"/getCategoryNameList"
})
@ResponseBody
public
List
<
ComboboxVO
>
getCategoryNameList
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
List
<
String
>
list
=
this
.
baseConfigService
.
getCategoryNameList
();
List
<
ComboboxVO
>
result
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
++
i
)
{
result
.
add
(
new
ComboboxVO
((
String
)
list
.
get
(
i
)));
}
return
result
;
}
@RequestMapping
({
"/getGroupNameList"
})
@ResponseBody
public
List
<
ComboboxVO
>
getGroupNameList
(
String
categoryId
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
List
<
String
>
list
=
this
.
baseConfigService
.
getGroupNameList
(
categoryId
);
List
<
ComboboxVO
>
result
=
new
ArrayList
();
result
.
add
(
new
ComboboxVO
(
"全部"
));
for
(
int
i
=
0
;
i
<
list
.
size
();
++
i
)
{
result
.
add
(
new
ComboboxVO
((
String
)
list
.
get
(
i
)));
}
return
result
;
}
@RequestMapping
({
"/removeConfig"
})
@ResponseBody
public
String
removeConfig
(
String
categoryName
,
String
categoryId
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
,
Integer
pageCurr
)
{
this
.
baseConfigService
.
removeConfigById
(
categoryId
);
String
configCnt
=
this
.
baseConfigService
.
getConfigCnt
(
categoryName
);
return
configCnt
;
}
@RequestMapping
({
"/getValueToConfig"
})
@ResponseBody
public
boolean
getValueToConfig
(
String
configName
,
String
configValue
,
HttpServletRequest
request
,
HttpServletResponse
response
,
Model
model
)
{
new
Properties
();
boolean
result
=
false
;
try
{
Properties
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
);
String
property
=
props
.
getProperty
(
configName
);
if
(
configValue
.
equalsIgnoreCase
(
property
))
{
result
=
true
;
}
else
{
result
=
false
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
}
src/main/java/com/chenyang/nse/bussiness/controller/restfulapi/tools/AuthorizationTool.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
controller
.
restfulapi
.
tools
;
import
com.chenyang.nse.bussiness.config.PropertiesLoaderUtils
;
import
com.chenyang.nse.bussiness.controller.restfulapi.entity.ResultAPIEnum
;
import
com.chenyang.nse.bussiness.entity.orm.table.base.TBaseUser
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.api.ApiInfo
;
import
com.chenyang.nse.bussiness.service.console.UserService
;
import
com.chenyang.nse.bussiness.service.core.api.ApiInfoService
;
import
com.chenyang.nse.bussiness.service.redis.RedisService
;
import
com.chenyang.nse.bussiness.tools.string.PasswordEncryptTool
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.annotation.PostConstruct
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
@Component
public
class
AuthorizationTool
{
@Autowired
private
UserService
userService
;
@Autowired
private
RedisService
redisService
;
@Autowired
private
ApiInfoService
apiInfoService
;
private
static
AuthorizationTool
authorizationTool
;
@PostConstruct
public
void
init
()
{
authorizationTool
=
this
;
authorizationTool
.
userService
=
this
.
userService
;
authorizationTool
.
redisService
=
this
.
redisService
;
authorizationTool
.
apiInfoService
=
this
.
apiInfoService
;
}
public
static
Map
<
String
,
String
>
authentication
(
String
authorization
)
{
Map
<
String
,
String
>
reFlgMap
=
new
HashMap
();
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
"身份验证信息验证失败"
);
try
{
if
(
StringUtils
.
isBlank
(
authorization
))
{
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
"身份验证信息不能为空"
);
}
else
{
String
[]
auth
=
authorization
.
split
(
" "
);
if
(
auth
.
length
<
2
)
{
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
"身份验证信息基本格式不正确"
);
}
else
{
authorization
=
auth
[
1
];
try
{
authorization
=
URLDecoder
.
decode
(
authorization
,
"utf-8"
);
authorization
=
Base64Tool
.
decryptBASE64
(
authorization
);
}
catch
(
Exception
e
)
{
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
e
.
getMessage
());
}
Object
apiUser
=
authorizationTool
.
redisService
.
get
(
"API_USER"
+
authorization
);
if
(
null
!=
apiUser
&&
!
""
.
equals
(
apiUser
.
toString
()))
{
reFlgMap
.
put
(
"code"
,
"0"
);
reFlgMap
.
put
(
"msg"
,
"SUCCESS"
);
reFlgMap
.
put
(
"username"
,
apiUser
.
toString
());
}
else
{
String
[]
authorizationArr
=
authorization
.
split
(
":"
);
if
(
null
!=
authorizationArr
&&
authorizationArr
.
length
>=
2
)
{
String
usernameStr
=
authorizationArr
[
0
];
String
pwdStr
=
authorizationArr
[
1
];
String
pwdStr1
=
PasswordEncryptTool
.
generatePassword
(
pwdStr
);
List
<
TBaseUser
>
tBaseUserList
=
authorizationTool
.
userService
.
queryAll
();
for
(
int
i
=
0
;
i
<
tBaseUserList
.
size
();
++
i
)
{
if
(
usernameStr
.
equalsIgnoreCase
(((
TBaseUser
)
tBaseUserList
.
get
(
i
)).
getUsername
())
&&
(
pwdStr
.
equalsIgnoreCase
(((
TBaseUser
)
tBaseUserList
.
get
(
i
)).
getPassword
())
||
pwdStr1
.
equalsIgnoreCase
(((
TBaseUser
)
tBaseUserList
.
get
(
i
)).
getPassword
())))
{
reFlgMap
.
put
(
"code"
,
"0"
);
reFlgMap
.
put
(
"msg"
,
"SUCCESS"
);
reFlgMap
.
put
(
"username"
,
usernameStr
);
String
apiLongConnectionFlg
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
).
getProperty
(
"api_long_connection_flg"
);
String
apiLongConnectionTimeout
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
).
getProperty
(
"api_long_connection_timeout"
);
if
(
"1"
.
equals
(
apiLongConnectionFlg
))
{
authorizationTool
.
redisService
.
set
(
"API_USER"
+
authorization
,
usernameStr
,
new
Long
((
long
)(
3600
*
Integer
.
valueOf
(
apiLongConnectionTimeout
))));
}
}
}
}
else
{
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
"身份验证信息格式不正确"
);
}
}
}
}
return
reFlgMap
;
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
">>>>>>>身份验证抛出异常:"
+
e
.
getMessage
());
return
reFlgMap
;
}
finally
{
;
}
}
public
static
Map
<
String
,
String
>
releaseVerification
(
String
reqUrl
,
String
...
type
)
{
Map
<
String
,
String
>
reFlgMap
=
new
HashMap
();
reFlgMap
.
put
(
"code"
,
"1"
);
reFlgMap
.
put
(
"msg"
,
ResultAPIEnum
.
RT_ERROR_CODE_431_STR
.
getMsg
());
HashMap
<
String
,
String
>
condMap
=
new
HashMap
();
condMap
.
put
(
"url"
,
reqUrl
);
if
(
null
!=
type
&&
type
.
length
>
0
)
{
condMap
.
put
(
"type"
,
type
[
0
]);
}
List
<
ApiInfo
>
apiInfoList
=
authorizationTool
.
apiInfoService
.
queryApiInfoByConditon
(
condMap
);
if
(
null
!=
apiInfoList
&&
apiInfoList
.
size
()
>
0
)
{
if
(!
"1"
.
equals
(((
ApiInfo
)
apiInfoList
.
get
(
0
)).
getState
()))
{
reFlgMap
.
put
(
"msg"
,
ResultAPIEnum
.
RT_ERROR_CODE_431_STR
.
getMsg
());
}
else
{
reFlgMap
.
put
(
"code"
,
"0"
);
reFlgMap
.
put
(
"msg"
,
"SUCCESS"
);
}
}
else
{
reFlgMap
.
put
(
"msg"
,
ResultAPIEnum
.
RT_ERROR_CODE_430_STR
.
getMsg
());
}
return
reFlgMap
;
}
}
src/main/java/com/chenyang/nse/bussiness/controller/restfulapi/tools/Base64Tool.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
controller
.
restfulapi
.
tools
;
import
com.chenyang.nse.bussiness.tools.string.AesTool
;
import
java.util.Base64
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
public
class
Base64Tool
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
str
=
"masking:21232F297A57A5A743894A0E4A801FC3"
;
base64
(
str
);
enAndDeCode
(
str
);
}
public
static
void
base64
(
String
str
)
{
byte
[]
bytes
=
str
.
getBytes
();
String
encoded
=
Base64
.
getEncoder
().
encodeToString
(
bytes
);
System
.
out
.
println
(
"Base 64 加密后:"
+
encoded
);
byte
[]
decoded
=
Base64
.
getDecoder
().
decode
(
encoded
);
String
decodeStr
=
new
String
(
decoded
);
System
.
out
.
println
(
"Base 64 解密后:"
+
decodeStr
);
System
.
out
.
println
();
}
public
static
void
enAndDeCode
(
String
str
)
throws
Exception
{
String
data
=
encryptBASE64
(
str
);
System
.
out
.
println
(
"sun.misc.BASE64 加密后:"
+
data
);
String
byteArray
=
decryptBASE64
(
data
);
System
.
out
.
println
(
"sun.misc.BASE64 解密后:"
+
byteArray
);
}
public
static
String
decryptBASE64
(
String
key
)
throws
Exception
{
return
new
String
((
new
BASE64Decoder
()).
decodeBuffer
(
key
));
}
public
static
String
encryptBASE64
(
String
key
)
throws
Exception
{
return
(
new
BASE64Encoder
()).
encodeBuffer
(
key
.
getBytes
());
}
public
static
String
decrypt
(
String
content
,
String
password
)
throws
Exception
{
return
AesTool
.
decrypt
(
content
,
password
);
}
public
static
String
encrypt
(
String
content
,
String
password
)
throws
Exception
{
return
AesTool
.
encrypt
(
content
,
password
);
}
}
src/main/java/com/chenyang/nse/bussiness/dao/BaseDao.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
dao
;
import
java.io.Serializable
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.util.Collection
;
import
java.util.List
;
import
javax.persistence.EntityManagerFactory
;
import
org.hibernate.Criteria
;
import
org.hibernate.Session
;
import
org.hibernate.SessionFactory
;
import
org.hibernate.criterion.Criterion
;
import
org.hibernate.criterion.Order
;
import
org.hibernate.criterion.Projections
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
@Transactional
public
class
BaseDao
<
T
,
PK
extends
Serializable
>
implements
IBaseDao
<
T
,
PK
>
{
@Autowired
public
SessionFactory
sessionFactory
;
public
Session
session
;
protected
Class
<
T
>
entityClass
=
null
;
@Autowired
private
EntityManagerFactory
entityManagerFactory
;
public
BaseDao
()
{
Class
c
=
this
.
getClass
();
Type
t
=
c
.
getGenericSuperclass
();
if
(
t
instanceof
ParameterizedType
)
{
Type
[]
p
=
((
ParameterizedType
)
t
).
getActualTypeArguments
();
this
.
entityClass
=
(
Class
)
p
[
0
];
}
}
public
Session
getSession
()
{
return
((
SessionFactory
)
this
.
entityManagerFactory
.
unwrap
(
SessionFactory
.
class
)).
getCurrentSession
();
}
public
T
get
(
PK
id
)
{
return
(
T
)
this
.
getSession
().
get
(
this
.
entityClass
,
id
);
}
public
void
save
(
T
o
)
{
this
.
getSession
().
save
(
o
);
}
public
void
saveOrUpdate
(
T
o
)
{
this
.
getSession
().
saveOrUpdate
(
o
);
}
public
void
removeById
(
PK
id
)
{
T
o
=
(
T
)
this
.
get
(
id
);
this
.
remove
(
o
);
}
public
void
remove
(
T
o
)
{
this
.
getSession
().
delete
(
o
);
}
public
void
remove
(
Collection
<
T
>
entities
)
{
if
(
entities
!=
null
)
{
for
(
T
entity
:
entities
)
{
this
.
remove
(
entity
);
}
}
}
public
void
remove
(
Criterion
...
criterion
)
{
List
<
T
>
list
=
this
.
queryAll
(
criterion
);
this
.
remove
(
list
);
}
public
boolean
exists
(
PK
id
)
{
return
this
.
get
(
id
)
!=
null
;
}
public
long
count
()
{
long
count
=
(
Long
)
this
.
createCriteria
().
setProjection
(
Projections
.
rowCount
()).
uniqueResult
();
return
count
;
}
public
long
count
(
Criteria
criteria
)
{
return
ObjectUtils
.
isEmpty
(
criteria
.
setProjection
(
Projections
.
rowCount
()).
uniqueResult
())
?
0L
:
(
Long
)
criteria
.
setProjection
(
Projections
.
rowCount
()).
uniqueResult
();
}
public
long
count
(
Criterion
...
criterion
)
{
return
(
Long
)
this
.
createCriteria
(
criterion
).
setProjection
(
Projections
.
rowCount
()).
uniqueResult
();
}
public
long
count
(
String
hql
)
{
return
(
Long
)
this
.
getSession
().
createQuery
(
hql
).
getSingleResult
();
}
@Transactional
public
Criteria
createCriteria
()
{
return
this
.
getSession
().
createCriteria
(
this
.
entityClass
);
}
public
Criteria
createCriteria
(
Criterion
...
criterions
)
{
Criteria
criteria
=
this
.
createCriteria
();
for
(
Criterion
c
:
criterions
)
{
criteria
.
add
(
c
);
}
return
criteria
;
}
public
Criteria
addOrders
(
Criteria
criteria
,
List
<
Order
>
orders
)
{
for
(
Order
c
:
orders
)
{
criteria
.
addOrder
(
c
);
}
return
criteria
;
}
@Transactional
public
List
<
T
>
queryAll
()
{
return
this
.
createCriteria
().
list
();
}
public
List
<
T
>
queryAll
(
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
return
this
.
queryAll
(
criteria
);
}
public
List
<
T
>
queryAll
(
Criteria
criteria
)
{
return
criteria
.
list
();
}
public
List
<
T
>
queryAll
(
Order
order
,
Criterion
...
criterions
)
{
return
this
.
createCriteria
(
criterions
).
addOrder
(
order
).
list
();
}
public
List
<
T
>
queryAll
(
Order
order1
,
Order
order2
,
Criterion
...
criterions
)
{
return
this
.
createCriteria
(
criterions
).
addOrder
(
order1
).
addOrder
(
order2
).
list
();
}
public
List
<
T
>
queryAll
(
String
orderBy
,
boolean
isAsc
)
{
return
isAsc
?
this
.
createCriteria
().
addOrder
(
Order
.
asc
(
orderBy
)).
list
()
:
this
.
createCriteria
().
addOrder
(
Order
.
desc
(
orderBy
)).
list
();
}
public
List
<
T
>
queryAll
(
String
orderBy
,
boolean
isAsc
,
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
return
isAsc
?
criteria
.
addOrder
(
Order
.
asc
(
orderBy
)).
list
()
:
criteria
.
addOrder
(
Order
.
desc
(
orderBy
)).
list
();
}
public
List
<
T
>
queryByPageInfo
(
PageInfo
pageinfo
)
{
pageinfo
.
setCount
(
this
.
count
());
return
this
.
createCriteria
().
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
}
public
List
<
T
>
queryByPageInfo
(
PageInfo
pageinfo
,
Order
order
)
{
long
count
=
this
.
count
();
pageinfo
.
setCount
(
count
);
List
<
T
>
list
=
this
.
createCriteria
().
addOrder
(
order
).
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
return
list
;
}
public
List
<
T
>
queryByPageInfo
(
PageInfo
pageinfo
,
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
long
count
=
this
.
count
(
criteria
);
pageinfo
.
setCount
(
count
);
criteria
=
this
.
createCriteria
(
criterion
);
List
<
T
>
list
=
criteria
.
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
return
list
;
}
public
List
<
T
>
queryByPageInfo
(
PageInfo
pageinfo
,
Order
order
,
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
long
count
=
this
.
count
(
criteria
);
pageinfo
.
setCount
(
count
);
criteria
=
this
.
createCriteria
(
criterion
);
criteria
.
setCacheable
(
false
);
List
<
T
>
list
=
criteria
.
addOrder
(
order
).
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
return
list
;
}
public
List
<
T
>
queryByPageInfo1
(
PageInfo
pageinfo
,
Order
order
,
Order
order1
,
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
long
count
=
this
.
count
(
criteria
);
pageinfo
.
setCount
(
count
);
criteria
=
this
.
createCriteria
(
criterion
);
List
<
T
>
list
=
criteria
.
addOrder
(
order
).
addOrder
(
order1
).
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
return
list
;
}
public
List
<
T
>
queryByPageInfoByOrders
(
PageInfo
pageinfo
,
List
<
Order
>
orders
,
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
long
count
=
this
.
count
(
criteria
);
pageinfo
.
setCount
(
count
);
criteria
=
this
.
createCriteria
(
criterion
);
this
.
addOrders
(
criteria
,
orders
);
List
<
T
>
list
=
criteria
.
setFirstResult
(
pageinfo
.
getOffset
()).
setMaxResults
(
pageinfo
.
getPagesize
()).
list
();
return
list
;
}
public
T
queryUnique
(
Criterion
...
criterion
)
{
Criteria
criteria
=
this
.
createCriteria
(
criterion
);
return
(
T
)
criteria
.
uniqueResult
();
}
public
Session
openSession
()
{
return
this
.
sessionFactory
.
openSession
();
}
public
void
update
(
T
t
)
{
this
.
getSession
().
update
(
t
);
}
public
List
queryGroup
(
Order
order
,
String
groupBy
,
Criterion
...
criterions
)
{
return
this
.
createCriteria
(
criterions
).
addOrder
(
order
).
setProjection
(
Projections
.
groupProperty
(
groupBy
)).
list
();
}
}
src/main/java/com/chenyang/nse/bussiness/dao/BaseDao222.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
dao
;
import
com.chenyang.nse.bussiness.HibernateSessionFactory
;
import
java.io.Serializable
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.util.Collection
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.Query
;
import
javax.transaction.Transactional
;
import
org.hibernate.Criteria
;
import
org.hibernate.Session
;
import
org.hibernate.criterion.Order
;
@Transactional
public
class
BaseDao222
<
T
,
PK
extends
Serializable
>
{
private
Class
<
T
>
entityClass
;
@PersistenceContext
protected
EntityManager
entityManager
;
protected
BaseDao222
()
{
Type
genType
=
this
.
getClass
().
getGenericSuperclass
();
Type
[]
params
=
((
ParameterizedType
)
genType
).
getActualTypeArguments
();
this
.
entityClass
=
(
Class
)
params
[
0
];
}
public
Class
<
T
>
getEntityClass
()
{
return
this
.
entityClass
;
}
public
void
setEntityClass
(
Class
<
T
>
entityClass
)
{
this
.
entityClass
=
entityClass
;
}
public
EntityManager
getEntityManager
()
{
return
this
.
entityManager
;
}
public
void
save
(
T
entity
)
{
this
.
entityManager
.
persist
(
entity
);
this
.
entityManager
.
flush
();
}
public
void
update
(
PK
id
)
{
T
entity
=
(
T
)
this
.
findByID
(
id
);
this
.
entityManager
.
merge
(
entity
);
this
.
entityManager
.
flush
();
}
public
void
delete
(
PK
id
)
{
T
entity
=
(
T
)
this
.
findByID
(
id
);
this
.
entityManager
.
remove
(
entity
);
}
public
List
<
T
>
queryAll
()
{
Query
query
=
this
.
entityManager
.
createQuery
(
""
);
return
query
.
getResultList
();
}
public
List
<
T
>
queryAll
(
Criteria
criteria
)
{
return
criteria
.
list
();
}
public
List
<
T
>
queryAll
(
String
orderBy
,
boolean
isAsc
)
{
return
isAsc
?
this
.
createCriteria
().
addOrder
(
Order
.
asc
(
orderBy
)).
list
()
:
this
.
createCriteria
().
addOrder
(
Order
.
desc
(
orderBy
)).
list
();
}
public
Criteria
createCriteria
()
{
return
this
.
getSession
().
createCriteria
(
this
.
entityClass
);
}
public
Session
getSession
()
{
return
HibernateSessionFactory
.
getSession
();
}
public
T
get
(
PK
id
)
{
T
pojo
=
(
T
)
this
.
entityManager
.
find
(
this
.
entityClass
,
id
);
return
pojo
;
}
public
void
remove
(
PK
id
)
{
T
entity
=
(
T
)
this
.
findByID
(
id
);
this
.
entityManager
.
remove
(
entity
);
}
public
void
remove
(
T
o
)
{
this
.
entityManager
.
remove
(
o
);
}
public
void
removeById
(
PK
id
)
{
T
o
=
(
T
)
this
.
get
(
id
);
this
.
remove
(
o
);
}
public
void
remove
(
Collection
<
T
>
entities
)
{
if
(
entities
!=
null
)
{
for
(
T
entity
:
entities
)
{
this
.
remove
(
entity
);
}
}
}
public
T
findByID
(
PK
id
)
{
T
pojo
=
(
T
)
this
.
entityManager
.
find
(
this
.
entityClass
,
id
);
return
pojo
;
}
public
List
<
T
>
findAll
(
String
qlString
)
{
Query
query
=
this
.
entityManager
.
createQuery
(
qlString
);
return
query
.
getResultList
();
}
}
src/main/java/com/chenyang/nse/bussiness/dao/table/core/batchmanage/BatchManageDao.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
dao
.
table
.
core
.
batchmanage
;
import
com.chenyang.nse.bussiness.dao.BaseDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.batchmanage.BatchManage
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
BatchManageDao
extends
BaseDao
<
BatchManage
,
String
>
{
}
src/main/java/com/chenyang/nse/bussiness/dao/table/core/rule/conditions/ApplicationConditionsDao.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
dao
.
table
.
core
.
rule
.
conditions
;
import
com.chenyang.nse.bussiness.dao.BaseDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.rule.conditions.ApplicationConditions
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
ApplicationConditionsDao
extends
BaseDao
<
ApplicationConditions
,
String
>
{
}
src/main/java/com/chenyang/nse/bussiness/dao/table/core/strategy/audit/conditions/AuditDateConditionsDao.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
dao
.
table
.
core
.
strategy
.
audit
.
conditions
;
import
com.chenyang.nse.bussiness.dao.BaseDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.strategy.audit.conditions.AuditDateConditions
;
import
org.springframework.stereotype.Repository
;
@Repository
public
class
AuditDateConditionsDao
extends
BaseDao
<
AuditDateConditions
,
String
>
{
}
src/main/java/com/chenyang/nse/bussiness/entity/orm/table/core/batchmanage/BatchManage.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
entity
.
orm
.
table
.
core
.
batchmanage
;
import
com.chenyang.nse.bussiness.entity.orm.table.TBaseEntity
;
import
java.util.Date
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
@Entity
@Table
(
name
=
"BATCH_MANAGE"
)
public
class
BatchManage
extends
TBaseEntity
{
private
Integer
batchnumber
;
private
String
batchdescribe
;
private
Date
createtime
;
public
Integer
getBatchnumber
()
{
return
this
.
batchnumber
;
}
public
void
setBatchnumber
(
Integer
batchnumber
)
{
this
.
batchnumber
=
batchnumber
;
}
public
String
getBatchdescribe
()
{
return
this
.
batchdescribe
;
}
public
void
setBatchdescribe
(
String
batchdescribe
)
{
this
.
batchdescribe
=
batchdescribe
;
}
public
Date
getCreatetime
()
{
return
this
.
createtime
;
}
public
void
setCreatetime
(
Date
createtime
)
{
this
.
createtime
=
createtime
;
}
}
src/main/java/com/chenyang/nse/bussiness/entity/vo/AutoDetectVO.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
entity
.
vo
;
import
java.util.List
;
public
class
AutoDetectVO
{
private
String
schema
;
private
String
tableName
;
private
String
dataSystemId
;
private
List
<
AutoFieldVO
>
columnArr
;
public
String
getSchema
()
{
return
this
.
schema
;
}
public
String
getTableName
()
{
return
this
.
tableName
;
}
public
String
getDataSystemId
()
{
return
this
.
dataSystemId
;
}
public
List
<
AutoFieldVO
>
getColumnArr
()
{
return
this
.
columnArr
;
}
public
void
setSchema
(
final
String
schema
)
{
this
.
schema
=
schema
;
}
public
void
setTableName
(
final
String
tableName
)
{
this
.
tableName
=
tableName
;
}
public
void
setDataSystemId
(
final
String
dataSystemId
)
{
this
.
dataSystemId
=
dataSystemId
;
}
public
void
setColumnArr
(
final
List
<
AutoFieldVO
>
columnArr
)
{
this
.
columnArr
=
columnArr
;
}
public
boolean
equals
(
final
Object
o
)
{
if
(
o
==
this
)
{
return
true
;
}
else
if
(!(
o
instanceof
AutoDetectVO
))
{
return
false
;
}
else
{
AutoDetectVO
other
=
(
AutoDetectVO
)
o
;
if
(!
other
.
canEqual
(
this
))
{
return
false
;
}
else
{
Object
this
$schema
=
this
.
getSchema
();
Object
other$schema
=
other
.
getSchema
();
if
(
this
$schema
==
null
)
{
if
(
other$schema
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$schema
.
equals
(
other$schema
))
{
return
false
;
}
Object
this
$tableName
=
this
.
getTableName
();
Object
other$tableName
=
other
.
getTableName
();
if
(
this
$tableName
==
null
)
{
if
(
other$tableName
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$tableName
.
equals
(
other$tableName
))
{
return
false
;
}
Object
this
$dataSystemId
=
this
.
getDataSystemId
();
Object
other$dataSystemId
=
other
.
getDataSystemId
();
if
(
this
$dataSystemId
==
null
)
{
if
(
other$dataSystemId
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$dataSystemId
.
equals
(
other$dataSystemId
))
{
return
false
;
}
Object
this
$columnArr
=
this
.
getColumnArr
();
Object
other$columnArr
=
other
.
getColumnArr
();
if
(
this
$columnArr
==
null
)
{
if
(
other$columnArr
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$columnArr
.
equals
(
other$columnArr
))
{
return
false
;
}
return
true
;
}
}
}
protected
boolean
canEqual
(
final
Object
other
)
{
return
other
instanceof
AutoDetectVO
;
}
public
int
hashCode
()
{
int
PRIME
=
59
;
int
result
=
1
;
Object
$schema
=
this
.
getSchema
();
result
=
result
*
59
+
(
$schema
==
null
?
43
:
$schema
.
hashCode
());
Object
$tableName
=
this
.
getTableName
();
result
=
result
*
59
+
(
$tableName
==
null
?
43
:
$tableName
.
hashCode
());
Object
$dataSystemId
=
this
.
getDataSystemId
();
result
=
result
*
59
+
(
$dataSystemId
==
null
?
43
:
$dataSystemId
.
hashCode
());
Object
$columnArr
=
this
.
getColumnArr
();
result
=
result
*
59
+
(
$columnArr
==
null
?
43
:
$columnArr
.
hashCode
());
return
result
;
}
public
String
toString
()
{
return
"AutoDetectVO(schema="
+
this
.
getSchema
()
+
", tableName="
+
this
.
getTableName
()
+
", dataSystemId="
+
this
.
getDataSystemId
()
+
", columnArr="
+
this
.
getColumnArr
()
+
")"
;
}
}
src/main/java/com/chenyang/nse/bussiness/entity/vo/AutoFieldVO.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
entity
.
vo
;
public
class
AutoFieldVO
{
private
String
columnName
;
private
String
columnType
;
private
Integer
originalLength
;
private
Integer
bestLength
;
private
String
isLike
;
private
String
keepfirst
;
private
String
encdigit
;
private
String
twoindex
;
public
String
getColumnName
()
{
return
this
.
columnName
;
}
public
String
getColumnType
()
{
return
this
.
columnType
;
}
public
Integer
getOriginalLength
()
{
return
this
.
originalLength
;
}
public
Integer
getBestLength
()
{
return
this
.
bestLength
;
}
public
String
getIsLike
()
{
return
this
.
isLike
;
}
public
String
getKeepfirst
()
{
return
this
.
keepfirst
;
}
public
String
getEncdigit
()
{
return
this
.
encdigit
;
}
public
String
getTwoindex
()
{
return
this
.
twoindex
;
}
public
void
setColumnName
(
final
String
columnName
)
{
this
.
columnName
=
columnName
;
}
public
void
setColumnType
(
final
String
columnType
)
{
this
.
columnType
=
columnType
;
}
public
void
setOriginalLength
(
final
Integer
originalLength
)
{
this
.
originalLength
=
originalLength
;
}
public
void
setBestLength
(
final
Integer
bestLength
)
{
this
.
bestLength
=
bestLength
;
}
public
void
setIsLike
(
final
String
isLike
)
{
this
.
isLike
=
isLike
;
}
public
void
setKeepfirst
(
final
String
keepfirst
)
{
this
.
keepfirst
=
keepfirst
;
}
public
void
setEncdigit
(
final
String
encdigit
)
{
this
.
encdigit
=
encdigit
;
}
public
void
setTwoindex
(
final
String
twoindex
)
{
this
.
twoindex
=
twoindex
;
}
public
boolean
equals
(
final
Object
o
)
{
if
(
o
==
this
)
{
return
true
;
}
else
if
(!(
o
instanceof
AutoFieldVO
))
{
return
false
;
}
else
{
AutoFieldVO
other
=
(
AutoFieldVO
)
o
;
if
(!
other
.
canEqual
(
this
))
{
return
false
;
}
else
{
Object
this
$columnName
=
this
.
getColumnName
();
Object
other$columnName
=
other
.
getColumnName
();
if
(
this
$columnName
==
null
)
{
if
(
other$columnName
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$columnName
.
equals
(
other$columnName
))
{
return
false
;
}
Object
this
$columnType
=
this
.
getColumnType
();
Object
other$columnType
=
other
.
getColumnType
();
if
(
this
$columnType
==
null
)
{
if
(
other$columnType
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$columnType
.
equals
(
other$columnType
))
{
return
false
;
}
Object
this
$originalLength
=
this
.
getOriginalLength
();
Object
other$originalLength
=
other
.
getOriginalLength
();
if
(
this
$originalLength
==
null
)
{
if
(
other$originalLength
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$originalLength
.
equals
(
other$originalLength
))
{
return
false
;
}
Object
this
$bestLength
=
this
.
getBestLength
();
Object
other$bestLength
=
other
.
getBestLength
();
if
(
this
$bestLength
==
null
)
{
if
(
other$bestLength
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$bestLength
.
equals
(
other$bestLength
))
{
return
false
;
}
Object
this
$isLike
=
this
.
getIsLike
();
Object
other$isLike
=
other
.
getIsLike
();
if
(
this
$isLike
==
null
)
{
if
(
other$isLike
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$isLike
.
equals
(
other$isLike
))
{
return
false
;
}
Object
this
$keepfirst
=
this
.
getKeepfirst
();
Object
other$keepfirst
=
other
.
getKeepfirst
();
if
(
this
$keepfirst
==
null
)
{
if
(
other$keepfirst
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$keepfirst
.
equals
(
other$keepfirst
))
{
return
false
;
}
Object
this
$encdigit
=
this
.
getEncdigit
();
Object
other$encdigit
=
other
.
getEncdigit
();
if
(
this
$encdigit
==
null
)
{
if
(
other$encdigit
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$encdigit
.
equals
(
other$encdigit
))
{
return
false
;
}
Object
this
$twoindex
=
this
.
getTwoindex
();
Object
other$twoindex
=
other
.
getTwoindex
();
if
(
this
$twoindex
==
null
)
{
if
(
other$twoindex
!=
null
)
{
return
false
;
}
}
else
if
(!
this
$twoindex
.
equals
(
other$twoindex
))
{
return
false
;
}
return
true
;
}
}
}
protected
boolean
canEqual
(
final
Object
other
)
{
return
other
instanceof
AutoFieldVO
;
}
public
int
hashCode
()
{
int
PRIME
=
59
;
int
result
=
1
;
Object
$columnName
=
this
.
getColumnName
();
result
=
result
*
59
+
(
$columnName
==
null
?
43
:
$columnName
.
hashCode
());
Object
$columnType
=
this
.
getColumnType
();
result
=
result
*
59
+
(
$columnType
==
null
?
43
:
$columnType
.
hashCode
());
Object
$originalLength
=
this
.
getOriginalLength
();
result
=
result
*
59
+
(
$originalLength
==
null
?
43
:
$originalLength
.
hashCode
());
Object
$bestLength
=
this
.
getBestLength
();
result
=
result
*
59
+
(
$bestLength
==
null
?
43
:
$bestLength
.
hashCode
());
Object
$isLike
=
this
.
getIsLike
();
result
=
result
*
59
+
(
$isLike
==
null
?
43
:
$isLike
.
hashCode
());
Object
$keepfirst
=
this
.
getKeepfirst
();
result
=
result
*
59
+
(
$keepfirst
==
null
?
43
:
$keepfirst
.
hashCode
());
Object
$encdigit
=
this
.
getEncdigit
();
result
=
result
*
59
+
(
$encdigit
==
null
?
43
:
$encdigit
.
hashCode
());
Object
$twoindex
=
this
.
getTwoindex
();
result
=
result
*
59
+
(
$twoindex
==
null
?
43
:
$twoindex
.
hashCode
());
return
result
;
}
public
String
toString
()
{
return
"AutoFieldVO(columnName="
+
this
.
getColumnName
()
+
", columnType="
+
this
.
getColumnType
()
+
", originalLength="
+
this
.
getOriginalLength
()
+
", bestLength="
+
this
.
getBestLength
()
+
", isLike="
+
this
.
getIsLike
()
+
", keepfirst="
+
this
.
getKeepfirst
()
+
", encdigit="
+
this
.
getEncdigit
()
+
", twoindex="
+
this
.
getTwoindex
()
+
")"
;
}
}
src/main/java/com/chenyang/nse/bussiness/interceptor/AuthenticationInterceptor.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
interceptor
;
import
com.chenyang.nse.bussiness.annot.PassToken
;
import
com.chenyang.nse.bussiness.annot.PullRegister
;
import
com.chenyang.nse.bussiness.exception.ClientOutOfWhiteListException
;
import
com.chenyang.nse.bussiness.exception.TokenException
;
import
com.chenyang.nse.bussiness.jar.util.JarClientUtil
;
import
com.chenyang.nse.bussiness.service.console.UserService
;
import
com.chenyang.nse.bussiness.tools.token.TokenUtil
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
public
class
AuthenticationInterceptor
implements
HandlerInterceptor
{
@Autowired
private
UserService
userService
;
public
boolean
preHandle
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Object
object
)
throws
Exception
{
String
token
=
httpServletRequest
.
getHeader
(
"token"
);
if
(!(
object
instanceof
HandlerMethod
))
{
return
true
;
}
else
if
(
httpServletRequest
.
getMethod
().
equals
(
"OPTIONS"
))
{
return
true
;
}
else
{
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
object
;
Method
method
=
handlerMethod
.
getMethod
();
if
(
method
.
isAnnotationPresent
(
PassToken
.
class
))
{
PassToken
passToken
=
(
PassToken
)
method
.
getAnnotation
(
PassToken
.
class
);
if
(
method
.
isAnnotationPresent
(
PullRegister
.
class
))
{
int
remotePort
=
Integer
.
parseInt
((
String
)
JarClientUtil
.
getRequestParamsMap
(
httpServletRequest
).
get
(
"remotePort"
));
if
(
remotePort
!=
65536
)
{
JarClientUtil
.
registOrUpt
(
httpServletRequest
);
if
(!
JarClientUtil
.
checkAuth
(
httpServletRequest
))
{
JarClientUtil
.
log
(
httpServletRequest
.
getRemoteHost
(),
httpServletRequest
.
getRemotePort
(),
"当前客户端地址在白名单外,无法获取规则数据,已驳回请求"
);
throw
new
ClientOutOfWhiteListException
(
"白名单范围外"
);
}
}
}
if
(
passToken
.
required
())
{
return
true
;
}
}
if
(!
httpServletRequest
.
getRequestURI
().
contains
(
"webtools"
)
&&
!
httpServletRequest
.
getRequestURI
().
contains
(
"encryptionGatewayController"
))
{
if
(
token
==
null
)
{
httpServletResponse
.
sendRedirect
(
"/index.html"
);
throw
new
TokenException
(
"无token,请重新登录"
);
}
else
{
boolean
verify
=
TokenUtil
.
verify
(
token
);
if
(!
verify
)
{
throw
new
TokenException
(
"token异常,请重新登录"
);
}
else
{
return
true
;
}
}
}
else
{
return
true
;
}
}
}
public
void
postHandle
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Object
o
,
ModelAndView
modelAndView
)
throws
Exception
{
}
public
void
afterCompletion
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Object
o
,
Exception
e
)
throws
Exception
{
}
}
src/main/java/com/chenyang/nse/bussiness/service/core/BatchManageService.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
service
.
core
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.batchmanage.BatchManage
;
import
java.util.List
;
public
interface
BatchManageService
{
List
<
BatchManage
>
queryBatchManage
(
PageInfo
pageInfo
);
List
<
BatchManage
>
queryBatchManageAll
();
long
querybatchManagenum
(
String
batchmanagenum
,
String
batchmanageid
);
void
updateorsaveBatchManage
(
BatchManage
batchManage
);
BatchManage
querybatchManageById
(
String
batchmanageid
);
void
removeBatchManage
(
String
batchmanageid
);
}
src/main/java/com/chenyang/nse/bussiness/service/core/BlobMaskingTaskService.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
service
.
core
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.blobmasking.TCoreBlobMaskingTask
;
import
com.chenyang.nse.bussiness.entity.param.blobmasking.TCoreBlobMaskingTaskCond
;
import
com.chenyang.nse.bussiness.entity.vo.ResultVO
;
import
com.chenyang.nse.bussiness.entity.vo.blobmasking.TCoreBlobMaskingTaskVO
;
import
java.util.List
;
public
interface
BlobMaskingTaskService
{
List
<
TCoreBlobMaskingTask
>
queryTask
(
String
taskname
,
PageInfo
pageInfo
);
List
<
TCoreBlobMaskingTask
>
queryBlobMaskingTaskByTaskName
(
String
taskname
);
ResultVO
saveBlobMaskingTask
(
TCoreBlobMaskingTaskCond
tcbmtc
);
void
removeTask
(
String
taskid
);
TCoreBlobMaskingTask
queryBlobMaskingTaskByID
(
String
taskid
);
TCoreBlobMaskingTaskVO
queryBlobMaskingTaskVOByID
(
String
taskid
);
void
setExecutionState
(
String
taskid
);
ResultVO
execMaskingTask
(
String
taskid
);
}
src/main/java/com/chenyang/nse/bussiness/service/core/config/BaseConfigService.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
service
.
core
.
config
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.config.TcoreBaseConfig
;
import
java.util.List
;
public
interface
BaseConfigService
{
void
removeConfigById
(
String
id
);
void
addConfig
(
TcoreBaseConfig
config
);
TcoreBaseConfig
getConfigById
(
String
id
);
List
<
TcoreBaseConfig
>
getConfigList
(
String
groupName
,
String
categoryName
);
List
<
TcoreBaseConfig
>
getConfigList
(
PageInfo
pageInfo
,
String
groupName
,
String
categoryName
);
String
getConfigCnt
(
String
categoryName
);
List
<
TcoreBaseConfig
>
getConfigList
(
String
isEffectiveImmediately
);
void
updateConfig
(
TcoreBaseConfig
config
);
List
<
String
>
getCategoryNameList
();
List
<
String
>
getGroupNameList
(
String
categoryId
);
void
initConfig
();
}
src/main/java/com/chenyang/nse/bussiness/service/core/config/impl/BaseConfigServiceImpl.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
service
.
core
.
config
.
impl
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.dao.table.core.config.TcoreBaseConfigDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.config.TcoreBaseConfig
;
import
com.chenyang.nse.bussiness.service.core.config.BaseConfigService
;
import
com.chenyang.nse.bussiness.service.redis.RedisService
;
import
java.util.HashMap
;
import
java.util.List
;
import
org.hibernate.criterion.Criterion
;
import
org.hibernate.criterion.Order
;
import
org.hibernate.criterion.Restrictions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
@Transactional
(
rollbackFor
=
{
Exception
.
class
}
)
public
class
BaseConfigServiceImpl
implements
BaseConfigService
{
@Autowired
private
TcoreBaseConfigDao
tcoreBaseConfigDao
;
@Autowired
private
RedisService
redisService
;
public
static
final
String
BASE_CONFIG
=
TcoreBaseConfig
.
class
.
getSimpleName
();
public
void
removeConfigById
(
String
id
)
{
this
.
tcoreBaseConfigDao
.
removeById
(
id
);
}
public
void
addConfig
(
TcoreBaseConfig
config
)
{
this
.
tcoreBaseConfigDao
.
save
(
config
);
}
public
TcoreBaseConfig
getConfigById
(
String
id
)
{
return
(
TcoreBaseConfig
)
this
.
tcoreBaseConfigDao
.
get
(
id
);
}
public
List
<
TcoreBaseConfig
>
getConfigList
(
String
groupName
,
String
categoryName
)
{
return
this
.
tcoreBaseConfigDao
.
queryAll
();
}
public
void
updateConfig
(
TcoreBaseConfig
config
)
{
this
.
tcoreBaseConfigDao
.
saveOrUpdate
(
config
);
}
public
List
<
String
>
getCategoryNameList
()
{
return
this
.
tcoreBaseConfigDao
.
getCategoryNameList
();
}
public
List
<
String
>
getGroupNameList
(
String
categoryId
)
{
return
this
.
tcoreBaseConfigDao
.
getGroupNameList
(
categoryId
);
}
public
List
<
TcoreBaseConfig
>
getConfigList
(
String
isEffectiveImmediately
)
{
return
null
;
}
public
void
initConfig
()
{
List
<
TcoreBaseConfig
>
tcoreBaseConfigList
=
this
.
tcoreBaseConfigDao
.
queryAll
(
new
Criterion
[]{
Restrictions
.
eq
(
"isEffectiveImmediately"
,
1
)});
HashMap
<
String
,
String
>
configMap
=
new
HashMap
(
1000
);
for
(
TcoreBaseConfig
tcoreBaseConfig
:
tcoreBaseConfigList
)
{
configMap
.
put
(
tcoreBaseConfig
.
getId
(),
tcoreBaseConfig
.
getConfig_value
());
}
this
.
redisService
.
add
(
BASE_CONFIG
,
configMap
);
}
public
List
<
TcoreBaseConfig
>
getConfigList
(
PageInfo
pageInfo
,
String
groupName
,
String
categoryName
)
{
String
empty
=
"null"
;
return
!
""
.
equals
(
groupName
)
&&
groupName
!=
null
&&
!
empty
.
equals
(
groupName
)
&&
!
"全部"
.
equals
(
groupName
)
?
this
.
tcoreBaseConfigDao
.
queryByPageInfo
(
pageInfo
,
Order
.
desc
(
"groupName"
),
new
Criterion
[]{
Restrictions
.
eq
(
"categoryName"
,
categoryName
),
Restrictions
.
eq
(
"groupName"
,
groupName
)})
:
this
.
tcoreBaseConfigDao
.
queryByPageInfo
(
pageInfo
,
Order
.
desc
(
"groupName"
),
new
Criterion
[]{
Restrictions
.
eq
(
"categoryName"
,
categoryName
)});
}
public
String
getConfigCnt
(
String
categoryName
)
{
return
this
.
tcoreBaseConfigDao
.
getCategoryNameCnt
(
categoryName
);
}
}
src/main/java/com/chenyang/nse/bussiness/service/core/impl/BatchManageServiceImpl.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
service
.
core
.
impl
;
import
com.chenyang.nse.bussiness.dao.PageInfo
;
import
com.chenyang.nse.bussiness.dao.table.core.batchmanage.BatchManageDao
;
import
com.chenyang.nse.bussiness.entity.orm.table.core.batchmanage.BatchManage
;
import
com.chenyang.nse.bussiness.service.core.BatchManageService
;
import
java.util.List
;
import
org.hibernate.criterion.Criterion
;
import
org.hibernate.criterion.Order
;
import
org.hibernate.criterion.Restrictions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
@Transactional
public
class
BatchManageServiceImpl
implements
BatchManageService
{
@Autowired
private
BatchManageDao
batchManageDao
;
public
List
<
BatchManage
>
queryBatchManage
(
PageInfo
pageInfo
)
{
List
<
BatchManage
>
list
=
this
.
batchManageDao
.
queryByPageInfo
(
pageInfo
,
Order
.
desc
(
"createtime"
));
return
list
;
}
public
long
querybatchManagenum
(
String
batchmanagenum
,
String
batchmanageid
)
{
return
this
.
batchManageDao
.
count
(
new
Criterion
[]{
Restrictions
.
eq
(
"batchnumber"
,
Integer
.
parseInt
(
batchmanagenum
)),
Restrictions
.
ne
(
"id"
,
batchmanageid
)});
}
public
void
updateorsaveBatchManage
(
BatchManage
batchManage
)
{
this
.
batchManageDao
.
saveOrUpdate
(
batchManage
);
}
public
BatchManage
querybatchManageById
(
String
batchmanageid
)
{
return
(
BatchManage
)
this
.
batchManageDao
.
get
(
batchmanageid
);
}
public
void
removeBatchManage
(
String
batchmanageid
)
{
this
.
batchManageDao
.
removeById
(
batchmanageid
);
}
public
List
<
BatchManage
>
queryBatchManageAll
()
{
List
<
BatchManage
>
list
=
this
.
batchManageDao
.
queryAll
(
Order
.
desc
(
"createtime"
),
new
Criterion
[
0
]);
return
list
;
}
}
src/main/java/com/chenyang/nse/bussiness/thkms/util/gmhelper/BCECUtil.java
0 → 100644
View file @
2b0c5343
差异被折叠。
点击展开。
src/main/java/com/chenyang/nse/bussiness/tools/audit/AuditLogUtil.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
audit
;
import
com.alibaba.fastjson.JSONObject
;
import
com.chenyang.nse.bussiness.config.PropertiesLoaderUtils
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
import
org.apache.commons.lang.StringUtils
;
public
class
AuditLogUtil
{
private
static
String
fileName
=
""
;
public
static
ArrayList
<
JSONObject
>
toArrayByFileReader
()
{
Properties
props
=
new
Properties
();
try
{
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
filepath
=
props
.
getProperty
(
"appserverlogpath"
);
List
<
String
>
fileNames
=
new
ArrayList
();
FileUtil
.
findFileList
(
new
File
(
filepath
),
fileNames
);
ArrayList
<
JSONObject
>
arrayList
=
new
ArrayList
();
fileNames
.
stream
().
forEach
((
fileName
)
->
readFile
(
arrayList
,
fileName
));
return
arrayList
;
}
private
static
void
readFile
(
ArrayList
<
JSONObject
>
arrayList
,
String
fileName
)
{
try
{
InputStream
fr
=
new
FileInputStream
(
fileName
);
BufferedReader
bf
=
new
BufferedReader
(
new
InputStreamReader
(
fr
));
String
str
;
while
((
str
=
bf
.
readLine
())
!=
null
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
str
);
arrayList
.
add
(
jsonObject
);
}
bf
.
close
();
fr
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
static
ArrayList
<
JSONObject
>
toArrayByFileReaderOfDb
(
String
logType
)
{
Properties
props
=
new
Properties
();
try
{
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
filepath
=
""
;
if
(
StringUtils
.
isBlank
(
logType
))
{
return
null
;
}
else
{
if
(
logType
.
equals
(
"0"
))
{
filepath
=
props
.
getProperty
(
"dbaccesslogpath"
);
}
else
if
(
logType
.
equals
(
"1"
))
{
filepath
=
props
.
getProperty
(
"dbrulelogpath"
);
}
List
<
String
>
fileNames
=
new
ArrayList
();
FileUtil
.
findFileList
(
new
File
(
filepath
),
fileNames
);
ArrayList
<
JSONObject
>
arrayList
=
new
ArrayList
();
fileNames
.
stream
().
forEach
((
fileName
)
->
readFile
(
arrayList
,
fileName
));
return
arrayList
;
}
}
}
src/main/java/com/chenyang/nse/bussiness/tools/dataprocess/BatchUpdateDateUtil.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
dataprocess
;
import
com.chenyang.nse.bussiness.dao.table.core.TCoreDatasystemDao
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
public
class
BatchUpdateDateUtil
{
@Autowired
private
TCoreDatasystemDao
tCoreDatasystemDao
;
public
void
updateDateForEncryption
(
String
dataSystemId
,
String
tableName
,
Map
<
String
,
String
>
columnMap
,
String
...
primarykeys
)
throws
SQLException
,
ClassNotFoundException
{
Class
.
forName
(
"com.mysql.cj.jdbc.Driver"
);
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:mysql://192.168.2.131:3306/test?characterEncoding=UTF-8"
,
"root"
,
"root"
);
conn
.
setAutoCommit
(
false
);
List
<
String
>
fieldlist
=
new
ArrayList
();
for
(
String
s
:
columnMap
.
keySet
())
{
fieldlist
.
add
(
s
);
}
StringBuilder
querycolumn
=
new
StringBuilder
();
StringBuilder
updateColumn
=
new
StringBuilder
();
for
(
String
s
:
fieldlist
)
{
querycolumn
.
append
(
s
);
querycolumn
.
append
(
","
);
}
if
(
primarykeys
.
length
>
0
)
{
for
(
String
primarykey
:
primarykeys
)
{
querycolumn
.
append
(
primarykey
);
querycolumn
.
append
(
","
);
}
}
querycolumn
.
deleteCharAt
(
querycolumn
.
length
()
-
1
);
String
querysql
=
"select "
+
querycolumn
.
toString
()
+
" from test."
+
tableName
;
updateColumn
.
append
(
"update "
+
tableName
+
" set "
);
for
(
String
s
:
fieldlist
)
{
updateColumn
.
append
(
s
);
updateColumn
.
append
(
" = ? ,"
);
}
updateColumn
.
deleteCharAt
(
updateColumn
.
length
()
-
1
);
if
(
primarykeys
.
length
>
0
)
{
updateColumn
.
append
(
" where "
);
for
(
int
i
=
0
;
i
<
primarykeys
.
length
;
++
i
)
{
updateColumn
.
append
(
primarykeys
[
i
]
+
" = ?"
);
if
(
i
!=
primarykeys
.
length
-
1
)
{
updateColumn
.
append
(
" and "
);
}
}
}
updateColumn
.
append
(
";"
);
PreparedStatement
preparedStatement
=
conn
.
prepareStatement
(
querysql
);
ResultSet
resultSet
=
preparedStatement
.
executeQuery
();
PreparedStatement
updateps
=
conn
.
prepareStatement
(
updateColumn
.
toString
());
while
(
resultSet
.
next
())
{
for
(
int
i
=
0
;
i
<
fieldlist
.
size
();
++
i
)
{
String
value
=
resultSet
.
getString
((
String
)
fieldlist
.
get
(
i
));
updateps
.
setString
(
i
+
1
,
value
);
}
for
(
int
i
=
0
;
i
<
primarykeys
.
length
;
++
i
)
{
updateps
.
setString
(
fieldlist
.
size
()
+
i
+
1
,
resultSet
.
getString
(
primarykeys
[
i
]));
}
updateps
.
addBatch
();
}
updateps
.
executeBatch
();
conn
.
commit
();
}
public
static
void
main
(
String
[]
args
)
{
BatchUpdateDateUtil
b
=
new
BatchUpdateDateUtil
();
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
();
stringStringHashMap
.
put
(
"c_name"
,
""
);
try
{
b
.
updateDateForEncryption
(
"402882057aec38c6017aec614abe0007"
,
"at_privacy"
,
stringStringHashMap
,
"id"
);
}
catch
(
ClassNotFoundException
|
SQLException
e
)
{
((
Exception
)
e
).
printStackTrace
();
}
}
}
src/main/java/com/chenyang/nse/bussiness/tools/jdbc/BeanFactory.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
jdbc
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.stereotype.Component
;
@Component
public
class
BeanFactory
implements
BeanFactoryAware
{
public
static
org
.
springframework
.
beans
.
factory
.
BeanFactory
beanFactory
;
public
void
setBeanFactory
(
org
.
springframework
.
beans
.
factory
.
BeanFactory
arg0
)
throws
BeansException
{
beanFactory
=
arg0
;
}
public
static
<
T
>
T
getBean
(
Class
<
T
>
requiredType
)
{
return
(
T
)(
beanFactory
!=
null
?
beanFactory
.
getBean
(
requiredType
)
:
null
);
}
}
src/main/java/com/chenyang/nse/bussiness/tools/logger/auditlog/AuditLogService.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
logger
.
auditlog
;
import
com.chenyang.nse.bussiness.config.PropertiesLoaderUtils
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.SocketAddress
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Properties
;
import
org.graylog2.syslog4j.server.SyslogServer
;
import
org.graylog2.syslog4j.server.SyslogServerConfigIF
;
import
org.graylog2.syslog4j.server.SyslogServerEventIF
;
import
org.graylog2.syslog4j.server.SyslogServerIF
;
import
org.graylog2.syslog4j.server.SyslogServerSessionEventHandlerIF
;
import
org.graylog2.syslog4j.server.impl.net.udp.UDPNetSyslogServerConfig
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
@Component
public
class
AuditLogService
{
protected
static
ApplicationContext
applicationContext
;
private
static
Properties
props
=
new
Properties
();
private
static
String
filepath
=
""
;
private
static
String
appAlertInterface
=
""
;
private
static
String
HOST
=
"192.168.2.232"
;
private
static
Integer
PORT
=
32376
;
private
static
final
SimpleDateFormat
SIMPLE_DATE_FORMAT
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
private
static
FileOutputStream
outputStream
=
null
;
private
void
receiveSyslogMessage
()
{
SyslogServerIF
server
=
SyslogServer
.
getInstance
(
"udp"
);
UDPNetSyslogServerConfig
udpConfig
=
(
UDPNetSyslogServerConfig
)
server
.
getConfig
();
udpConfig
.
setMaxMessageSize
(
10240
);
SyslogServerConfigIF
config
=
server
.
getConfig
();
config
.
setHost
(
HOST
);
config
.
setPort
(
PORT
);
config
.
addEventHandler
(
new
SyslogServerSessionEventHandlerIF
()
{
private
String
syslog
;
public
Object
sessionOpened
(
SyslogServerIF
syslogServerIf
,
SocketAddress
socketAddress
)
{
return
null
;
}
public
void
event
(
Object
o
,
SyslogServerIF
syslogServerIf
,
SocketAddress
socketAddress
,
SyslogServerEventIF
syslogServerEventIf
)
{
String
sendvalue
=
"{\"from\": \""
+
socketAddress
.
toString
().
replace
(
"/"
,
""
).
split
(
"\\:"
)[
0
]
+
"\",\"hostname\":\""
+
syslogServerEventIf
.
getHost
()
+
"\",\"oTime\":\""
+
new
Date
()
+
"\","
+
syslogServerEventIf
.
getMessage
().
replace
(
syslogServerEventIf
.
getHost
(),
"\"message\":"
)
+
"}\n"
;
File
file
=
new
File
(
AuditLogService
.
filepath
+
File
.
separator
+
"syslog4audit"
+
File
.
separator
+
AuditLogService
.
SIMPLE_DATE_FORMAT
.
format
(
new
Date
())
+
".txt"
);
this
.
setSyslog
(
sendvalue
);
try
{
System
.
out
.
println
(
this
.
getSyslog
());
}
catch
(
UnsupportedEncodingException
var21
)
{
System
.
err
.
println
(
"UnsupportedEncodingException"
);
}
if
(!
file
.
exists
())
{
try
{
file
.
getParentFile
().
mkdirs
();
file
.
createNewFile
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
try
{
AuditLogService
.
outputStream
=
new
FileOutputStream
(
file
,
true
);
AuditLogService
.
outputStream
.
write
(
sendvalue
.
getBytes
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
AuditLogService
.
outputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
public
String
getSyslog
()
throws
UnsupportedEncodingException
{
return
new
String
(
this
.
syslog
.
getBytes
(),
StandardCharsets
.
UTF_8
);
}
public
void
setSyslog
(
String
syslog
)
{
this
.
syslog
=
syslog
;
}
public
void
exception
(
Object
o
,
SyslogServerIF
syslogServerIf
,
SocketAddress
socketAddress
,
Exception
e
)
{
}
public
void
sessionClosed
(
Object
o
,
SyslogServerIF
syslogServerIf
,
SocketAddress
socketAddress
,
boolean
b
)
{
}
public
void
initialize
(
SyslogServerIF
syslogServerIf
)
{
}
public
void
destroy
(
SyslogServerIF
syslogServerIf
)
{
}
});
SyslogServer
.
getThreadedInstance
(
"udp"
);
}
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
(
new
AuditLogService
()).
receiveSyslogMessage
();
}
public
static
void
execute
()
throws
InterruptedException
{
(
new
AuditLogService
()).
receiveSyslogMessage
();
}
static
{
try
{
props
=
PropertiesLoaderUtils
.
loadAllProperties
(
"config.properties"
);
filepath
=
props
.
getProperty
(
"syslog4auditserverlogpath"
);
appAlertInterface
=
props
.
getProperty
(
"app_alert_interface"
);
HOST
=
props
.
getProperty
(
"s4aServerHost"
);
PORT
=
Integer
.
parseInt
(
props
.
getProperty
(
"s4aServerPost"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/com/chenyang/nse/bussiness/tools/permission/AuthUtil.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
tools
.
permission
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.setting.Setting
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
AuthUtil
{
private
static
String
fileName
=
"permission.properties"
;
public
static
String
queryByUsername
(
String
username
)
{
Setting
setting
=
new
Setting
(
fileName
,
CharsetUtil
.
CHARSET_UTF_8
,
false
);
return
setting
.
get
(
username
);
}
public
static
void
save
(
List
<
String
>
users
,
String
ruleJson
)
{
Setting
setting
=
new
Setting
(
fileName
,
CharsetUtil
.
CHARSET_UTF_8
,
false
);
users
.
forEach
((
user
)
->
setting
.
put
(
user
,
ruleJson
));
setting
.
store
(
fileName
);
}
public
static
void
delete
(
List
<
String
>
users
)
{
Setting
setting
=
new
Setting
(
fileName
,
CharsetUtil
.
CHARSET_UTF_8
,
false
);
users
.
forEach
((
user
)
->
setting
.
remove
(
user
));
setting
.
store
(
fileName
);
}
public
static
void
main
(
String
[]
args
)
{
ArrayList
arr
=
new
ArrayList
();
arr
.
add
(
"张三"
);
arr
.
add
(
"李四"
);
arr
.
add
(
"王五"
);
String
val
=
"{\"code\":\"POP_00014\",\"msg\":\"成功22。\",\"flag\":true,\"data\":{\"total\":5,\"list\":[{\"id\":\"8c7874559c9d41e785e23955327e7f86\",\"note\":\"2\",\"name\":\"11111\",\"type\":\"2\",\"sysname\":\"数据源7111\",\"business\":\"系统名称2\",\"dataAreaList\":null,\"dataRuleList\":null,\"areanum\":1,\"rulenum\":1},{\"id\":\"02488a4eb7dd46e081f5d0241a2ed4b1\",\"note\":\"2\",\"name\":\"11\",\"type\":\"2\",\"sysname\":\"数据源7\",\"business\":\"系统名称2\",\"dataAreaList\":null,\"dataRuleList\":null,\"areanum\":1,\"rulenum\":1},{\"id\":\"c874e5f455174c89b6cb2be58dd0ee9c\",\"note\":\"2\",\"name\":\"资产1222\",\"type\":\"2\",\"sysname\":\"数据源7\",\"business\":\"系统名称2\",\"dataAreaList\":null,\"dataRuleList\":null,\"areanum\":2,\"rulenum\":2},{\"id\":\"393ad07d3ed14285b409ec2fde03c9bb\",\"note\":\"2\",\"name\":\"资产122\",\"type\":\"2\",\"sysname\":\"数据源7\",\"business\":\"系统名称2\",\"dataAreaList\":null,\"dataRuleList\":null,\"areanum\":1,\"rulenum\":1},{\"id\":\"6c9164cd241944d69c9148b7bf2e8323\",\"note\":\"2\",\"name\":\"资产1\",\"type\":\"2\",\"sysname\":\"数据源7\",\"business\":\"系统名称2\",\"dataAreaList\":null,\"dataRuleList\":null,\"areanum\":1,\"rulenum\":1}]},\"total\":5,\"pages\":0,\"pageSize\":0,\"pageNum\":0}"
;
save
(
arr
,
val
);
}
}
src/main/java/com/chenyang/nse/bussiness/webtools/tools/jdbc/BlobAndBase64Util.java
0 → 100644
View file @
2b0c5343
package
com
.
chenyang
.
nse
.
bussiness
.
webtools
.
tools
.
jdbc
;
import
cn.hutool.core.codec.Base64
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.lang.reflect.Proxy
;
import
java.sql.Blob
;
import
java.sql.SQLException
;
import
org.hibernate.engine.jdbc.SerializableBlobProxy
;
public
class
BlobAndBase64Util
{
Blob
blob
;
public
static
String
getBase64InBlob
(
Object
blobDate
)
{
String
result
=
new
String
();
try
{
SerializableBlobProxy
proxy
=
(
SerializableBlobProxy
)
Proxy
.
getInvocationHandler
(
blobDate
);
Blob
realBlob
=
proxy
.
getWrappedBlob
();
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
byte
[]
buff
=
new
byte
[
100
];
int
rc
=
0
;
InputStream
binaryStream
=
realBlob
.
getBinaryStream
();
while
((
rc
=
binaryStream
.
read
(
buff
,
0
,
100
))
>
0
)
{
byteArrayOutputStream
.
write
(
buff
,
0
,
rc
);
}
byte
[]
byteArray
=
byteArrayOutputStream
.
toByteArray
();
result
=
Base64
.
encode
(
byteArray
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
public
static
String
getBase64FromBlob
(
Object
objDate
)
throws
IOException
{
String
result
=
new
String
();
Blob
blob
=
(
Blob
)
objDate
;
try
{
byte
[]
valueArr
=
null
;
if
(
null
!=
blob
)
{
valueArr
=
blob
.
getBytes
(
1L
,
(
int
)
blob
.
length
());
}
result
=
Base64
.
encode
(
valueArr
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
}
src/main/resources/sql/blobmaskingtask.xml
0 → 100644
View file @
2b0c5343
<?xml version="1.0" encoding="UTF-8"?>
<sqls>
<!-- TCoreBlobMaskingTaskDao -->
<select
id=
"queryBolbMaskingTaskVOByID"
>
select
a.taskname,
a.taskNote,
a.dataSourceid,
a.bschema,
a.tablename,
a.fieldname,
a.maskrange,
b.sysname,
b.dbtype
from t_core_blob_masking_task a
left join t_core_datasystem b on a.dataSourceid = b.id
where
a.id = :taskid
</select>
</sqls>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论