Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
2785c05f
Commit
2785c05f
authored
Jan 18, 2023
by
黄福新
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update]
1、com.wanji修改为net.wanji 2、删除Test
parent
c394b630
Changes
122
Show whitespace changes
Inline
Side-by-side
Showing
122 changed files
with
288 additions
and
3117 deletions
+288
-3117
BeanListUtils.java
...rc/main/java/net/wanji/opt/common/util/BeanListUtils.java
+3
-3
FittingFunctionUntils.java
...in/java/com/wanji/common/utils/FittingFunctionUntils.java
+0
-127
EHCacheUtil.java
...c/main/java/com/wanji/common/utils/cache/EHCacheUtil.java
+0
-408
IgniteClientCacheUtil.java
...a/com/wanji/common/utils/cache/IgniteClientCacheUtil.java
+0
-353
CookieUtil.java
...c/main/java/com/wanji/common/utils/cookie/CookieUtil.java
+0
-63
FastDfsUtils.java
...c/main/java/com/wanji/common/utils/file/FastDfsUtils.java
+0
-302
GeoWebCacheUtils.java
...ain/java/com/wanji/common/utils/geo/GeoWebCacheUtils.java
+0
-222
AESUtils.java
...in/java/com/wanji/common/utils/licenseUtils/AESUtils.java
+0
-209
DESUtils.java
...in/java/com/wanji/common/utils/licenseUtils/DESUtils.java
+0
-109
DateUtils.java
...n/java/com/wanji/common/utils/licenseUtils/DateUtils.java
+0
-47
EncoderFile.java
...java/com/wanji/common/utils/licenseUtils/EncoderFile.java
+0
-94
HardWareUtils.java
...va/com/wanji/common/utils/licenseUtils/HardWareUtils.java
+0
-239
BeanMapUtils.java
...c/main/java/com/wanji/common/utils/tool/BeanMapUtils.java
+0
-187
CamelUnderlineUtil.java
.../java/com/wanji/common/utils/tool/CamelUnderlineUtil.java
+0
-44
ConvertBaseUtils.java
...in/java/com/wanji/common/utils/tool/ConvertBaseUtils.java
+0
-63
JsonXmlUtils.java
...c/main/java/com/wanji/common/utils/tool/JsonXmlUtils.java
+0
-104
SoapUtils.java
...ain/java/com/wanji/common/utils/webservice/SoapUtils.java
+0
-76
WebServiceUtils.java
...va/com/wanji/common/utils/webservice/WebServiceUtils.java
+0
-132
TestCommon.java
wj-common/src/main/java/net/wanji/common/TestCommon.java
+0
-17
BuiltInActionLibraryUtils.java
...va/net/wanji/common/action/BuiltInActionLibraryUtils.java
+5
-5
DateAction.java
...mon/src/main/java/net/wanji/common/action/DateAction.java
+4
-4
Method.java
wj-common/src/main/java/net/wanji/common/action/Method.java
+2
-2
Parameter.java
...mmon/src/main/java/net/wanji/common/action/Parameter.java
+2
-2
SpringBean.java
...mon/src/main/java/net/wanji/common/action/SpringBean.java
+1
-1
StringAction.java
...n/src/main/java/net/wanji/common/action/StringAction.java
+4
-4
ActionBean.java
...src/main/java/net/wanji/common/annotation/ActionBean.java
+1
-1
ActionMethod.java
...c/main/java/net/wanji/common/annotation/ActionMethod.java
+1
-1
ActionMethodParameter.java
...va/net/wanji/common/annotation/ActionMethodParameter.java
+1
-1
Datatype.java
wj-common/src/main/java/net/wanji/common/enums/Datatype.java
+1
-1
FormOfWayEnum.java
...n/src/main/java/net/wanji/common/enums/FormOfWayEnum.java
+1
-1
RoadClassEnum.java
...n/src/main/java/net/wanji/common/enums/RoadClassEnum.java
+1
-1
Constants.java
...n/src/main/java/net/wanji/common/framework/Constants.java
+1
-1
HttpCode.java
...on/src/main/java/net/wanji/common/framework/HttpCode.java
+1
-1
ConfigHelper.java
.../java/net/wanji/common/framework/config/ConfigHelper.java
+4
-4
SafeProperties.java
...ava/net/wanji/common/framework/config/SafeProperties.java
+1
-1
DbFactory.java
...rc/main/java/net/wanji/common/framework/db/DbFactory.java
+7
-9
DbInterface.java
.../main/java/net/wanji/common/framework/db/DbInterface.java
+10
-16
MysqlDBImpl.java
.../java/net/wanji/common/framework/db/impl/MysqlDBImpl.java
+12
-13
OracleDBImpl.java
...java/net/wanji/common/framework/db/impl/OracleDBImpl.java
+12
-13
PostgresqlDBImpl.java
.../net/wanji/common/framework/db/impl/PostgresqlDBImpl.java
+13
-14
SQLServerDBImpl.java
...a/net/wanji/common/framework/db/impl/SQLServerDBImpl.java
+13
-14
Db.java
...n/src/main/java/net/wanji/common/framework/domain/Db.java
+1
-1
FieldName.java
...ain/java/net/wanji/common/framework/domain/FieldName.java
+1
-1
OperationLog.java
.../java/net/wanji/common/framework/domain/OperationLog.java
+1
-1
Table.java
...rc/main/java/net/wanji/common/framework/domain/Table.java
+1
-1
TileBox.java
.../main/java/net/wanji/common/framework/domain/TileBox.java
+1
-1
TrackableEntity.java
...va/net/wanji/common/framework/domain/TrackableEntity.java
+2
-3
View.java
...src/main/java/net/wanji/common/framework/domain/View.java
+1
-1
BaseDubboInterface.java
...i/common/framework/dubbointerface/BaseDubboInterface.java
+5
-5
BaseLogInterface.java
...nji/common/framework/dubbointerface/BaseLogInterface.java
+3
-3
BaseDubboInterfaceImpl.java
...framework/dubbointerface/impl/BaseDubboInterfaceImpl.java
+13
-13
BaseLogInterfaceImpl.java
...n/framework/dubbointerface/impl/BaseLogInterfaceImpl.java
+9
-9
BaseEvent.java
...main/java/net/wanji/common/framework/event/BaseEvent.java
+1
-1
DubboProviderException.java
...ji/common/framework/exception/DubboProviderException.java
+1
-1
Json2BpmnXmlException.java
...nji/common/framework/exception/Json2BpmnXmlException.java
+1
-1
NodeException.java
...a/net/wanji/common/framework/exception/NodeException.java
+1
-1
ProcessServiceException.java
...i/common/framework/exception/ProcessServiceException.java
+1
-1
RestArgumentsExceptionHandler.java
...on/framework/exception/RestArgumentsExceptionHandler.java
+2
-2
WorkFlowException.java
...t/wanji/common/framework/exception/WorkFlowException.java
+1
-1
Constants.java
.../main/java/net/wanji/common/framework/i18n/Constants.java
+1
-1
Constants_en.java
...in/java/net/wanji/common/framework/i18n/Constants_en.java
+1
-1
I18nResourceBundle.java
...a/net/wanji/common/framework/i18n/I18nResourceBundle.java
+1
-1
AbstractLog.java
...main/java/net/wanji/common/framework/log/AbstractLog.java
+7
-7
BaseInterfaceMapper.java
...et/wanji/common/framework/mapper/BaseInterfaceMapper.java
+2
-3
ExportImportMapper.java
...net/wanji/common/framework/mapper/ExportImportMapper.java
+1
-1
AbstractRestServer.java
...a/net/wanji/common/framework/rest/AbstractRestServer.java
+2
-3
BeanValidationGroups.java
...net/wanji/common/framework/rest/BeanValidationGroups.java
+1
-1
HeaderMapRequestWrapper.java
.../wanji/common/framework/rest/HeaderMapRequestWrapper.java
+1
-1
JsonViewObject.java
.../java/net/wanji/common/framework/rest/JsonViewObject.java
+3
-3
LogAbstractRestServer.java
...et/wanji/common/framework/rest/LogAbstractRestServer.java
+1
-1
MyValidator.java
...ain/java/net/wanji/common/framework/rest/MyValidator.java
+1
-1
Node.java
...n/src/main/java/net/wanji/common/framework/rest/Node.java
+1
-1
NodeDTO.java
...rc/main/java/net/wanji/common/framework/rest/NodeDTO.java
+1
-2
Page.java
...n/src/main/java/net/wanji/common/framework/rest/Page.java
+1
-1
ValidationGroups.java
...ava/net/wanji/common/framework/rest/ValidationGroups.java
+2
-2
AbstractRestServerImpl.java
...ji/common/framework/rest/impl/AbstractRestServerImpl.java
+12
-12
LogAbstractRestServerImpl.java
...common/framework/rest/impl/LogAbstractRestServerImpl.java
+6
-11
ServiceBeanContext.java
...net/wanji/common/framework/spring/ServiceBeanContext.java
+1
-1
NamedThreadFactory.java
...net/wanji/common/framework/thread/NamedThreadFactory.java
+1
-1
DBUtils.java
.../src/main/java/net/wanji/common/tool/dbtools/DBUtils.java
+8
-8
DSPool.java
...n/src/main/java/net/wanji/common/tool/dbtools/DSPool.java
+1
-1
DSUtils.java
.../src/main/java/net/wanji/common/tool/dbtools/DSUtils.java
+20
-20
MySQL.java
...on/src/main/java/net/wanji/common/tool/dbtools/MySQL.java
+2
-2
Oracle.java
...n/src/main/java/net/wanji/common/tool/dbtools/Oracle.java
+2
-2
PostgreSQL.java
...c/main/java/net/wanji/common/tool/dbtools/PostgreSQL.java
+2
-2
SQLServer.java
...rc/main/java/net/wanji/common/tool/dbtools/SQLServer.java
+2
-2
AddFunction.java
...c/main/java/net/wanji/common/tool/drools/AddFunction.java
+1
-1
AviatorTool.java
...c/main/java/net/wanji/common/tool/drools/AviatorTool.java
+3
-3
AviatorUtils.java
.../main/java/net/wanji/common/tool/drools/AviatorUtils.java
+2
-2
DroolsTool.java
...rc/main/java/net/wanji/common/tool/drools/DroolsTool.java
+4
-4
DroolsUtils.java
...c/main/java/net/wanji/common/tool/drools/DroolsUtils.java
+2
-2
EsConfiguration.java
...in/java/net/wanji/common/tool/estool/EsConfiguration.java
+2
-2
EsProperties.java
.../main/java/net/wanji/common/tool/estool/EsProperties.java
+1
-2
EsUtil.java
...on/src/main/java/net/wanji/common/tool/estool/EsUtil.java
+1
-1
HttpsClient.java
...src/main/java/net/wanji/common/tool/http/HttpsClient.java
+1
-1
JobTool.java
.../src/main/java/net/wanji/common/tool/jobtool/JobTool.java
+1
-1
RetryTemplate.java
...ain/java/net/wanji/common/tool/jobtool/RetryTemplate.java
+1
-1
KafkaUtil.java
.../main/java/net/wanji/common/tool/kafkatool/KafkaUtil.java
+1
-8
MqUtil.java
...on/src/main/java/net/wanji/common/tool/mqtool/MqUtil.java
+5
-5
OperationMonitorUtil.java
...net/wanji/common/tool/nginxtool/OperationMonitorUtil.java
+2
-2
RedisUtil.java
.../main/java/net/wanji/common/tool/redistool/RedisUtil.java
+1
-1
HttpComponentsClientRestfulHttpRequestFactory.java
...sttool/HttpComponentsClientRestfulHttpRequestFactory.java
+1
-1
RestTemplateConfiguration.java
...wanji/common/tool/resttool/RestTemplateConfiguration.java
+1
-1
RestTemplateTool.java
...java/net/wanji/common/tool/resttool/RestTemplateTool.java
+2
-2
DoSoapTool.java
.../main/java/net/wanji/common/tool/wsdltool/DoSoapTool.java
+1
-1
WebSocketUtil.java
...main/java/net/wanji/common/tool/wstool/WebSocketUtil.java
+1
-3
FileUtil.java
...n/src/main/java/net/wanji/common/utils/file/FileUtil.java
+1
-1
XFileUtils.java
...src/main/java/net/wanji/common/utils/file/XFileUtils.java
+1
-1
GeometryUtils.java
...c/main/java/net/wanji/common/utils/geo/GeometryUtils.java
+1
-3
MailUtils.java
.../src/main/java/net/wanji/common/utils/mail/MailUtils.java
+3
-3
CsvUtils.java
...n/src/main/java/net/wanji/common/utils/tool/CsvUtils.java
+1
-1
DateUtil.java
...n/src/main/java/net/wanji/common/utils/tool/DateUtil.java
+3
-3
EncryptUtil.java
...rc/main/java/net/wanji/common/utils/tool/EncryptUtil.java
+1
-1
ExcelUtils.java
...src/main/java/net/wanji/common/utils/tool/ExcelUtils.java
+1
-1
GroovyUtil.java
...src/main/java/net/wanji/common/utils/tool/GroovyUtil.java
+1
-1
IDGenerator.java
...rc/main/java/net/wanji/common/utils/tool/IDGenerator.java
+1
-1
JsonUtil.java
...n/src/main/java/net/wanji/common/utils/tool/JsonUtil.java
+4
-4
MD5Util.java
...on/src/main/java/net/wanji/common/utils/tool/MD5Util.java
+1
-1
PageUtil.java
...n/src/main/java/net/wanji/common/utils/tool/PageUtil.java
+1
-1
StringUtils.java
...rc/main/java/net/wanji/common/utils/tool/StringUtils.java
+1
-1
WebCxt.java
...mon/src/main/java/net/wanji/common/utils/tool/WebCxt.java
+1
-1
BaseModel.java
wj-common/src/main/java/net/wanji/structure/BaseModel.java
+1
-1
No files found.
wj-common/src/main/java/com/wanji/common/utils/too
l/BeanListUtils.java
→
signal-optimize-service/src/main/java/net/wanji/opt/common/uti
l/BeanListUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
too
l
;
package
net
.
wanji
.
opt
.
common
.
uti
l
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
...
...
@@ -8,8 +8,8 @@ import java.util.List;
/**
* @ClassName BeanListUtils
* @Description
* @Author
mapabc7
* @Date 202
0/6/30 17:54
* @Author
* @Date 202
2/01/17 10:08
* @Version 1.0
*/
public
class
BeanListUtils
{
...
...
wj-common/src/main/java/com/wanji/common/utils/FittingFunctionUntils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wanji.common.utils.geo.GeometryUtils
;
import
org.locationtech.jts.geom.Geometry
;
import
org.geotools.geojson.GeoJSON
;
import
org.geotools.geojson.geom.GeometryJSON
;
import
org.locationtech.jts.geom.*
;
import
org.locationtech.jts.io.ParseException
;
import
org.locationtech.jts.io.WKTReader
;
import
java.io.IOException
;
import
java.io.Reader
;
import
java.io.StringReader
;
import
java.io.StringWriter
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
FittingFunctionUntils
{
private
static
final
GeometryFactory
geometryFactory
=
new
GeometryFactory
();
public
static
LineString
calculateLineString
(
String
wkt
,
int
precision
)
{
WKTReader
reader
=
new
WKTReader
(
geometryFactory
);
LineString
line
=
null
;
try
{
line
=
(
LineString
)
reader
.
read
(
wkt
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
//LineString lineByWKT = GeometryUtils.createLineByWKT(wkt);
return
calculateLineString
(
line
,
precision
);
}
public
static
LineString
calculateLineString
(
LineString
lineString
,
int
precision
)
{
double
[][]
points
=
new
double
[
lineString
.
getNumPoints
()][
2
];
Coordinate
[]
coordinates
=
lineString
.
getCoordinates
();
for
(
int
i
=
0
;
i
<
coordinates
.
length
;
i
++)
{
Coordinate
coordinate
=
coordinates
[
i
];
points
[
i
][
0
]
=
coordinate
.
x
;
points
[
i
][
1
]
=
coordinate
.
y
;
}
double
[][]
calculate
=
calculate
(
points
,
precision
);
Coordinate
[]
coordinatesNew
=
new
Coordinate
[
calculate
.
length
+
1
];
for
(
int
i
=
0
;
i
<
calculate
.
length
;
i
++)
{
coordinatesNew
[
i
]
=
new
Coordinate
(
calculate
[
i
][
0
],
calculate
[
i
][
1
]);
}
coordinatesNew
[
calculate
.
length
]
=
lineString
.
getEndPoint
().
getCoordinate
();
return
geometryFactory
.
createLineString
(
coordinatesNew
);
}
public
static
double
[][]
calculate
(
List
<
String
>
list
,
int
precision
)
{
double
[][]
points
=
new
double
[
list
.
size
()][
2
];
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
String
point
=
(
String
)
list
.
get
(
i
);
String
[]
split
=
point
.
split
(
","
);
points
[
i
][
0
]
=
Double
.
parseDouble
(
split
[
0
]);
points
[
i
][
1
]
=
Double
.
parseDouble
(
split
[
1
]);
}
return
calculate
(
points
,
precision
);
}
public
static
double
[][]
calculate
(
double
[][]
poss
,
int
precision
)
{
int
dimersion
=
poss
[
0
].
length
;
int
number
=
poss
.
length
;
if
((
number
<
2
)
||
(
dimersion
<
2
))
{
return
(
double
[][])
null
;
}
double
[][]
result
=
new
double
[
precision
][
dimersion
];
int
[]
mi
=
new
int
[
number
];
int
tmp43_42
=
1
;
mi
[
1
]
=
tmp43_42
;
mi
[
0
]
=
tmp43_42
;
for
(
int
i
=
3
;
i
<=
number
;
i
++)
{
int
[]
t
=
new
int
[
i
-
1
];
for
(
int
j
=
0
;
j
<
t
.
length
;
j
++)
t
[
j
]
=
mi
[
j
];
int
tmp100_99
=
1
;
mi
[(
i
-
1
)]
=
tmp100_99
;
mi
[
0
]
=
tmp100_99
;
for
(
int
j
=
0
;
j
<
i
-
2
;
j
++)
{
mi
[(
j
+
1
)]
=
(
t
[
j
]
+
t
[(
j
+
1
)]);
}
}
for
(
int
i
=
0
;
i
<
precision
;
i
++)
{
double
t
=
new
BigDecimal
(
i
+
""
).
divide
(
new
BigDecimal
(
precision
+
""
),
80
,
0
).
doubleValue
();
for
(
int
j
=
0
;
j
<
dimersion
;
j
++)
{
double
temp
=
0.0
D
;
for
(
int
k
=
0
;
k
<
number
;
k
++)
{
temp
+=
Math
.
pow
(
1.0
D
-
t
,
number
-
k
-
1
)
*
poss
[
k
][
j
]
*
Math
.
pow
(
t
,
k
)
*
mi
[
k
];
}
result
[
i
][
j
]
=
temp
;
}
}
return
result
;
}
public
static
void
main
(
String
[]
args
){
LineString
lineString
=
FittingFunctionUntils
.
calculateLineString
(
"LINESTRING(118.700421223022 37.4278045360367,118.700798456007 37.4278045360367,118.700798456007 37.4276183268811)"
,
10
);
String
json
=
null
;
try
{
org
.
locationtech
.
jts
.
io
.
WKTReader
reader
=
new
org
.
locationtech
.
jts
.
io
.
WKTReader
();
Geometry
geometry
=
reader
.
read
(
lineString
.
toText
());
StringWriter
writer
=
new
StringWriter
();
GeometryJSON
g
=
new
GeometryJSON
(
20
);
g
.
write
(
geometry
,
writer
);
json
=
writer
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
json
);
}
}
wj-common/src/main/java/com/wanji/common/utils/cache/EHCacheUtil.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
cache
;
import
com.wanji.common.utils.tool.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.ehcache.Cache
;
import
net.sf.ehcache.CacheManager
;
import
net.sf.ehcache.Element
;
import
net.sf.ehcache.config.CacheConfiguration
;
import
java.util.List
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
igniteCacheName
.
BP_DESIGN_CACHE
;
/**
* EHCache工具类
*
* @author wanshan.hu
*/
@Slf4j
public
class
EHCacheUtil
{
/**
* 元素最大数量
*/
private
static
final
int
MAX_ELEMENTS_IN_MEMORY
=
50000
;
/**
* 是否把溢出数据持久化到硬盘
*/
private
static
final
boolean
OVERFLOW_TO_DISK
=
false
;
/**
* 是否会死亡
*/
private
static
final
boolean
ETERNAL
=
false
;
/**
* 缓存的间歇时间
*/
private
static
final
int
TIME_TO_IDLE_SECONDS
=
0
;
/**
* 存活时间(默认一天86400)
*/
private
static
final
int
TIME_TO_LIVE_SECONDS
=
0
;
/**
* 需要持久化到硬盘否
*/
public
static
final
boolean
DISK_PERSISTENT
=
false
;
/**
* 内存存取策略
*/
public
static
final
String
MEMORY_STORE_EVICTION_POLICY
=
"LFU"
;
private
static
CacheManager
cacheManager
=
null
;
static
{
EHCacheUtil
.
initCacheManager
();
}
/**
* 初始化缓存管理容器
*/
private
static
void
initCacheManager
()
{
try
{
if
(
cacheManager
==
null
)
{
cacheManager
=
CacheManager
.
getInstance
();
}
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil initCacheManager error."
,
e
);
}
}
/**
* 初始化cache
*/
public
static
Cache
initCache
(
String
cacheName
)
throws
Exception
{
return
initCache
(
cacheName
,
0
);
}
/**
* 初始化cache
*
* @param cacheName cache的名字
* @param timeToLiveSeconds 有效时间
* @return cache 缓存
* @throws Exception
*/
public
static
Cache
initCache
(
String
cacheName
,
long
timeToLiveSeconds
)
throws
Exception
{
return
initCache
(
cacheName
,
MAX_ELEMENTS_IN_MEMORY
,
OVERFLOW_TO_DISK
,
ETERNAL
,
timeToLiveSeconds
,
TIME_TO_IDLE_SECONDS
);
}
/**
* 初始化缓存
*
* @param cacheName 缓存名称
* @param maxElementsInMemory 元素最大数量
* @param overflowToDisk 是否持久化到硬盘
* @param eternal 是否会死亡
* @param timeToLiveSeconds 缓存存活时间
* @param timeToIdleSeconds 缓存的间隔时间
* @return 缓存
* @throws Exception
*/
private
static
Cache
initCache
(
String
cacheName
,
int
maxElementsInMemory
,
boolean
overflowToDisk
,
boolean
eternal
,
long
timeToLiveSeconds
,
long
timeToIdleSeconds
)
throws
Exception
{
checkCacheManager
();
Cache
cache
;
try
{
cache
=
getCache
(
cacheName
);
if
(
cache
==
null
)
{
Cache
memoryOnlyCache
=
new
Cache
(
cacheName
,
maxElementsInMemory
,
overflowToDisk
,
eternal
,
timeToLiveSeconds
,
timeToIdleSeconds
);
cacheManager
.
addCache
(
memoryOnlyCache
);
cache
=
getCache
(
cacheName
);
}
else
{
CacheConfiguration
config
=
cache
.
getCacheConfiguration
();
config
.
setTimeToLiveSeconds
(
timeToLiveSeconds
);
config
.
setMaxEntriesLocalHeap
(
maxElementsInMemory
);
config
.
setOverflowToDisk
(
overflowToDisk
);
config
.
setEternal
(
eternal
);
config
.
setTimeToIdleSeconds
(
timeToIdleSeconds
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil initCache {} error."
,
cacheName
,
e
);
throw
new
Exception
(
"CacheName:"
+
cacheName
+
"创建失败!"
);
}
return
cache
;
}
/**
* 释放CacheManager
*/
public
static
void
shutdown
()
{
cacheManager
.
shutdown
();
}
/**
* 修改缓存容器配置
*
* @param cacheName 缓存名
* @param timeToLiveSeconds 有效时间
* @param maxElementsInMemory 最大数量
* @throws Exception
*/
public
static
boolean
modifyCache
(
String
cacheName
,
long
timeToLiveSeconds
,
int
maxElementsInMemory
)
throws
Exception
{
try
{
if
(
StringUtils
.
isNotBlank
(
cacheName
)
&&
timeToLiveSeconds
!=
0L
&&
maxElementsInMemory
!=
0
)
{
CacheManager
myManager
=
CacheManager
.
create
();
Cache
myCache
=
myManager
.
getCache
(
cacheName
);
CacheConfiguration
config
=
myCache
.
getCacheConfiguration
();
config
.
setTimeToLiveSeconds
(
timeToLiveSeconds
);
config
.
setMaxEntriesLocalHeap
(
maxElementsInMemory
);
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil modifyCache {} error."
,
cacheName
,
e
);
throw
new
Exception
(
"modify cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 向指定容器中设置值
*
* @param cacheName 容器名
* @param key 键
* @param value 值
* @return 返回真
* @throws Exception 异常
*/
public
static
boolean
setValue
(
String
cacheName
,
String
key
,
Object
value
)
throws
Exception
{
checkCacheManager
();
try
{
Cache
cache
=
getCache
(
cacheName
);
if
(
cache
==
null
)
{
cache
=
initCache
(
cacheName
);
}
cache
.
put
(
new
Element
(
key
,
value
));
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil setValue error, cacheName = {}, key = {}, value = {}."
,
cacheName
,
key
,
value
,
e
);
throw
new
Exception
(
"set cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 向指定容器中设置值
*
* @param cacheName 容器名
* @param key 键
* @param value 值
* @param timeToLiveSeconds 存活时间
* @return 真
* @throws Exception 抛出异常
*/
public
static
boolean
setValue
(
String
cacheName
,
String
key
,
Object
value
,
Integer
timeToLiveSeconds
)
throws
Exception
{
checkCacheManager
();
try
{
Cache
cache
=
getCache
(
cacheName
);
if
(
cache
==
null
)
{
cache
=
initCache
(
cacheName
);
}
cache
.
put
(
new
Element
(
key
,
value
,
TIME_TO_IDLE_SECONDS
,
timeToLiveSeconds
));
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil setValue error, cacheName = {}, key = {}, value = {}."
,
cacheName
,
key
,
value
,
e
);
throw
new
Exception
(
"EHCacheUtil setValue error, cacheName = "
+
cacheName
+
", key = "
+
key
+
", value = "
+
value
,
e
);
}
}
/**
* 从ehcache的指定容器中取值
*
* @param key 键
* @return 返回Object类型的值
*/
public
static
Object
getValue
(
String
cacheName
,
String
key
)
{
checkCacheManager
();
Object
object
=
null
;
try
{
Cache
cache
=
getCache
(
cacheName
);
if
(
cache
==
null
)
{
cache
=
initMyCache
(
cacheName
);
}
if
(
cache
.
get
(
key
)
!=
null
)
{
object
=
cache
.
get
(
key
).
getObjectValue
();
}
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil setValue error, cacheName = {}, key = {}."
,
cacheName
,
key
,
e
);
//throw new Exception("EHCacheUtil setValue error, cacheName = " + cacheName + ", key = " + key, e);
}
return
object
;
}
private
static
Cache
getCache
(
String
cacheName
)
{
checkCacheManager
();
return
cacheManager
.
getCache
(
cacheName
);
}
private
static
Cache
initMyCache
(
String
cacheName
)
throws
Exception
{
return
EHCacheUtil
.
initCache
(
cacheName
,
TIME_TO_LIVE_SECONDS
);
}
/**
* 删除EHCache容器中的元素
*
* @param cacheName 容器名
* @param key 键
* @return 真
* @throws Exception 失败抛出异常
*/
public
static
boolean
removeElement
(
String
cacheName
,
String
key
)
throws
Exception
{
checkCacheManager
();
try
{
Cache
cache
=
getCache
(
cacheName
);
cache
.
remove
(
key
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil removeElement error, cacheName = {}, key = {}."
,
cacheName
,
key
,
e
);
throw
new
Exception
(
"remove cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 删除指定容器中的所有元素
*
* @param cacheName 容器名
* @return 真
* @throws Exception 失败抛出异常
*/
public
static
boolean
removeAllElement
(
String
cacheName
)
throws
Exception
{
checkCacheManager
();
try
{
Cache
cache
=
getCache
(
cacheName
);
cache
.
removeAll
();
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"EHCacheUtil removeAllElement error, cacheName = {}."
,
cacheName
,
e
);
throw
new
Exception
(
"remove cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 移除cache
*
* @param cacheName
*/
public
static
void
removeCache
(
String
cacheName
)
{
checkCacheManager
();
Cache
cache
=
getCache
(
cacheName
);
if
(
null
!=
cache
)
{
cacheManager
.
removeCache
(
cacheName
);
}
}
/**
* 移除所有cache
*/
public
static
void
removeAllCache
()
{
checkCacheManager
();
cacheManager
.
removeAllCaches
();
}
public
static
void
removeValue
(
String
cacheName
,
String
key
)
{
Cache
cache
=
getCache
(
cacheName
);
checkCache
(
cache
);
cache
.
remove
(
key
);
}
public
static
void
removeAllValue
(
String
cacheName
)
{
removeAllValue
(
getCache
(
cacheName
));
}
/**
* 移除所有Element
*/
private
static
void
removeAllValue
(
Cache
cache
)
{
checkCache
(
cache
);
cache
.
removeAll
();
}
/**
* 获取所有的cache名称
*
* @return
*/
public
static
String
[]
getAllCaches
()
{
checkCacheManager
();
return
cacheManager
.
getCacheNames
();
}
/**
* 获取Cache所有的Keys
*
* @param cacheName
* @return
*/
public
static
List
getKeys
(
String
cacheName
)
{
return
getKeys
(
getCache
(
cacheName
));
}
private
static
List
getKeys
(
Cache
cache
)
{
checkCache
(
cache
);
return
cache
.
getKeys
();
}
/**
* 检测cacheManager
*/
private
static
void
checkCacheManager
()
{
if
(
null
==
cacheManager
)
{
throw
new
IllegalArgumentException
(
"调用前请先初始化CacheManager值:EHCacheUtil.initCacheManager"
);
}
}
private
static
void
checkCache
(
Cache
cache
)
{
if
(
null
==
cache
)
{
throw
new
IllegalArgumentException
(
"调用前请先初始化Cache值:EHCacheUtil.initCache(参数)"
);
}
}
/**
* @return void
* @throws
* @Author mapabc7
* @Description 更新缓存
* @Date 16:41 2020/7/3
* @Param [id, obj]
*/
public
static
void
saveCache
(
String
id
,
Object
obj
)
throws
Exception
{
EHCacheUtil
.
setValue
(
BP_DESIGN_CACHE
,
id
,
obj
);
}
/*public static void main(String[] arg) {
// 初始化--必须
*//*try {
EHCacheUtil.setValue("dataAccessCahe", "name", "12121");
String nn = EHCacheUtil.getValue("dataAccessCahe", "name").toString();
System.out.println(nn);
} catch (Exception e) {
e.printStackTrace();
}*//*
System.out.println(new Date().getTime());
initCacheManager();
String cacheName = "testCache";
System.out.println(new Date().getTime()); // 1594290889200 1594290962412
for (int i = 0; i < 100000; i++) { // 1594715074241
try {
setValue(cacheName, String.valueOf(i), i);
} catch (Exception e) {
log.error("setValue error" + i, e);
}
}
System.out.println(new Date().getTime()); // 1594290891526 1594290964803
for (int i = 0; i < 100000; i++) { // 1594715074382
try {
getValue(cacheName, String.valueOf(i));
// Object value = getValue(cacheName, String.valueOf(i));
// System.out.println(value);
} catch (Exception e) {
log.error("getValue error" + i, e);
}
}
System.out.println(new Date().getTime()); // 1594290894087 1594290967215
} // 1594715074432*/
}
wj-common/src/main/java/com/wanji/common/utils/cache/IgniteClientCacheUtil.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
cache
;
import
com.wanji.common.framework.spring.ServiceBeanContext
;
import
com.wanji.common.utils.tool.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ignite.Ignition
;
import
org.apache.ignite.cache.CacheAtomicityMode
;
import
org.apache.ignite.cache.CacheMode
;
import
org.apache.ignite.cache.PartitionLossPolicy
;
import
org.apache.ignite.cache.query.ScanQuery
;
import
org.apache.ignite.client.ClientCache
;
import
org.apache.ignite.client.ClientCacheConfiguration
;
import
org.apache.ignite.client.ClientException
;
import
org.apache.ignite.client.IgniteClient
;
import
org.apache.ignite.configuration.ClientConfiguration
;
import
javax.cache.expiry.CreatedExpiryPolicy
;
import
javax.cache.expiry.Duration
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
igniteCacheName
.
BP_DESIGN_CACHE
;
/**
* @ClassName IgniteClientCacheUtil
* @Description ignite 缓存 工具类
* @Author mapabc7
* @Date 2020/7/9 15:15
* @Version 1.0
*/
@Slf4j
public
class
IgniteClientCacheUtil
{
private
static
String
addresses
=
ServiceBeanContext
.
getContext
().
getEnvironment
().
getProperty
(
"ignite-client.address"
);
//private static String addresses = "121.36.56.157:10800";
private
static
IgniteClient
igniteClient
=
null
;
static
{
IgniteClientCacheUtil
.
initIgniteClient
();
}
/**
* 初始化缓存管理容器
*/
private
static
void
initIgniteClient
()
{
try
{
if
(
igniteClient
==
null
)
{
igniteClient
=
Ignition
.
startClient
(
getClientConfiguration
());
log
.
info
(
"IgniteClientCacheUtil initIgniteClient success"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil initIgniteClient error."
,
e
);
}
}
/**
* 初始化缓存
*/
public
static
ClientCache
<
String
,
Object
>
initCache
(
String
cacheName
)
throws
Exception
{
log
.
info
(
"IgniteClientCacheUtil initCache , cacheName : {}"
,
cacheName
);
return
IgniteClientCacheUtil
.
getCache
(
cacheName
);
}
/**
* 初始化缓存
*/
public
static
ClientCache
<
String
,
Object
>
initCache
(
String
cacheName
,
Long
expireTime
)
throws
Exception
{
log
.
info
(
"IgniteClientCacheUtil initCache , cacheName : {} ,expire :{} "
,
cacheName
,
expireTime
);
return
IgniteClientCacheUtil
.
getCache
(
cacheName
,
expireTime
);
}
private
static
ClientConfiguration
getClientConfiguration
()
{
log
.
info
(
"IgniteClientCacheUtil getClientConfiguration , addresses : {}"
,
addresses
);
ClientConfiguration
configuration
=
new
ClientConfiguration
();
configuration
.
setAddresses
(
addresses
);
return
configuration
;
}
/**
* 检测 igniteClient
*/
private
static
void
checkIgniteClient
()
{
if
(
null
==
igniteClient
)
{
throw
new
IllegalArgumentException
(
"调用前请先初始化 IgniteClient 值:IgniteClientCacheUtil.checkIgniteClient"
);
}
}
/**
* 向指定容器中设置值
*
* @param cacheName 容器名
* @param key 键
* @param value 值
* @return 返回真
* @throws Exception 异常
*/
public
static
boolean
setValue
(
String
cacheName
,
String
key
,
Object
value
)
throws
Exception
{
checkIgniteClient
();
try
{
log
.
info
(
"IgniteClientCacheUtil setValue , cacheName : {} , key : {} , value : {}"
,
cacheName
,
key
,
value
);
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
if
(
StringUtils
.
isBlank
(
key
))
{
throw
new
Exception
(
"IgniteClientCacheUtil setValue , key == null"
);
}
cache
.
put
(
key
,
value
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil setValue error, cacheName = {}, key = {}, value = {}."
,
cacheName
,
key
,
value
,
e
);
throw
new
Exception
(
"set cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 从ehcache的指定容器中取值
*
* @param key 键
* @return 返回Object类型的值
*/
public
static
Object
getValue
(
String
cacheName
,
String
key
)
throws
Exception
{
checkIgniteClient
();
Object
object
=
null
;
try
{
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
if
(
StringUtils
.
isNotBlank
(
key
))
{
object
=
cache
.
get
(
key
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil getValue error, cacheName = {}, key = {}."
,
cacheName
,
key
,
e
);
throw
new
Exception
(
"IgniteClientCacheUtil getValue error, cacheName = "
+
cacheName
+
", key = "
+
key
,
e
);
}
return
object
;
}
/**
* 获取Cache所有的Keys
*
* @param cacheName
* @return
*/
public
static
List
<
String
>
getKeys
(
String
cacheName
)
throws
Exception
{
log
.
info
(
"IgniteClientCacheUtil getKeys , cacheName : {}"
,
cacheName
);
return
getKeys
(
getCache
(
cacheName
));
}
/**
* 获取Keys下的所有值
*
* @param cacheName
* @param keys
* @return
* @throws Exception
*/
public
static
List
<
Object
>
getValues
(
String
cacheName
,
List
<
String
>
keys
)
throws
Exception
{
log
.
info
(
"IgniteClientCacheUtil getValues ,keys :{} "
,
keys
.
toArray
());
checkIgniteClient
();
List
<
Object
>
values
=
new
ArrayList
<>();
keys
.
forEach
(
key
->
{
try
{
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
if
(
StringUtils
.
isNotBlank
(
key
))
{
values
.
add
(
cache
.
get
(
key
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil getValue error, cacheName = {}, key = {}."
,
cacheName
,
key
,
e
);
}
});
return
values
;
}
private
static
List
<
String
>
getKeys
(
ClientCache
<
String
,
Object
>
cache
)
{
checkIgniteClient
();
List
<
String
>
keys
=
new
ArrayList
<>();
cache
.
query
(
new
ScanQuery
<>(
null
)).
forEach
(
entry
->
keys
.
add
((
String
)
entry
.
getKey
()));
return
keys
;
}
private
static
ClientCache
<
String
,
Object
>
getCache
(
String
cacheName
)
throws
Exception
{
checkIgniteClient
();
if
(
StringUtils
.
isBlank
(
cacheName
))
{
throw
new
Exception
(
"IgniteClientCacheUtil getCache , cacheName == null"
);
}
ClientCacheConfiguration
configuration
=
new
ClientCacheConfiguration
();
configuration
.
setName
(
cacheName
);
configuration
.
setCacheMode
(
CacheMode
.
REPLICATED
);
configuration
.
setPartitionLossPolicy
(
PartitionLossPolicy
.
READ_ONLY_SAFE
);
configuration
.
setAtomicityMode
(
CacheAtomicityMode
.
TRANSACTIONAL
);
return
igniteClient
.
getOrCreateCache
(
configuration
);
}
private
static
ClientCache
<
String
,
Object
>
getCache
(
String
cacheName
,
Long
expireTime
)
throws
Exception
{
checkIgniteClient
();
if
(
StringUtils
.
isBlank
(
cacheName
))
{
throw
new
Exception
(
"IgniteClientCacheUtil getCache , cacheName == null"
);
}
ClientCacheConfiguration
configuration
=
new
ClientCacheConfiguration
();
configuration
.
setName
(
cacheName
);
configuration
.
setCacheMode
(
CacheMode
.
REPLICATED
);
configuration
.
setExpiryPolicy
(
CreatedExpiryPolicy
.
factoryOf
(
new
Duration
(
TimeUnit
.
SECONDS
,
expireTime
)).
create
());
configuration
.
setPartitionLossPolicy
(
PartitionLossPolicy
.
READ_ONLY_SAFE
);
configuration
.
setAtomicityMode
(
CacheAtomicityMode
.
TRANSACTIONAL
);
return
igniteClient
.
getOrCreateCache
(
configuration
);
}
/**
* 删除 ignite client cache 中的 key
*
* @param cacheName 容器名
* @param key 键
* @return 真
* @throws Exception 失败抛出异常
*/
public
static
boolean
removeKey
(
String
cacheName
,
String
key
)
throws
Exception
{
checkIgniteClient
();
try
{
log
.
info
(
"IgniteClientCacheUtil removeKey , cacheName : {} , key : {}"
,
cacheName
,
key
);
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
cache
.
remove
(
key
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil removeKey error, cacheName = {}, key = {}."
,
cacheName
,
key
,
e
);
throw
new
Exception
(
"remove cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 删除 ignite client cache 中 包含 containsKey 的 key
*
* @param cacheName 容器名
* @param containsKey 键
* @return 真
* @throws Exception 失败抛出异常
*/
public
static
boolean
removeContainsKey
(
String
cacheName
,
String
containsKey
)
throws
Exception
{
checkIgniteClient
();
try
{
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
List
<
String
>
keys
=
IgniteClientCacheUtil
.
getKeys
(
cache
);
for
(
String
key
:
keys
)
{
if
(
key
.
contains
(
containsKey
))
{
cache
.
remove
(
key
);
log
.
info
(
"IgniteClientCacheUtil removeKey , cacheName : {} , key : {}"
,
cacheName
,
key
);
}
}
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil removeKey error, cacheName = {}, containsKey = {}."
,
cacheName
,
containsKey
,
e
);
throw
new
Exception
(
"remove cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 删除 ignite client cache 中所有的 key
*
* @param cacheName 容器名
* @return 真
* @throws Exception 失败抛出异常
*/
public
static
boolean
removeAllKey
(
String
cacheName
)
throws
Exception
{
checkIgniteClient
();
try
{
log
.
info
(
"IgniteClientCacheUtil removeAllKey , cacheName : {}"
,
cacheName
);
ClientCache
<
String
,
Object
>
cache
=
getCache
(
cacheName
);
cache
.
removeAll
();
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"IgniteClientCacheUtil removeAllKey error, cacheName = {}."
,
cacheName
,
e
);
throw
new
Exception
(
"remove cache "
+
cacheName
+
" failed!!!"
);
}
}
/**
* 移除cache
*
* @param cacheName
*/
public
static
void
removeCache
(
String
cacheName
)
{
checkIgniteClient
();
log
.
info
(
"IgniteClientCacheUtil removeCache , cacheName : {}"
,
cacheName
);
try
{
igniteClient
.
destroyCache
(
cacheName
);
}
catch
(
ClientException
e
)
{
log
.
info
(
"IgniteClientCacheUtil removeCache , cacheName : {} Cache does not exist "
,
cacheName
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
cacheName
=
"VECTOR_TILE"
;
IgniteClientCacheUtil
.
initCache
(
cacheName
);
IgniteClientCacheUtil
.
removeAllKey
(
cacheName
);
// removeKey(cacheName, "92460E87D880442E951A95026856590F");
/*try {
setValue(cacheName, "test", "test");
} catch (Exception e) {
log.error("setValue error", e);
}
try {
System.out.println(getValue(cacheName, "test"));
} catch (Exception e) {
log.error("getValue error", e);
}
System.out.println(new Date().getTime()); // 1594290889200 1594290962412
for (int i = 0; i < 10000; i++) {
try {
setValue(cacheName, String.valueOf(i), i);
} catch (Exception e) {
log.error("setValue error" + i, e);
}
}
System.out.println(new Date().getTime()); // 1594290891526 1594290964803
for (int i = 0; i < 10000; i++) {
try {
getValue(cacheName, String.valueOf(i));
// Object value = getValue(cacheName, String.valueOf(i));
// System.out.println(value);
} catch (Exception e) {
log.error("getValue error" + i, e);
}
}
System.out.println(new Date().getTime()); // 1594290894087 1594290967215*/
}
/*
* CacheMode 缓存操作模式
* PARTITIONED 分区模式:所有数据均匀分布在每个节点上,默认的模式
* REPLICATED 复制模式:所有数据复制到每个节点上,每一个节点都保存其他节点的备份
* LOCAL 本地模式
*
* PartitionLossPolicy 分区丢失策略
* READ_ONLY_SAFE:所有缓存/表的写操作都会抛出异常,在线分区的读操作是可以的,丢失分区的读操作会抛出异常;
READ_ONLY_ALL:包括丢失分区在内的所有分区都是可以读的,所有分区的写操作都会抛出异常,从丢失的分区读取数据的结果是未定义的,而且不同的节点返回结果可能不同;
READ_WRITE_SAFE:在线分区的读写都是可以的,丢失分区的读写操作都会抛出异常;
READ_WRITE_ALL:所有的读写都会继续进行,就像所有分区都处于一致状态那样(就像没有分区丢失),从丢失分区的读操作是未定义的,并且不同节点返回结果可能不同;
IGNORE:该模式不会标记丢失的分区为丢失状态,假定没有发生分区丢失,并且立即清除分区丢失状态。从技术上来说,分区不会被加入lostPartitions列表,这是与READ_WRITE_ALL模式的主要区别。从丢失的分区读取数据的结果是未定义的,而且不同的节点返回结果可能不同,IGNORE模式为默认模式。
*
* writeSynchronizationMode 写同步模式
* FULL_SYNC 客户端节点要等待所有相关远程节点的写入或者提交完成(主和备)。
FULL_ASYNC 客户端不需要等待参与节点的响应。这时远程节点可能会在任何缓存写入方法完成或Transaction.commit()方法完成后稍微更新其状态。
PRIMARY_SYNC 这是默认模式,客户端节点会等待主节点的写或者提交完成,但不会等待备份节点的更新完成。
*
* 主备副本 backups
* 在PARTITIONED模式下,数据的主键归属的节点叫做这些主键的主节点,对于缓存的数据,也可以可选地配置任意多个备份节点。如果副本数量大于0,那么Ignite会自动地为每个独立的键赋予备份节点,比如,如果副本数量为1,那么数据网格内缓存的每个键都会有2个备份,一主一备。
*
* 原子化模式 CacheAtomicityMode
* TRANSACTIONAL和TRANSACTIONAL_SNAPSHOT模式支持完全兼容ACID的事务,TRANSACTIONAL模式只支持基于Java API的键-值事务,这个模式的事务有不同的并发模型和隔离级别。
* ATOMIC模式因为避免了事务锁,所以性能更好,但是仍然提供了单个数据的原子性和一致性。ATOMIC模式的另一个不同是批量写,比如putAll(...)和removeAll(...)方法不在一个事务中执行,因此可能部分失败并抛出CachePartialUpdateException,它里面包含了更新失败的键列表。
* */
}
wj-common/src/main/java/com/wanji/common/utils/cookie/CookieUtil.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
cookie
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @Description:
* @Author mapabc
* @Date 2020/6/23 14:35
*/
public
class
CookieUtil
{
private
CookieUtil
()
{
}
/**
* 添加cookie
*
* @param response
* @param name
* @param value
* @param maxAge
*/
public
static
void
addCookie
(
HttpServletResponse
response
,
String
name
,
String
value
,
int
maxAge
)
{
Cookie
cookie
=
new
Cookie
(
name
,
value
);
cookie
.
setPath
(
"/"
);
if
(
maxAge
>=
0
)
{
cookie
.
setMaxAge
(
maxAge
);
}
response
.
addCookie
(
cookie
);
}
/**
* 删除cookie
*
* @param response
* @param name
*/
public
static
void
removeCookie
(
HttpServletResponse
response
,
String
name
)
{
Cookie
uid
=
new
Cookie
(
name
,
null
);
uid
.
setPath
(
"/"
);
uid
.
setMaxAge
(
0
);
response
.
addCookie
(
uid
);
}
/**
* 获取cookie值
*
* @param request
* @return
*/
public
static
String
getUid
(
HttpServletRequest
request
,
String
cookieName
)
{
Cookie
cookies
[]
=
request
.
getCookies
();
if
(
cookies
!=
null
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
cookieName
))
{
return
cookie
.
getValue
();
}
}
}
return
null
;
}
}
wj-common/src/main/java/com/wanji/common/utils/file/FastDfsUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
file
;
import
com.github.tobato.fastdfs.domain.fdfs.FileInfo
;
import
com.github.tobato.fastdfs.domain.fdfs.StorePath
;
import
com.github.tobato.fastdfs.domain.fdfs.ThumbImageConfig
;
import
com.github.tobato.fastdfs.domain.proto.storage.DownloadByteArray
;
import
com.github.tobato.fastdfs.service.FastFileStorageClient
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FilenameUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.stereotype.Component
;
import
java.io.*
;
/**
* 使用FastDFS访问和存储文件
*
* @author gl.dong
* @date 2020/5/26
*/
@Slf4j
@Component
(
"fastDfsUtils"
)
@ConditionalOnProperty
(
value
=
"fdfs.groupName"
)
//判断fastdfs的配置是否存在
public
class
FastDfsUtils
{
@Autowired
private
FastFileStorageClient
storageClient
;
@Autowired
private
ThumbImageConfig
thumbImageConfig
;
@Value
(
"${fdfs.groupName}"
)
private
String
groupName
;
@Value
(
"${fdfs.serverUrl}"
)
public
String
serverUrl
;
@Value
(
"${fdfs.fileDownUrl}"
)
public
String
fileDownUrl
;
/**
* 判断文件或目录是否存在
*
* @param filePath
* @return
* @throws Exception
*/
public
boolean
exists
(
String
filePath
)
throws
Exception
{
if
(
filePath
.
contains
(
groupName
))
{
filePath
=
filePath
.
replace
(
groupName
+
"/"
,
""
);
}
FileInfo
fileInfo
;
try
{
fileInfo
=
storageClient
.
queryFileInfo
(
groupName
,
filePath
);
}
catch
(
Exception
e
)
{
return
false
;
}
return
fileInfo
!=
null
;
}
/**
* 删除文件
*
* @param fullRemoteFileName
* @return
* @throws Exception
*/
public
boolean
delFile
(
String
fullRemoteFileName
)
throws
Exception
{
boolean
flag
=
false
;
try
{
if
(
fullRemoteFileName
.
contains
(
groupName
))
{
fullRemoteFileName
=
fullRemoteFileName
.
replace
(
groupName
+
"/"
,
""
);
}
if
(
exists
(
fullRemoteFileName
))
{
//删除文件服务器的文件信息
storageClient
.
deleteFile
(
groupName
,
fullRemoteFileName
);
flag
=
true
;
}
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"deleted remote exception by fileName("
+
fullRemoteFileName
+
")"
,
e
);
}
return
flag
;
}
/**
* @return boolean
* @throws
* @Author mapabc7
* @Description 删除本地文件
* @Date 9:26 2020/6/1
* @Param [fullRemoteFileName]
*/
public
boolean
delLocalFile
(
String
fullRemoteFileName
)
throws
Exception
{
try
{
if
(!
fullRemoteFileName
.
contains
(
fileDownUrl
))
{
fullRemoteFileName
=
fileDownUrl
+
"/"
+
fullRemoteFileName
;
}
File
file
=
new
File
(
fullRemoteFileName
);
// 是文件
if
(
file
.
exists
()
&&
file
.
isFile
())
{
file
.
delete
();
}
else
{
// 是文件夹
delTempChild
(
file
);
}
return
true
;
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"deleted local file exception by fileName("
+
fullRemoteFileName
+
"),"
+
e
.
getMessage
(),
e
);
}
}
private
void
delTempChild
(
File
file
)
{
if
(
file
.
isDirectory
())
{
String
[]
children
=
file
.
list
();
//获取文件夹下所有子文件夹
//递归删除目录中的子目录下
if
(
children
!=
null
)
{
for
(
String
child
:
children
)
{
delTempChild
(
new
File
(
file
,
child
));
}
}
}
else
{
// 目录空了,进行删除
file
.
delete
();
}
}
/**
* 将数据流写入到远程文件系统中
*
* @return
* @throws Exception
*/
public
String
writeInputStreamToFile
(
File
file
)
throws
Exception
{
try
(
FileInputStream
in
=
new
FileInputStream
(
file
))
{
StorePath
storePath
=
storageClient
.
uploadFile
(
in
,
file
.
length
(),
FilenameUtils
.
getExtension
(
file
.
getName
()),
null
);
return
storePath
.
getFullPath
();
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"upload remote path exception,"
+
e
.
getMessage
(),
e
);
}
}
/**
* 将数据流写入到远程文件系统中
*
* @return
* @throws Exception
*/
public
String
writeInputStreamToFile
(
InputStream
inputStream
,
long
fileSize
,
String
remoteFilename
)
throws
Exception
{
try
{
StorePath
storePath
=
storageClient
.
uploadFile
(
inputStream
,
fileSize
,
FilenameUtils
.
getExtension
(
remoteFilename
),
null
);
return
storePath
.
getFullPath
();
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"upload remote path exception,"
+
e
.
getMessage
(),
e
);
}
finally
{
inputStream
.
close
();
}
}
public
boolean
downloadToLocal
(
String
localFilePath
,
String
remoteDir
)
{
File
file
=
new
File
(
localFilePath
);
return
downloadToLocal
(
file
,
remoteDir
);
}
public
boolean
downloadToLocal
(
File
file
,
String
remoteDir
)
{
// 先删 后下载
FileUtil
.
delFile
(
file
);
byte
[]
bytes
=
null
;
boolean
flag
=
false
;
OutputStream
outputStream
=
null
;
try
{
if
(
remoteDir
.
contains
(
groupName
))
{
remoteDir
=
remoteDir
.
replace
(
groupName
+
"/"
,
""
);
}
if
(
storageClient
.
queryFileInfo
(
groupName
,
remoteDir
)
!=
null
)
{
bytes
=
storageClient
.
downloadFile
(
groupName
,
remoteDir
,
new
DownloadByteArray
());
}
// 创建目录
FileUtil
.
newFolder
(
file
.
getParentFile
());
outputStream
=
new
FileOutputStream
(
file
);
if
(
bytes
==
null
||
bytes
.
length
<=
0
)
{
log
.
error
(
"download remote("
+
remoteDir
+
") to local exception, 文件系统无此文件"
);
return
false
;
}
outputStream
.
write
(
bytes
);
flag
=
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"download remote:{} to local:{} path exception error:{}"
,
remoteDir
,
file
.
getPath
(),
e
.
getMessage
());
}
finally
{
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"文件流关闭失败:{}"
,
e
.
getMessage
());
}
}
}
return
flag
;
}
/**
* 根据当前图片地址返回缩略图图片地址
*
* @param url 当前图片地址
* @return 缩略图图片地址
* @throws Exception
* @Author gl.dong
*/
public
String
getThumbFromUrl
(
String
url
)
throws
Exception
{
String
thumbUrl
=
""
;
if
(
url
.
contains
(
groupName
))
{
url
=
url
.
replace
(
groupName
+
"/"
,
""
);
}
try
{
if
(
exists
(
url
))
{
thumbUrl
=
thumbImageConfig
.
getThumbImagePath
(
url
);
}
}
catch
(
Exception
e
)
{
throw
new
Exception
(
" get thumb url fail"
,
e
);
}
return
thumbUrl
;
}
/**
* 将流转为字节
*
* @param inStream
* @return
* @throws Exception
*/
public
static
byte
[]
inputStreamToBytes
(
InputStream
inStream
)
throws
Exception
{
byte
[]
bytes
=
null
;
try
(
ByteArrayOutputStream
swapStream
=
new
ByteArrayOutputStream
())
{
byte
[]
buff
=
new
byte
[
100
];
int
rc
=
0
;
while
((
rc
=
inStream
.
read
(
buff
,
0
,
100
))
>
0
)
{
swapStream
.
write
(
buff
,
0
,
rc
);
}
bytes
=
swapStream
.
toByteArray
();
}
catch
(
Exception
e
)
{
log
.
error
(
"将流转为字节失败"
,
e
);
throw
new
Exception
(
"将流转为字节失败"
,
e
);
}
return
bytes
;
}
/**
* 传入文件路径 将文件转为字节
*
* @param filePath
* @return
* @throws Exception
*/
public
byte
[]
readFileToBytes
(
String
filePath
)
throws
Exception
{
byte
[]
bytes
=
null
;
String
group
=
"group1"
;
try
{
if
(
storageClient
.
queryFileInfo
(
group
,
filePath
)
!=
null
)
{
bytes
=
storageClient
.
downloadFile
(
group
,
filePath
,
new
DownloadByteArray
());
}
}
catch
(
Exception
e
)
{
throw
new
Exception
(
"download remote("
+
filePath
+
") path exception"
,
e
);
}
return
bytes
;
}
/**
* 将字节流数据写入到远程文件系统中
*
* @param bytes
* @return 远程文件路径
* @throws Exception
*/
public
String
writeByteArrayToFile
(
byte
[]
bytes
,
String
remoteDir
,
String
remoteName
)
throws
Exception
{
InputStream
in
=
byteToInputStream
(
bytes
);
return
writeInputStreamToFile
(
in
,
bytes
.
length
,
remoteName
);
}
/**
* 字节转换InputStream
*
* @param in
* @return
*/
public
static
InputStream
byteToInputStream
(
byte
[]
in
)
throws
Exception
{
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
in
);
return
is
;
}
public
static
void
main
(
String
[]
args
)
{
String
a
=
"http://219.142.87.76:8080/"
+
"group1/M00/00/19/wKgFwF7QpByAGClYAAA6xbqsNdg30.docx"
;
String
b
=
a
.
replace
(
"http://219.142.87.76:8080/"
,
""
);
System
.
out
.
println
(
a
.
lastIndexOf
(
")"
));
System
.
out
.
println
(
a
.
substring
(
a
.
lastIndexOf
(
"."
)));
}
}
wj-common/src/main/java/com/wanji/common/utils/geo/GeoWebCacheUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
geo
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wanji.common.tool.estool.EsUtil
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.StatusLine
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
toilelibre
.
libe
.
curl
.
Curl
.
curl
;
import
static
org
.
toilelibre
.
libe
.
curl
.
Curl
.
$
;
/**
* GeoWebCache帮助类
* @author guoliang.dong@mapabc.com
*/
@Slf4j
public
class
GeoWebCacheUtils
{
private
String
geoUrl
;
private
String
geoUsername
;
private
String
geoPassword
;
private
static
GeoWebCacheUtils
geoWebCacheUtils
=
null
;
public
static
GeoWebCacheUtils
getGeoServerRESTManager
(
String
url
,
String
username
,
String
password
)
{
if
(
geoWebCacheUtils
==
null
)
{
geoWebCacheUtils
=
new
GeoWebCacheUtils
(
url
,
username
,
password
);
}
return
geoWebCacheUtils
;
}
public
GeoWebCacheUtils
(
String
url
,
String
username
,
String
password
){
geoUrl
=
url
;
geoUsername
=
username
;
geoPassword
=
password
;
}
/**
* 新增工作空间
*
* @param workspace 工作空间名
* @return boolean
*/
public
boolean
addWorkspace
(
String
workspace
)
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XPOST -H \"Content-type: text/xml\"\n"
+
" -d \"<workspace><name>"
+
workspace
+
"</name></workspace>\"\n"
+
" "
+
geoUrl
+
"/rest/workspaces"
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
201
;
}
/**
* 创建外存储geotiff
*
* @param workspace
* @param store
* @return
*/
public
boolean
addExternalGeotiffStore
(
String
workspace
,
String
store
,
String
fileurl
){
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XPUT -H \"Content-type: text/plain\"\n"
+
" -d \"file://"
+
fileurl
+
"\"\n"
+
" "
+
geoUrl
+
"/rest/workspaces/"
+
workspace
+
"/coveragestores/"
+
store
+
"/external.geotiff?configure=first&coverageName="
+
store
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
201
;
}
/**
* 获取geoWebCache中的图层
*
* @return Map
*/
public
Map
<
String
,
Object
>
getLayers
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
();
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" \""
+
geoUrl
+
"/gwc/rest/layers\""
;
List
<
String
>
shp
=
new
ArrayList
<>();
List
<
String
>
image
=
new
ArrayList
<>();
HttpResponse
curl
=
curl
(
cmd
);
HttpEntity
entity
=
curl
.
getEntity
();
if
(
entity
!=
null
)
{
String
result
=
null
;
try
{
result
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
result
);
for
(
Object
o
:
jsonArray
)
{
String
str
=
o
.
toString
();
map
.
put
(
str
,
o
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
/**
*
*
* @param layer
* @param zoomStart
* @param zoomStop
* @return boolean
*/
/**
* 指定图层进行切片操作
* @param layer 指定图层 shp:test
* @param type * seed (add tiles) * reseed (replace tiles) * truncate (remove tiles)
* @param srs 坐标系srid
* @param zoomStart 1 切片开始层级
* @param zoomStop 15 切片结束层级
* @return
*/
public
boolean
slice
(
String
layer
,
String
type
,
int
srs
,
int
zoomStart
,
int
zoomStop
,
String
gridSetId
)
{
int
threadCount
=
2
;
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".xml\""
+
" -XPOST -H \"Content-type: text/xml\" -d '<seedRequest><name>"
+
layer
+
"</name><srs><number>"
+
srs
+
"</number></srs><zoomStart>"
+
zoomStart
+
"</zoomStart><zoomStop>"
+
zoomStop
+
"</zoomStop><format>image/png</format><type>"
+
type
+
"</type><threadCount>"
+
threadCount
+
"</threadCount><gridSetId>"
+
gridSetId
+
"</gridSetId></seedRequest>' \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".xml\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
/**
* 获取切片的情况
*
* @param layer 指定图层
* @return Map
*/
public
Map
getSliceType
(
String
layer
)
{
Map
map
=
new
HashMap
();
//返回所有图层切片情况 curl -u <user>:<password> -XGET http://localhost:8080/geoserver/gwc/rest/seed.json
//返回指定图层的切片情况
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -XGET "
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
".json"
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
if
(
statusLine
.
getStatusCode
()==
200
)
{
HttpEntity
entity
=
curl
.
getEntity
();
try
{
String
result
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
JSONObject
jsonArray
=
JSONObject
.
parseObject
(
result
);
map
.
put
(
"res"
,
jsonArray
.
getJSONArray
(
"long-array-array"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
map
;
}
/**
* 停止所有正在进行的切片任务
*
* @return boolean
*/
public
boolean
stopAllSlice
()
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -d \"kill_all=all\" \""
+
geoUrl
+
"/gwc/rest/seed\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
/**
* 停止指定图层的切片任务
*
* @return boolean
*/
public
boolean
stopSliceByLayer
(
String
layer
)
{
String
cmd
=
"curl -u "
+
geoUsername
+
":"
+
geoPassword
+
" -d \"kill_all=all\" \""
+
geoUrl
+
"/gwc/rest/seed/"
+
layer
+
"\""
;
HttpResponse
curl
=
curl
(
cmd
);
StatusLine
statusLine
=
curl
.
getStatusLine
();
return
statusLine
.
getStatusCode
()==
200
;
}
public
static
void
main
(
String
[]
args
){
GeoWebCacheUtils
geoServerRESTManager
=
GeoWebCacheUtils
.
getGeoServerRESTManager
(
"http://127.0.0.1:8080/geoserver"
,
"admin"
,
"geoserver"
);
//System.out.println(geoServerRESTManager.addWorkspace("zhangwei"));
//Map<String, Object> layers=geoServerRESTManager.getLayers();
//System.out.println("图层数:"+layers.size());
//System.out.println(layers);
System
.
out
.
println
(
geoServerRESTManager
.
slice
(
"sf:result8"
,
"seed"
,
4326
,
14
,
14
,
"My_EPSG:4326"
));
//System.out.println(geoServerRESTManager.stopSliceByLayer("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.getSliceType("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.getSliceType("gisc_3f0786e36794%3Apoi"));
//System.out.println(geoServerRESTManager.stopAllSlice());
//System.out.println(geoServerRESTManager.addExternalGeotiffStore("sf","result8","D:/ProgramData/GeoServer/data/sf/result8/result.tif"));
}
}
wj-common/src/main/java/com/wanji/common/utils/licenseUtils/AESUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
licenseUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.security.InvalidKeyException
;
import
java.security.Key
;
import
java.security.NoSuchAlgorithmException
;
import
javax.crypto.*
;
import
javax.crypto.spec.SecretKeySpec
;
public
class
AESUtils
{
private
static
final
String
ALGORITHM_STR
=
"AES/ECB/PKCS5Padding"
;
private
static
final
String
ALGORITHM_AES
=
"AES"
;
private
static
final
int
DIGIT_AES
=
128
;
// AES加密位数
private
static
final
String
ENCONDING_TAG
=
"UTF-8"
;
private
static
KeyGenerator
keyGen
;
private
static
Cipher
cipher
;
static
boolean
isInited
=
false
;
private
static
void
init
()
{
try
{
/**
* 为指定算法生成一个 KeyGenerator 对象。 此类提供(对称)密钥生成器的功能。 密钥生成器是使用此类的某个 getInstance 类方法构造的。
* KeyGenerator 对象可重复使用,也就是说,在生成密钥后, 可以重复使用同一 KeyGenerator 对象来生成进一步的密钥。
* 生成密钥的方式有两种:与算法无关的方式,以及特定于算法的方式。 两者之间的惟一不同是对象的初始化: 与算法无关的初始化 所有密钥生成器都具有密钥长度 和随机源 的概念。
* 此 KeyGenerator 类中有一个 init 方法,它可采用这两个通用概念的参数。 还有一个只带 keysize 参数的 init 方法,
* 它使用具有最高优先级的提供程序的 SecureRandom 实现作为随机源 (如果安装的提供程序都不提供 SecureRandom 实现,则使用系统提供的随机源)。 此
* KeyGenerator 类还提供一个只带随机源参数的 inti 方法。 因为调用上述与算法无关的 init 方法时未指定其他参数,
* 所以由提供程序决定如何处理将与每个密钥相关的特定于算法的参数(如果有)。 特定于算法的初始化 在已经存在特定于算法的参数集的情况下, 有两个具有
* AlgorithmParameterSpec 参数的 init 方法。 其中一个方法还有一个 SecureRandom 参数, 而另一个方法将已安装的高优先级提供程序的
* SecureRandom 实现用作随机源 (或者作为系统提供的随机源,如果安装的提供程序都不提供 SecureRandom 实现)。 如果客户端没有显式地初始化
* KeyGenerator(通过调用 init 方法), 每个提供程序必须提供(和记录)默认初始化。
*/
keyGen
=
KeyGenerator
.
getInstance
(
ALGORITHM_AES
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
// 初始化此密钥生成器,使其具有确定的密钥长度。
keyGen
.
init
(
DIGIT_AES
);
// 128位的AES加密
try
{
// 生成一个实现指定转换的 Cipher 对象。
cipher
=
Cipher
.
getInstance
(
ALGORITHM_STR
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchPaddingException
e
)
{
e
.
printStackTrace
();
}
// 标识已经初始化过了的字段
isInited
=
true
;
}
private
static
byte
[]
genKey
()
{
if
(!
isInited
)
{
init
();
}
// 首先 生成一个密钥(SecretKey),
// 然后,通过这个秘钥,返回基本编码格式的密钥,如果此密钥不支持编码,则返回 null。
return
keyGen
.
generateKey
().
getEncoded
();
}
private
static
byte
[]
encrypt
(
byte
[]
content
,
byte
[]
keyBytes
)
{
byte
[]
encryptedText
=
null
;
if
(!
isInited
)
{
init
();
}
/**
* 类 SecretKeySpec 可以使用此类来根据一个字节数组构造一个 SecretKey, 而无须通过一个(基于 provider 的)SecretKeyFactory。
* 此类仅对能表示为一个字节数组并且没有任何与之相关联的钥参数的原始密钥有用 构造方法根据给定的字节数组构造一个密钥。 此构造方法不检查给定的字节数组是否指定了一个算法的密钥。
*/
Key
key
=
new
SecretKeySpec
(
keyBytes
,
ALGORITHM_AES
);
try
{
// 用密钥初始化此 cipher。
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
);
}
catch
(
InvalidKeyException
e
)
{
e
.
printStackTrace
();
}
try
{
// 按单部分操作加密或解密数据,或者结束一个多部分操作。(不知道神马意思)
encryptedText
=
cipher
.
doFinal
(
content
);
}
catch
(
IllegalBlockSizeException
e
)
{
e
.
printStackTrace
();
}
catch
(
BadPaddingException
e
)
{
e
.
printStackTrace
();
}
return
encryptedText
;
}
private
static
byte
[]
encrypt
(
String
content
,
String
password
)
{
try
{
byte
[]
keyStr
=
getKey
(
password
);
SecretKeySpec
key
=
new
SecretKeySpec
(
keyStr
,
ALGORITHM_AES
);
Cipher
cipher
=
Cipher
.
getInstance
(
ALGORITHM_STR
);
// algorithmStr
byte
[]
byteContent
=
content
.
getBytes
(
ENCONDING_TAG
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
);
// ʼ
byte
[]
result
=
cipher
.
doFinal
(
byteContent
);
return
result
;
//
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchPaddingException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidKeyException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalBlockSizeException
e
)
{
e
.
printStackTrace
();
}
catch
(
BadPaddingException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
byte
[]
decrypt
(
byte
[]
content
,
String
password
)
{
try
{
byte
[]
keyStr
=
getKey
(
password
);
SecretKeySpec
key
=
new
SecretKeySpec
(
keyStr
,
ALGORITHM_AES
);
Cipher
cipher
=
Cipher
.
getInstance
(
ALGORITHM_STR
);
// algorithmStr
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
);
// ʼ
byte
[]
result
=
cipher
.
doFinal
(
content
);
return
result
;
//
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchPaddingException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidKeyException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalBlockSizeException
e
)
{
e
.
printStackTrace
();
}
catch
(
BadPaddingException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
byte
[]
getKey
(
String
password
)
{
byte
[]
rByte
=
null
;
if
(
password
!=
null
)
{
rByte
=
password
.
getBytes
();
}
else
{
rByte
=
new
byte
[
24
];
}
return
rByte
;
}
/**
* 将二进制转换成16进制
*
* @param buf
* @return
*/
public
static
String
parseByte2HexStr
(
byte
buf
[])
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
buf
.
length
;
i
++)
{
String
hex
=
Integer
.
toHexString
(
buf
[
i
]
&
0xFF
);
if
(
hex
.
length
()
==
1
)
{
hex
=
'0'
+
hex
;
}
sb
.
append
(
hex
.
toUpperCase
());
}
return
sb
.
toString
();
}
/**
* 将16进制转换为二进制
*
* @param hexStr
* @return
*/
public
static
byte
[]
parseHexStr2Byte
(
String
hexStr
)
{
if
(
hexStr
.
length
()
<
1
)
{
return
null
;
}
byte
[]
result
=
new
byte
[
hexStr
.
length
()
/
2
];
for
(
int
i
=
0
;
i
<
hexStr
.
length
()
/
2
;
i
++)
{
int
high
=
Integer
.
parseInt
(
hexStr
.
substring
(
i
*
2
,
i
*
2
+
1
),
16
);
int
low
=
Integer
.
parseInt
(
hexStr
.
substring
(
i
*
2
+
1
,
i
*
2
+
2
),
16
);
result
[
i
]
=
(
byte
)
(
high
*
16
+
low
);
}
return
result
;
}
// 注意: 这里的password(秘钥必须是16位的)
private
static
final
String
keyBytes
=
"vpa003icoreaims#"
;
/** 加密 */
public
static
String
encode
(
String
content
,
String
key
)
{
// 加密之后的字节数组,转成16进制的字符串形式输出
return
parseByte2HexStr
(
encrypt
(
content
,
key
));
}
/** 解密 */
public
static
byte
[]
decode
(
String
content
,
String
key
)
{
// String decryptCode = null;
// 解密之前,先将输入的字符串按照16进制转成二进制的字节数组,作为待解密的内容输入
return
decrypt
(
parseHexStr2Byte
(
content
),
key
);
// try {
// decryptCode= new String(res, Constants.UTF8_ENCODING);
// } catch (UnsupportedEncodingException e) { }
// return decryptCode;
}
public
static
void
main
(
String
[]
args
)
{
String
content
=
"Y"
+
","
+
"420FC7FC-1616-3382-0D20-664AE5A7CDD3"
+
","
+
"20301218"
;
String
encodeStr
=
encode
(
"X,bill,2020-08-07"
,
keyBytes
);
System
.
out
.
print
(
encodeStr
);
}
}
wj-common/src/main/java/com/wanji/common/utils/licenseUtils/DESUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
licenseUtils
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.DESKeySpec
;
import
javax.crypto.spec.IvParameterSpec
;
/**
* 授权加密解密工具类,做成授权工具的话,主要就是用的这个类
*/
public
class
DESUtils
{
/**
* 密钥
*/
public
static
final
String
DEFAULT_KEY
=
"BOTWAVEE"
;
public
static
String
decrypt
(
String
message
)
throws
Exception
{
return
java
.
net
.
URLDecoder
.
decode
(
decrypt
(
message
,
DEFAULT_KEY
),
"utf-8"
);
}
/**
* 解密
* @param message 加密后的内容
* @param key 密钥
* @return
* @throws Exception
*/
public
static
String
decrypt
(
String
message
,
String
key
)
throws
Exception
{
byte
[]
bytesrc
=
convertHexString
(
message
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DES/CBC/PKCS5Padding"
);
DESKeySpec
desKeySpec
=
new
DESKeySpec
(
key
.
getBytes
(
"UTF-8"
));
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DES"
);
SecretKey
secretKey
=
keyFactory
.
generateSecret
(
desKeySpec
);
IvParameterSpec
iv
=
new
IvParameterSpec
(
key
.
getBytes
(
"UTF-8"
));
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
secretKey
,
iv
);
byte
[]
retByte
=
cipher
.
doFinal
(
bytesrc
);
return
new
String
(
retByte
);
}
public
static
String
encrypt
(
String
message
)
throws
Exception
{
return
toHexString
(
encrypt
(
message
,
DEFAULT_KEY
)).
toUpperCase
();
}
/**
* 加密
*
* @param message
* @param key
* @return
* @throws Exception
*/
public
static
byte
[]
encrypt
(
String
message
,
String
key
)
throws
Exception
{
Cipher
cipher
=
Cipher
.
getInstance
(
"DES/CBC/PKCS5Padding"
);
DESKeySpec
desKeySpec
=
new
DESKeySpec
(
key
.
getBytes
(
"UTF-8"
));
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DES"
);
SecretKey
secretKey
=
keyFactory
.
generateSecret
(
desKeySpec
);
IvParameterSpec
iv
=
new
IvParameterSpec
(
key
.
getBytes
(
"UTF-8"
));
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
,
iv
);
return
cipher
.
doFinal
(
message
.
getBytes
(
"UTF-8"
));
}
public
static
byte
[]
convertHexString
(
String
ss
)
{
byte
digest
[]
=
new
byte
[
ss
.
length
()
/
2
];
for
(
int
i
=
0
;
i
<
digest
.
length
;
i
++)
{
String
byteString
=
ss
.
substring
(
2
*
i
,
2
*
i
+
2
);
int
byteValue
=
Integer
.
parseInt
(
byteString
,
16
);
digest
[
i
]
=
(
byte
)
byteValue
;
}
return
digest
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
key
=
"BOTWAVEE"
;
String
jiami
=
"znxd,000000,7005-459C,2018-07-27,2022-02-02"
;
System
.
out
.
println
(
"加密数据:"
+
jiami
);
// Byte a = encrypt(jiami,key);
System
.
out
.
println
(
"加密后的数据为:"
+
encrypt
(
jiami
,
key
));
String
b
=
decrypt
(
new
String
(
encrypt
(
jiami
,
key
)));
System
.
out
.
println
(
"解密后的数据:"
+
b
);
}
public
static
String
toHexString
(
byte
b
[])
{
StringBuffer
hexString
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
{
String
plainText
=
Integer
.
toHexString
(
0xff
&
b
[
i
]);
if
(
plainText
.
length
()
<
2
)
plainText
=
"0"
+
plainText
;
hexString
.
append
(
plainText
);
}
return
hexString
.
toString
();
}
}
wj-common/src/main/java/com/wanji/common/utils/licenseUtils/DateUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
licenseUtils
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.TimeZone
;
/** Created by JAVA on 2018/7/24. */
public
class
DateUtils
{
public
static
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
public
static
boolean
authorize_date
(
String
date
)
{
TimeZone
tz
=
TimeZone
.
getTimeZone
(
"ETC/GMT-8"
);
TimeZone
.
setDefault
(
tz
);
String
currentTime
=
DateUtils
.
formatter
.
format
(
new
Date
());
if
(
compare_date
(
currentTime
,
date
)
>=
0
)
{
return
true
;
}
return
false
;
}
public
static
int
compare_date
(
String
date1
,
String
date2
)
{
DateFormat
df
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
try
{
Date
dt1
=
df
.
parse
(
date1
);
Date
dt2
=
df
.
parse
(
date2
);
if
(
dt1
.
getTime
()
<
dt2
.
getTime
())
{
// System.out.println("dt1 在dt2前");
return
1
;
}
else
if
(
dt1
.
getTime
()
>
dt2
.
getTime
())
{
// System.out.println("dt1在dt2后");
return
-
1
;
}
else
{
return
0
;
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
0
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
authorize_date
(
"20200807"
));;
}
}
wj-common/src/main/java/com/wanji/common/utils/licenseUtils/EncoderFile.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
licenseUtils
;
import
java.io.*
;
/**
* Created by JAVA on 2018/7/24.
*/
public
class
EncoderFile
{
// public static void main(String[] args) throws FileNotFoundException {
// File cfgFile =new File("d:/license/encoder.txt");
// if(!cfgFile.exists()){
// cfgFile.getParentFile().mkdirs();
// try {
// cfgFile.createNewFile();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// String string = "znxd,100000,PF0AQGM7,"+ DateUtils.currenttime+",2022-02-02";
// System.out.println(string);
// try {
// string = DESUtils.encrypt(string);
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// write(cfgFile,string);
//
// String line = read(cfgFile);
//
// System.out.println(line);
//
// try {
// System.out.println(DESUtils.decrypt(line));
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// }
// public static void write(File cfgFile ,String write){
// File file = cfgFile; //1、建立连接
// OutputStream os = null;
// try {
// //2、选择输出流,以追加形式(在原有内容上追加) 写出文件 必须为true 否则为覆盖
// os = new FileOutputStream(file);
//// //和上一句功能一样,BufferedInputStream是增强流,加上之后能提高输出效率,建议
//// os = new BufferedOutputStream(new FileOutputStream(file,true));
//
// byte[] data = write.getBytes(); //将字符串转换为字节数组,方便下面写入
//
// os.write(data, 0, data.length); //3、写入文件
// os.flush(); //将存储在管道中的数据强制刷新出去
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// System.out.println("文件没有找到!");
// } catch (IOException e) {
// e.printStackTrace();
// System.out.println("写入文件失败!");
// }finally {
// if (os != null) {
// try {
// os.close();
// } catch (IOException e) {
// e.printStackTrace();
// System.out.println("关闭输出流失败!");
// }
// }
// }
// }
public
static
String
read
(
File
cfgFile
){
StringBuilder
sb
=
new
StringBuilder
();
try
{
// 读取字符文件
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
cfgFile
));
// 为什么单独在这里加上try块而不是直接使用外边的try块?
// 需要考虑这么一种情况,如果文件没有成功打开,则finally关闭文件会出问题
try
{
String
s
;
while
((
s
=
in
.
readLine
())
!=
null
)
{
sb
.
append
(
s
+
"\n"
);
}
}
finally
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
sb
.
toString
();
}
}
wj-common/src/main/java/com/wanji/common/utils/licenseUtils/HardWareUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
licenseUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.*
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
import
org.apache.commons.lang3.StringUtils
;
@Slf4j
public
class
HardWareUtils
{
//安全性考虑,构造方法私有化
private
HardWareUtils
()
{}
/**
* @Description: 获取当前操作系统名称
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 17:45
**/
public
static
String
getOSName
()
{
return
System
.
getProperty
(
"os.name"
).
toLowerCase
();
}
/**
* @Description: 判断当前操作系统
*
* @return boolean,true-unix系统,false,其他,本工具类内其他会按照windows系统处理
* @Author mapabc
* @Date 2020/7/28 17:47
**/
public
static
boolean
isUnixOs
()
{
System
.
out
.
println
(
getOSName
());
return
getOSName
().
contains
(
"linux"
)||
getOSName
().
contains
(
"mac"
)||
getOSName
().
contains
(
"unix"
);
}
/**
* @Description: 获取主板序列号,windows实现
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 17:53
**/
public
static
String
getDosMotherboardSN
()
throws
IOException
{
StringBuffer
result
=
new
StringBuffer
();
String
vbs
=
"Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"
+
"Set colItems = objWMIService.ExecQuery _ \n"
+
" (\"Select * from Win32_BaseBoard\") \n"
+
"For Each objItem in colItems \n"
+
" Wscript.Echo objItem.SerialNumber \n"
+
" exit for ' do the first cpu only! \n"
+
"Next \n"
;
exeDosCmd
(
vbs
).
forEach
(
item
->
{
if
(
Objects
.
nonNull
(
item
)
&&
StringUtils
.
isNotBlank
(
item
.
toString
()))
result
.
append
(
item
.
toString
().
trim
());
});
return
result
.
toString
();
}
/**
* @Description: 获取unix系统 主板序列号
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 20:26
**/
public
static
String
getUnixMotherboardSN
()
throws
IOException
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
String
maniBordCmd
=
"dmidecode | grep 'Serial Number' | awk '{print $3}' | tail -1"
;
exeShellCmd
(
maniBordCmd
).
forEach
(
item
->
{
if
(
Objects
.
nonNull
(
item
)
&&
StringUtils
.
isNotBlank
(
item
.
toString
()))
{
stringBuffer
.
append
(
item
.
toString
());
}
});
return
stringBuffer
.
toString
();
}
/**
* @Description: 获取unix系统 cpu序列号
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 19:41
**/
public
static
String
getUnixCPUSerial
()
throws
IOException
{
StringBuffer
result
=
new
StringBuffer
();
exeShellCmd
(
"dmidecode"
).
forEach
(
item
->
{
if
(
Objects
.
nonNull
(
item
)
&&
StringUtils
.
isNotBlank
(
item
.
toString
())
&&
StringUtils
.
containsIgnoreCase
(
item
.
toString
(),
"uuid"
))
{
result
.
append
(
StringUtils
.
substringAfter
(
item
.
toString
(),
"uuid"
).
trim
());
}
});
return
result
.
toString
();
}
/**
* @Description: 执行unix shell脚本
*
* @param cmd 命令
* @return java.util.List<java.lang.Object>
* @Author mapabc
* @Date 2020/7/28 20:30
**/
private
static
List
<
Object
>
exeShellCmd
(
String
cmd
)
throws
IOException
{
List
<
Object
>
result
;
Process
p
;
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"sh"
,
"-c"
,
cmd
});
//管道
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
result
=
Arrays
.
asList
(
bufferedReader
.
lines
().
toArray
());
bufferedReader
.
close
();
return
result
;
}
/**
* @Description: 执行dos脚本
*
* @param cmd 命令
* @return java.util.List<java.lang.Object>
* @Author mapabc
* @Date 2020/7/28 20:25
**/
private
static
List
<
Object
>
exeDosCmd
(
String
cmd
)
throws
IOException
{
List
<
Object
>
result
;
File
file
=
File
.
createTempFile
(
"tmp"
,
".vbs"
);
file
.
deleteOnExit
();
FileWriter
fw
=
new
FileWriter
(
file
);
fw
.
write
(
cmd
);
fw
.
close
();
Process
p
=
Runtime
.
getRuntime
().
exec
(
"cscript //NoLogo "
+
file
.
getPath
());
BufferedReader
input
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
result
=
Arrays
.
asList
(
input
.
lines
().
toArray
());
input
.
close
();
file
.
delete
();
return
result
;
}
/**
* @Description: 获取CPU序列号
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 17:53
**/
public
static
String
getDosCPUSerial
()
throws
IOException
{
StringBuffer
result
=
new
StringBuffer
();
String
vbs
=
"Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"
+
"Set colItems = objWMIService.ExecQuery _ \n"
+
" (\"Select * from Win32_Processor\") \n"
+
"For Each objItem in colItems \n"
+
" Wscript.Echo objItem.ProcessorId \n"
+
" exit for ' do the first cpu only! \n"
+
"Next \n"
;
exeDosCmd
(
vbs
).
forEach
(
item
->
{
if
(
Objects
.
nonNull
(
item
)
&&
StringUtils
.
isNotBlank
(
item
.
toString
()))
result
.
append
(
item
.
toString
().
trim
());
});
return
result
.
toString
();
}
/**
* @Description: 获取MAC地址,多网卡环境存在计算不准的问题
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 19:46
**/
public
static
String
getMac
()
{
try
{
byte
[]
mac
=
NetworkInterface
.
getByInetAddress
(
InetAddress
.
getLocalHost
())
.
getHardwareAddress
();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
mac
.
length
;
i
++)
{
if
(
i
!=
0
)
{
sb
.
append
(
"-"
);
}
String
s
=
Integer
.
toHexString
(
mac
[
i
]
&
0xFF
);
sb
.
append
(
s
.
length
()
==
1
?
0
+
s
:
s
);
}
return
sb
.
toString
().
toUpperCase
();
}
catch
(
Exception
e
)
{
return
""
;
}
}
/**
* @Description: 获取主板序列号,支持unix和dos系统
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 20:25
**/
public
static
String
getMotherboardSN
()
throws
IOException
{
return
isUnixOs
()
?
getUnixMotherboardSN
()
:
getDosMotherboardSN
();
}
/**
* @Description: 获取cpu序列号,支持unix和dos系统
*
* @return java.lang.String
* @Author mapabc
* @Date 2020/7/28 20:24
**/
public
static
String
getCPUSerial
()
throws
IOException
{
return
isUnixOs
()
?
getUnixCPUSerial
()
:
getDosCPUSerial
();
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
System
.
out
.
println
(
"CPU SN: "
+
HardWareUtils
.
getCPUSerial
());
System
.
out
.
println
(
"主板 SN: "
+
HardWareUtils
.
getMotherboardSN
());
System
.
out
.
println
(
"MAC SN: "
+
HardWareUtils
.
getMac
());
try
{
System
.
out
.
println
(
DESUtils
.
encrypt
(
HardWareUtils
.
getCPUSerial
()
+
","
+
HardWareUtils
.
getMotherboardSN
()
+
","
+
HardWareUtils
.
getMac
()
+
","
+
"2020-08-05 23:59:59"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* @Author mapabc
* @Description 获取机器码
* @Date 18:49 2020/8/3
* @Param []
* @return java.lang.String
* @throws
*/
public
static
String
getMachineCode
()
throws
IOException
{
return
getCPUSerial
()
+
"-"
+
getMotherboardSN
()
;
}
}
wj-common/src/main/java/com/wanji/common/utils/tool/BeanMapUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
tool
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
org.springframework.cglib.beans.BeanMap
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @ClassName BeanMapUtils
* @Description 用于Map和domain类的相互转换,比fastjson效率高
* @Author ${mapabc}
* @Date 2020/6/19 13:42
* @Version 1.0
*/
public
class
BeanMapUtils
{
private
static
Pattern
linePattern
=
Pattern
.
compile
(
"_(\\w)"
);
private
static
Pattern
humpPattern
=
Pattern
.
compile
(
"[A-Z]"
);
/** 下划线转驼峰 */
public
static
String
lineToHump
(
String
str
)
{
str
=
str
.
toLowerCase
();
Matcher
matcher
=
linePattern
.
matcher
(
str
);
StringBuffer
sb
=
new
StringBuffer
();
while
(
matcher
.
find
())
{
matcher
.
appendReplacement
(
sb
,
matcher
.
group
(
1
).
toUpperCase
());
}
matcher
.
appendTail
(
sb
);
return
sb
.
toString
();
}
/** 驼峰转下划线 */
public
static
String
humpToLine
(
String
str
)
{
Matcher
matcher
=
humpPattern
.
matcher
(
str
);
StringBuffer
sb
=
new
StringBuffer
();
while
(
matcher
.
find
())
{
matcher
.
appendReplacement
(
sb
,
"_"
+
matcher
.
group
(
0
).
toLowerCase
());
}
matcher
.
appendTail
(
sb
);
return
sb
.
toString
();
}
/**
* 将对象装换为map
* @param bean
* @return
*/
public
static
<
T
>
Map
<
String
,
Object
>
beanToMap
(
T
bean
)
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
if
(
bean
!=
null
)
{
BeanMap
beanMap
=
BeanMap
.
create
(
bean
);
for
(
Object
key
:
beanMap
.
keySet
())
{
map
.
put
(
key
+
""
,
beanMap
.
get
(
key
));
}
}
return
map
;
}
/**
* 将map装换为javabean对象 TODO bug 待处理,将map对象转换为bean时,如果属性中首字母为大写会转换不过去,待处理
* @param map
* @param clazz
* @return
*/
/*public static <T> T mapToBean(Map<String, Object> map,T bean) {
BeanMap beanMap = BeanMap.create(bean);
beanMap.putAll(map);
return bean;
}*/
public
static
<
T
>
T
mapToBean
(
Map
<
String
,
Object
>
map
,
Class
<
T
>
clazz
)
throws
Exception
{
T
bean
=
null
;
try
{
bean
=
clazz
.
newInstance
();
for
(
Field
field
:
getAllFields
(
clazz
))
{
if
(
map
.
containsKey
(
humpToLine
(
field
.
getName
())))
{
boolean
flag
=
field
.
isAccessible
();
field
.
setAccessible
(
true
);
Object
object
=
map
.
get
(
humpToLine
(
field
.
getName
()));
if
(
object
!=
null
)
{
if
(
field
.
getType
().
isAssignableFrom
(
object
.
getClass
()))
{
field
.
set
(
bean
,
object
);
}
else
{
//判断属性类型 进行转换,map中存放的是Object对象需要转换 实体类中有多少类型就加多少类型,实体类属性用包装类;
if
(
field
.
getType
().
toString
().
contains
(
"Long"
))
{
field
.
set
(
bean
,
Long
.
parseLong
(
object
.
toString
()));
}
if
(
field
.
getType
().
toString
().
contains
(
"String"
))
{
field
.
set
(
bean
,
object
.
toString
());
}
if
(
field
.
getType
().
toString
().
contains
(
"Integer"
))
{
field
.
set
(
bean
,
Integer
.
parseInt
(
object
.
toString
()));
}
if
(
field
.
getType
().
toString
().
contains
(
"Float"
))
{
field
.
set
(
bean
,
Float
.
valueOf
(
object
.
toString
()));
}
//处理LocalDateTime类型
/*if (field.getType().toString().contains("LocalDateTime")) {
field.set(bean, stringConvertLocalDateTime(object.toString()));
}*/
}
}
field
.
setAccessible
(
flag
);
}
}
return
bean
;
}
catch
(
InstantiationException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
return
bean
;
}
/**
* 获取自身和上一级父类属性
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
Field
[]
getAllFields
(
Class
<
T
>
clazz
){
List
<
Field
>
fieldList
=
new
ArrayList
<>();
fieldList
.
addAll
(
new
ArrayList
<>(
Arrays
.
asList
(
clazz
.
getDeclaredFields
())));
if
(
clazz
.
getSuperclass
()!=
null
){
//写死的 取一层父类 TODO 没有好的解决方案
fieldList
.
addAll
(
new
ArrayList
<>(
Arrays
.
asList
(
clazz
.
getSuperclass
().
getDeclaredFields
())));
}
Field
[]
fields
=
new
Field
[
fieldList
.
size
()];
fieldList
.
toArray
(
fields
);
return
fields
;
}
public
static
void
main
(
String
[]
args
)
{
Map
map
=
new
HashMap
();
map
.
put
(
"resName"
,
"1111"
);
map
.
put
(
"resType"
,
"123"
);
// mapToBean(map,new OperationLog)
//// String indexName = map.get("indexName").toString();
//// String typeName = map.get("typeName").toString();
}
/**
* 将List<T>转换为List<Map<String, Object>>
* @param objList
* @return
*
*/
public
static
<
T
>
List
<
Map
<
String
,
Object
>>
objectsToMaps
(
List
<
T
>
objList
)
{
List
<
Map
<
String
,
Object
>>
list
=
Lists
.
newArrayList
();
if
(
objList
!=
null
&&
objList
.
size
()
>
0
)
{
Map
<
String
,
Object
>
map
=
null
;
T
bean
=
null
;
for
(
int
i
=
0
,
size
=
objList
.
size
();
i
<
size
;
i
++)
{
bean
=
objList
.
get
(
i
);
map
=
beanToMap
(
bean
);
list
.
add
(
map
);
}
}
return
list
;
}
/**
* 将List<Map<String,Object>>转换为List<T>
* @param maps
* @param clazz
* @return
* @throws InstantiationException
* @throws IllegalAccessException
*/
public
static
<
T
>
List
<
T
>
mapsToObjects
(
List
<
Map
<
String
,
Object
>>
maps
,
Class
<
T
>
clazz
)
throws
Exception
{
List
<
T
>
list
=
Lists
.
newArrayList
();
if
(
maps
!=
null
&&
maps
.
size
()
>
0
)
{
Map
<
String
,
Object
>
map
=
null
;
T
bean
=
null
;
for
(
int
i
=
0
,
size
=
maps
.
size
();
i
<
size
;
i
++)
{
map
=
maps
.
get
(
i
);
bean
=
mapToBean
(
map
,
clazz
);
list
.
add
(
bean
);
}
}
return
list
;
}
}
wj-common/src/main/java/com/wanji/common/utils/tool/CamelUnderlineUtil.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
tool
;
import
org.apache.commons.lang3.StringUtils
;
public
class
CamelUnderlineUtil
{
private
static
final
char
UNDERLINE
=
'_'
;
public
static
String
camelToUnderline
(
String
param
)
{
if
(
StringUtils
.
isEmpty
(
param
))
{
return
""
;
}
StringBuilder
sb
=
new
StringBuilder
();
int
len
=
param
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
param
.
charAt
(
i
);
if
(
Character
.
isUpperCase
(
c
))
{
sb
.
append
(
UNDERLINE
);
sb
.
append
(
Character
.
toLowerCase
(
c
));
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
public
static
String
underlineToCamel
(
String
param
){
if
(
StringUtils
.
isEmpty
(
param
))
{
return
""
;
}
StringBuilder
sb
=
new
StringBuilder
();
int
len
=
param
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
param
.
charAt
(
i
);
if
(
c
==
UNDERLINE
)
{
if
(++
i
<
len
){
sb
.
append
(
Character
.
toUpperCase
(
param
.
charAt
(
i
)));
}
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
}
\ No newline at end of file
wj-common/src/main/java/com/wanji/common/utils/tool/ConvertBaseUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
tool
;
import
java.math.BigInteger
;
import
java.util.Stack
;
/**
* @author hfx
* @date 2023/1/16 15:45
* @desc ConvertBaseUtils
*/
public
class
ConvertBaseUtils
{
private
static
final
String
TARGET_STR
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
private
static
final
char
[]
chs
=
TARGET_STR
.
toCharArray
();
private
static
final
BigInteger
INTEGER0
=
new
BigInteger
(
"0"
);
private
static
final
Integer
SHIFT
=
5
;
private
static
final
Integer
RADIX32
=
32
;
/**
* 基数转换32进制,不足五位,补齐五位字符
* @param number
* @return
*/
public
static
String
numToRadix32
(
long
number
)
{
String
buf
=
numToRadix
(
number
+
""
,
RADIX32
);
if
(
buf
.
length
()
<
SHIFT
)
{
int
num
=
SHIFT
-
buf
.
length
();
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
buf
=
"0"
+
buf
;
}
}
return
buf
;
}
/**
* 10进制转任意进制
* @param number
* @param radix
* @return
*/
public
static
String
numToRadix
(
String
number
,
int
radix
)
{
if
(
radix
<
0
||
radix
>
TARGET_STR
.
length
())
{
radix
=
TARGET_STR
.
length
();
}
BigInteger
bigNumber
=
new
BigInteger
(
number
);
BigInteger
bigRadix
=
new
BigInteger
(
radix
+
""
);
Stack
<
Character
>
stack
=
new
Stack
<>();
StringBuilder
result
=
new
StringBuilder
(
0
);
while
(!
bigNumber
.
equals
(
INTEGER0
))
{
stack
.
add
(
chs
[
bigNumber
.
remainder
(
bigRadix
).
intValue
()]);
bigNumber
=
bigNumber
.
divide
(
bigRadix
);
}
for
(;
!
stack
.
isEmpty
();
)
{
result
.
append
(
stack
.
pop
());
}
return
result
.
length
()
==
0
?
"0"
:
result
.
toString
();
}
}
wj-common/src/main/java/com/wanji/common/utils/tool/JsonXmlUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
tool
;
import
com.wanji.common.tool.wsdltool.DoSoapTool
;
import
org.dom4j.DocumentException
;
import
org.json.JSONObject
;
import
org.json.XML
;
import
java.io.IOException
;
/**
* @ClassName JsonXmlUtils
* @Description
* @Author mapabc7
* @Date 2020/7/28 10:34
* @Version 1.0
*/
public
class
JsonXmlUtils
{
private
static
JSONObject
xmlToJson
(
String
xml
,
boolean
keepStrings
)
{
if
(
StringUtils
.
isNotBlank
(
xml
))
{
JSONObject
jsonObject
=
XML
.
toJSONObject
(
xml
,
keepStrings
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
JSONObject
json
=
new
JSONObject
();
String
envelope
=
null
;
for
(
String
s
:
jsonObject
.
keySet
())
{
if
(
StringUtils
.
containsIgnoreCase
(
s
,
"Envelope"
))
{
envelope
=
s
;
break
;
}
}
stringBuilder
.
append
(
envelope
);
JSONObject
envelopeValue
=
jsonObject
.
getJSONObject
(
envelope
);
// 组装重构生成的json
packageJson
(
stringBuilder
,
envelopeValue
);
json
.
put
(
stringBuilder
.
toString
(),
envelopeValue
);
return
json
;
}
return
null
;
}
public
static
String
xmlToJsonString
(
String
xml
)
{
return
xmlToJsonString
(
xml
,
true
);
}
public
static
String
soapXmlToJsonString
(
String
xml
)
{
return
xmlToJsonString
(
xml
,
true
);
}
public
static
String
xmlToJsonString
(
String
xml
,
boolean
keepStrings
)
{
if
(
StringUtils
.
isNotBlank
(
xml
))
{
JSONObject
jsonObject
=
xmlToJson
(
xml
,
keepStrings
);
if
(
jsonObject
!=
null
)
{
return
jsonObject
.
toString
();
}
}
return
null
;
}
public
static
String
jsonToXml
(
Object
json
)
{
if
(
json
!=
null
)
{
String
s
=
XML
.
toString
(
new
JSONObject
(
json
+
";"
));
return
s
.
substring
(
0
,
s
.
lastIndexOf
(
":Envelope"
))
+
":Envelope>"
;
}
return
null
;
}
public
static
String
jsonToSoapXml
(
Object
json
)
{
if
(
json
!=
null
)
{
String
s
=
XML
.
toString
(
new
JSONObject
(
json
+
";"
));
return
s
.
substring
(
0
,
s
.
lastIndexOf
(
":Envelope"
))
+
":Envelope>"
;
}
return
null
;
}
private
static
void
packageJson
(
StringBuilder
stringBuilder
,
JSONObject
envelopeValue
)
{
for
(
String
s
:
envelopeValue
.
keySet
())
{
if
(
s
.
startsWith
(
"xmlns:"
))
{
stringBuilder
.
append
(
" "
).
append
(
s
).
append
(
"="
).
append
(
"\""
).
append
(
envelopeValue
.
getString
(
s
)).
append
(
"\""
);
envelopeValue
.
remove
(
s
);
if
(
envelopeValue
.
length
()
>
0
)
{
packageJson
(
stringBuilder
,
envelopeValue
);
}
return
;
}
}
}
public
static
void
main
(
String
[]
args
)
throws
DocumentException
,
IOException
{
String
xml
=
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:web=\"http://WebXml.com.cn/\">\n"
+
" <soap:Header/>\n"
+
" <soap:Body>\n"
+
" <web:getSupportCity>\n"
+
" <!--Optional:-->\n"
+
" <web:byProvinceName>河北</web:byProvinceName>\n"
+
" </web:getSupportCity>\n"
+
" </soap:Body>\n"
+
"</soap:Envelope>"
;
String
s2
=
DoSoapTool
.
doPostSoap
(
"http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"
,
xml
);
System
.
out
.
println
(
s2
);
}
}
wj-common/src/main/java/com/wanji/common/utils/webservice/SoapUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
webservice
;
import
com.alibaba.fastjson.JSON
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @ClassName SoapUtils
* @Description
* @Author mapabc7
* @Date 2020/6/1 18:20
* @Version 1.0
*/
public
class
SoapUtils
{
/**
* 生成soapxml
*
* @param targetNamespace
* @param functionName
* @param bodyMap
* @return
*/
public
static
String
buildSoapXml
(
String
targetNamespace
,
String
functionName
,
Map
<
String
,
Object
>
bodyMap
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
)
.
append
(
"\t<soap:Body>\n"
)
.
append
(
"\t\t<"
+
functionName
+
" xmlns=\""
+
targetNamespace
+
"\">\n"
)
.
append
(
paramTransformSoapXml
(
bodyMap
))
.
append
(
"\t\t</"
+
functionName
+
">\n"
)
.
append
(
"\t</soap:Body>\n"
)
.
append
(
"</soap:Envelope>"
);
return
String
.
valueOf
(
stringBuilder
);
}
/**
* 将参数转化为soapXml中的一部分
*
* @param paramMap
* @return
*/
private
static
String
paramTransformSoapXml
(
Map
<
String
,
Object
>
paramMap
)
{
if
(
paramMap
.
isEmpty
())
{
return
""
;
}
StringBuilder
stringBuilder
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
paramMap
.
entrySet
())
{
stringBuilder
.
append
(
paramTransformSoapXml
(
entry
));
}
return
String
.
valueOf
(
stringBuilder
);
}
private
static
String
paramTransformSoapXml
(
Map
.
Entry
<
String
,
Object
>
entry
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
String
entryKey
=
entry
.
getKey
();
Object
entryValue
=
entry
.
getValue
();
if
(
entryValue
instanceof
Map
)
{
stringBuilder
.
append
(
"\t\t\t"
).
append
(
"<"
+
entryKey
+
">\n"
);
stringBuilder
.
append
(
paramTransformSoapXml
(
JSON
.
parseObject
(
JSON
.
toJSONString
(
entryValue
))));
stringBuilder
.
append
(
"\t\t\t"
).
append
(
"</"
+
entryKey
+
">\n"
);
}
else
{
stringBuilder
.
append
(
"\t\t\t"
).
append
(
"<"
+
entryKey
+
">"
).
append
(
entryValue
).
append
(
"</"
+
entryKey
+
">\n"
);
}
return
String
.
valueOf
(
stringBuilder
);
}
public
static
void
main
(
String
[]
args
)
{
String
targetNamespace
=
"http://WebXml.com.cn/"
;
String
funName
=
"getSupportCity"
;
Map
bodyMap
=
new
HashMap
()
{{
put
(
"byProvinceName"
,
"河北"
);
}};
String
soapXml
=
SoapUtils
.
buildSoapXml
(
targetNamespace
,
funName
,
bodyMap
);
System
.
out
.
println
(
soapXml
);
}
}
wj-common/src/main/java/com/wanji/common/utils/webservice/WebServiceUtils.java
deleted
100644 → 0
View file @
c394b630
package
com
.
wanji
.
common
.
utils
.
webservice
;
import
com.wanji.common.framework.exception.DubboProviderException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.util.EntityUtils
;
import
java.nio.charset.Charset
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by mapabc4 on 2019/5/22.
*/
@Slf4j
public
class
WebServiceUtils
{
// 请求超时时间
static
int
socketTimeout
=
30000
;
// 传输超时时间
static
int
connectTimeout
=
30000
;
/**
* 使用SOAP1.1发送消息
*
* @param postUrl
* @param soapXml
* @return
*/
public
static
String
doPostSoap1_1
(
String
postUrl
,
String
soapXml
,
Map
<
String
,
Object
>
headerMap
)
throws
DubboProviderException
{
String
retStr
=
""
;
// 创建HttpClientBuilder
HttpClientBuilder
httpClientBuilder
=
HttpClientBuilder
.
create
();
// HttpClient
CloseableHttpClient
closeableHttpClient
=
httpClientBuilder
.
build
();
HttpPost
httpPost
=
new
HttpPost
(
postUrl
);
// 设置请求和传输超时时间
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setSocketTimeout
(
socketTimeout
)
.
setConnectTimeout
(
connectTimeout
).
build
();
httpPost
.
setConfig
(
requestConfig
);
try
{
// httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
httpPost
.
setHeader
(
"Content-Type"
,
String
.
valueOf
(
headerMap
.
get
(
"Content-Type"
)));
StringEntity
data
=
new
StringEntity
(
soapXml
,
Charset
.
forName
(
"UTF-8"
));
httpPost
.
setEntity
(
data
);
CloseableHttpResponse
response
=
closeableHttpClient
.
execute
(
httpPost
);
HttpEntity
httpEntity
=
response
.
getEntity
();
if
(
httpEntity
!=
null
)
{
// 打印响应内容
retStr
=
EntityUtils
.
toString
(
httpEntity
,
"UTF-8"
);
log
.
info
(
"response:"
+
retStr
);
}
// 释放资源
closeableHttpClient
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
"exception in doPostSoap1_1"
,
e
);
throw
new
DubboProviderException
(
e
);
}
return
retStr
;
}
/**
* 使用SOAP1.2发送消息
*
* @param postUrl
* @param soapXml
* @param soapAction
* @return
*/
public
static
String
doPostSoap1_2
(
String
postUrl
,
String
soapXml
,
String
soapAction
,
Map
<
String
,
Object
>
headerMap
)
{
String
retStr
=
""
;
// 创建HttpClientBuilder
HttpClientBuilder
httpClientBuilder
=
HttpClientBuilder
.
create
();
// HttpClient
CloseableHttpClient
closeableHttpClient
=
httpClientBuilder
.
build
();
HttpPost
httpPost
=
new
HttpPost
(
postUrl
);
// 设置请求和传输超时时间
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setSocketTimeout
(
socketTimeout
)
.
setConnectTimeout
(
connectTimeout
).
build
();
httpPost
.
setConfig
(
requestConfig
);
try
{
// httpPost.setHeader("Content-Type",
// "application/soap+xml;charset=UTF-8");
httpPost
.
setHeader
(
"Content-Type"
,
String
.
valueOf
(
headerMap
.
get
(
"Content-Type"
)));
httpPost
.
setHeader
(
"SOAPAction"
,
soapAction
);
StringEntity
data
=
new
StringEntity
(
soapXml
,
Charset
.
forName
(
"UTF-8"
));
httpPost
.
setEntity
(
data
);
CloseableHttpResponse
response
=
closeableHttpClient
.
execute
(
httpPost
);
HttpEntity
httpEntity
=
response
.
getEntity
();
if
(
httpEntity
!=
null
)
{
// 打印响应内容
retStr
=
EntityUtils
.
toString
(
httpEntity
,
"UTF-8"
);
log
.
info
(
"response:"
+
retStr
);
}
// 释放资源
closeableHttpClient
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
"exception in doPostSoap1_2"
,
e
);
}
return
retStr
;
}
public
static
void
main
(
String
[]
args
)
{
String
url
=
"http://192.168.10.179:8080/helloService?wsdl"
;
String
targetNamespace
=
"http://webservice.restful.design.bp.com/"
;
String
funName
=
"sayHello"
;
Map
bodyMap
=
new
HashMap
()
{{
put
(
"message"
,
"你好"
);
}};
String
xml
=
SoapUtils
.
buildSoapXml
(
targetNamespace
,
funName
,
bodyMap
);
System
.
out
.
println
(
xml
);
try
{
System
.
out
.
println
(
doPostSoap1_1
(
url
,
xml
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"Content-Type"
,
"text/xml; charset=utf-8"
);
}}));
}
catch
(
DubboProviderException
e
)
{
e
.
printStackTrace
();
}
}
}
wj-common/src/main/java/net/wanji/common/TestCommon.java
deleted
100644 → 0
View file @
c394b630
package
net
.
wanji
.
common
;
/**
* @author Kent HAN
* @date 2023/1/17 10:45
*/
public
class
TestCommon
{
private
String
testString
;
public
String
getTestString
()
{
return
testString
;
}
public
void
setTestString
(
String
testString
)
{
this
.
testString
=
testString
;
}
}
wj-common/src/main/java/
com
/wanji/common/action/BuiltInActionLibraryUtils.java
→
wj-common/src/main/java/
net
/wanji/common/action/BuiltInActionLibraryUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
com
.wanji.common.annotation.ActionBean
;
import
com
.wanji.common.annotation.ActionMethod
;
import
com
.wanji.common.annotation.ActionMethodParameter
;
import
com
.wanji.common.enums.Datatype
;
import
net
.wanji.common.annotation.ActionBean
;
import
net
.wanji.common.annotation.ActionMethod
;
import
net
.wanji.common.annotation.ActionMethodParameter
;
import
net
.wanji.common.enums.Datatype
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
;
...
...
wj-common/src/main/java/
com
/wanji/common/action/DateAction.java
→
wj-common/src/main/java/
net
/wanji/common/action/DateAction.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
com
.wanji.common.annotation.ActionBean
;
import
com
.wanji.common.annotation.ActionMethod
;
import
com
.wanji.common.annotation.ActionMethodParameter
;
import
net
.wanji.common.annotation.ActionBean
;
import
net
.wanji.common.annotation.ActionMethod
;
import
net
.wanji.common.annotation.ActionMethodParameter
;
import
org.apache.commons.lang3.StringUtils
;
import
java.text.ParseException
;
...
...
wj-common/src/main/java/
com
/wanji/common/action/Method.java
→
wj-common/src/main/java/
net
/wanji/common/action/Method.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
com
.wanji.common.enums.Datatype
;
import
net
.wanji.common.enums.Datatype
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.commons.compress.utils.Lists
;
...
...
wj-common/src/main/java/
com
/wanji/common/action/Parameter.java
→
wj-common/src/main/java/
net
/wanji/common/action/Parameter.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
com
.wanji.common.enums.Datatype
;
import
net
.wanji.common.enums.Datatype
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
wj-common/src/main/java/
com
/wanji/common/action/SpringBean.java
→
wj-common/src/main/java/
net
/wanji/common/action/SpringBean.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
wj-common/src/main/java/
com
/wanji/common/action/StringAction.java
→
wj-common/src/main/java/
net
/wanji/common/action/StringAction.java
View file @
2785c05f
package
com
.
wanji
.
common
.
action
;
package
net
.
wanji
.
common
.
action
;
import
com
.wanji.common.annotation.ActionBean
;
import
com
.wanji.common.annotation.ActionMethod
;
import
com
.wanji.common.annotation.ActionMethodParameter
;
import
net
.wanji.common.annotation.ActionBean
;
import
net
.wanji.common.annotation.ActionMethod
;
import
net
.wanji.common.annotation.ActionMethodParameter
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
...
...
wj-common/src/main/java/
com
/wanji/common/annotation/ActionBean.java
→
wj-common/src/main/java/
net
/wanji/common/annotation/ActionBean.java
View file @
2785c05f
package
com
.
wanji
.
common
.
annotation
;
package
net
.
wanji
.
common
.
annotation
;
import
org.springframework.stereotype.Component
;
...
...
wj-common/src/main/java/
com
/wanji/common/annotation/ActionMethod.java
→
wj-common/src/main/java/
net
/wanji/common/annotation/ActionMethod.java
View file @
2785c05f
package
com
.
wanji
.
common
.
annotation
;
package
net
.
wanji
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
wj-common/src/main/java/
com
/wanji/common/annotation/ActionMethodParameter.java
→
wj-common/src/main/java/
net
/wanji/common/annotation/ActionMethodParameter.java
View file @
2785c05f
package
com
.
wanji
.
common
.
annotation
;
package
net
.
wanji
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
wj-common/src/main/java/
com
/wanji/common/enums/Datatype.java
→
wj-common/src/main/java/
net
/wanji/common/enums/Datatype.java
View file @
2785c05f
package
com
.
wanji
.
common
.
enums
;
package
net
.
wanji
.
common
.
enums
;
import
java.util.Arrays
;
...
...
wj-common/src/main/java/
com
/wanji/common/enums/FormOfWayEnum.java
→
wj-common/src/main/java/
net
/wanji/common/enums/FormOfWayEnum.java
View file @
2785c05f
package
com
.
wanji
.
common
.
enums
;
package
net
.
wanji
.
common
.
enums
;
public
enum
FormOfWayEnum
{
...
...
wj-common/src/main/java/
com
/wanji/common/enums/RoadClassEnum.java
→
wj-common/src/main/java/
net
/wanji/common/enums/RoadClassEnum.java
View file @
2785c05f
package
com
.
wanji
.
common
.
enums
;
package
net
.
wanji
.
common
.
enums
;
public
enum
RoadClassEnum
{
...
...
wj-common/src/main/java/
com
/wanji/common/framework/Constants.java
→
wj-common/src/main/java/
net
/wanji/common/framework/Constants.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
;
package
net
.
wanji
.
common
.
framework
;
import
java.sql.Connection
;
import
java.util.ArrayList
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/HttpCode.java
→
wj-common/src/main/java/
net
/wanji/common/framework/HttpCode.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
;
package
net
.
wanji
.
common
.
framework
;
/**
* Ajax 请求时的自定义查询状态码,主要参考Http状态码,但并不完全对应
...
...
wj-common/src/main/java/
com
/wanji/common/framework/config/ConfigHelper.java
→
wj-common/src/main/java/
net
/wanji/common/framework/config/ConfigHelper.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
config
;
package
net
.
wanji
.
common
.
framework
.
config
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.utils.tool.DateUtil
;
import
com
.wanji.common.utils.file.FileUtil
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.utils.tool.DateUtil
;
import
net
.wanji.common.utils.file.FileUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/config/SafeProperties.java
→
wj-common/src/main/java/
net
/wanji/common/framework/config/SafeProperties.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
config
;
package
net
.
wanji
.
common
.
framework
.
config
;
import
com.google.common.collect.Lists
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/DbFactory.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/DbFactory.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
;
package
net
.
wanji
.
common
.
framework
.
db
;
import
com.wanji.common.framework.db.impl.MysqlDBImpl
;
import
com.wanji.common.framework.db.impl.OracleDBImpl
;
import
com.wanji.common.framework.db.impl.PostgresqlDBImpl
;
import
com.wanji.common.framework.db.impl.SQLServerDBImpl
;
import
com.wanji.common.framework.domain.Db
;
import
com.wanji.common.framework.spring.ServiceBeanContext
;
import
net.wanji.common.framework.db.impl.MysqlDBImpl
;
import
net.wanji.common.framework.db.impl.OracleDBImpl
;
import
net.wanji.common.framework.db.impl.PostgresqlDBImpl
;
import
net.wanji.common.framework.db.impl.SQLServerDBImpl
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DataBase
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
DBType
.
SQLSERVER
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DataBase
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
DBType
.
SQLSERVER
;
/**
* 数据库基础接口简单工厂类
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/DbInterface.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/DbInterface.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
;
import
com.wanji.common.framework.Constants
;
import
com.wanji.common.framework.domain.Db
;
import
com.wanji.common.framework.domain.View
;
import
com.wanji.common.framework.exception.NodeException
;
import
com.wanji.common.framework.rest.Page
;
import
com.wanji.common.tool.dbtools.DSUtils
;
import
com.wanji.common.utils.tool.StringUtils
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
package
net
.
wanji
.
common
.
framework
.
db
;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.framework.domain.Db
;
import
net.wanji.common.framework.exception.NodeException
;
import
net.wanji.common.framework.rest.Page
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BETWEEN_OPERATION
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
IN_OPERATION
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BETWEEN_OPERATION
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
IN_OPERATION
;
/**
* Sql拼接:复杂的使用已经封装好的MySQL、Oracle sql构造器即可。
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/impl/MysqlDBImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/impl/MysqlDBImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
.
impl
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.db.DbInterface
;
import
com
.wanji.common.framework.domain.Db
;
import
com
.wanji.common.framework.exception.NodeException
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.dbtools.MySQL
;
package
net
.
wanji
.
common
.
framework
.
db
.
impl
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.db.DbInterface
;
import
net
.wanji.common.framework.domain.Db
;
import
net
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.dbtools.MySQL
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
MYSQL
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
MYSQL
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
/**
* Mysql数据库的基础操作接口实现
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/impl/OracleDBImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/impl/OracleDBImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
.
impl
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.db.DbInterface
;
import
com
.wanji.common.framework.domain.Db
;
import
com
.wanji.common.framework.exception.NodeException
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.dbtools.Oracle
;
package
net
.
wanji
.
common
.
framework
.
db
.
impl
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.db.DbInterface
;
import
net
.wanji.common.framework.domain.Db
;
import
net
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.dbtools.Oracle
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
ORACLE
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
OracleColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
ORACLE
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
OracleColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
/**
* Oracle数据库的基础操作接口实现
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/impl/PostgresqlDBImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/impl/PostgresqlDBImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
.
impl
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.db.DbInterface
;
import
com
.wanji.common.framework.domain.Db
;
import
com
.wanji.common.framework.exception.NodeException
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.dbtools.PostgreSQL
;
package
net
.
wanji
.
common
.
framework
.
db
.
impl
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.db.DbInterface
;
import
net
.wanji.common.framework.domain.Db
;
import
net
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.dbtools.PostgreSQL
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.sql.Date
;
...
...
@@ -16,9 +15,9 @@ import java.sql.Timestamp;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
/**
* Mysql数据库的基础操作接口实现
...
...
@@ -178,7 +177,7 @@ public class PostgresqlDBImpl implements DbInterface {
case
INT2:
return
Integer
.
valueOf
(
fieldValue
);
case
BOOL:
case
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
BIT
:
case
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
BIT
:
return
Boolean
.
valueOf
(
fieldValue
);
case
NUMERIC:
return
new
BigDecimal
(
fieldValue
);
...
...
@@ -193,7 +192,7 @@ public class PostgresqlDBImpl implements DbInterface {
case
BYTEA:
case
TEXT:
case
BPCHAR:
case
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
VARCHAR
:
case
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
VARCHAR
:
case
BOX:
case
CIDR:
case
INET:
...
...
wj-common/src/main/java/
com
/wanji/common/framework/db/impl/SQLServerDBImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/db/impl/SQLServerDBImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
db
.
impl
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.db.DbInterface
;
import
com
.wanji.common.framework.domain.Db
;
import
com
.wanji.common.framework.exception.NodeException
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.dbtools.SQLServer
;
package
net
.
wanji
.
common
.
framework
.
db
.
impl
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.db.DbInterface
;
import
net
.wanji.common.framework.domain.Db
;
import
net
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.dbtools.SQLServer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
SQLSERVER
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
SqlServerColumn
.
DATETIME2
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
SQLSERVER
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
BLANK
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.
FIELD_NAME_EN
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
SqlServerColumn
.
DATETIME2
;
/**
* SQLServer 数据库的基础操作接口实现
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/Db.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/Db.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/FieldName.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/FieldName.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/OperationLog.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/OperationLog.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
io.swagger.annotations.ApiModel
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/Table.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/Table.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/TileBox.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/TileBox.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
java.io.Serializable
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/TrackableEntity.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/TrackableEntity.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.wanji.common.utils.tool.IDGenerator
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.wanji.common.utils.tool.IDGenerator
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/domain/View.java
→
wj-common/src/main/java/
net
/wanji/common/framework/domain/View.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
domain
;
package
net
.
wanji
.
common
.
framework
.
domain
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/dubbointerface/BaseDubboInterface.java
→
wj-common/src/main/java/
net
/wanji/common/framework/dubbointerface/BaseDubboInterface.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
dubbointerface
;
package
net
.
wanji
.
common
.
framework
.
dubbointerface
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.rest.Page
;
import
java.util.List
;
import
java.util.Map
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/dubbointerface/BaseLogInterface.java
→
wj-common/src/main/java/
net
/wanji/common/framework/dubbointerface/BaseLogInterface.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
dubbointerface
;
package
net
.
wanji
.
common
.
framework
.
dubbointerface
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
java.util.Map
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/dubbointerface/impl/BaseDubboInterfaceImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/dubbointerface/impl/BaseDubboInterfaceImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
dubbointerface
.
impl
;
package
net
.
wanji
.
common
.
framework
.
dubbointerface
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.domain.OperationLog
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
com
.wanji.common.framework.dubbointerface.BaseDubboInterface
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.framework.mapper.BaseInterfaceMapper
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.mqtool.MqUtil
;
import
com
.wanji.common.utils.tool.IDGenerator
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.domain.OperationLog
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.dubbointerface.BaseDubboInterface
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.mapper.BaseInterfaceMapper
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.mqtool.MqUtil
;
import
net
.wanji.common.utils.tool.IDGenerator
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
eu.bitwalker.useragentutils.OperatingSystem
;
import
eu.bitwalker.useragentutils.UserAgent
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -22,7 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
/**
* @author mapabc
...
...
wj-common/src/main/java/
com
/wanji/common/framework/dubbointerface/impl/BaseLogInterfaceImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/dubbointerface/impl/BaseLogInterfaceImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
dubbointerface
.
impl
;
import
com
.wanji.common.framework.dubbointerface.BaseLogInterface
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.framework.rest.Page
;
import
com
.wanji.common.tool.estool.EsConfiguration
;
import
com
.wanji.common.tool.estool.EsUtil
;
import
com
.wanji.common.utils.tool.IDGenerator
;
package
net
.
wanji
.
common
.
framework
.
dubbointerface
.
impl
;
import
net
.wanji.common.framework.dubbointerface.BaseLogInterface
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.tool.estool.EsConfiguration
;
import
net
.wanji.common.tool.estool.EsUtil
;
import
net
.wanji.common.utils.tool.IDGenerator
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/event/BaseEvent.java
→
wj-common/src/main/java/
net
/wanji/common/framework/event/BaseEvent.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
event
;
package
net
.
wanji
.
common
.
framework
.
event
;
import
org.springframework.context.ApplicationEvent
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/DubboProviderException.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/DubboProviderException.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
/**
* @author mapabc
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/Json2BpmnXmlException.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/Json2BpmnXmlException.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
/**
* 类描述: bpmn20.xml写入异常
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/NodeException.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/NodeException.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
/**
* 节点异常处理
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/ProcessServiceException.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/ProcessServiceException.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
/**
* 类描述: 流程服务异常
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/RestArgumentsExceptionHandler.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/RestArgumentsExceptionHandler.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/exception/WorkFlowException.java
→
wj-common/src/main/java/
net
/wanji/common/framework/exception/WorkFlowException.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
exception
;
package
net
.
wanji
.
common
.
framework
.
exception
;
/**
* l流程异常处理
...
...
wj-common/src/main/java/
com
/wanji/common/framework/i18n/Constants.java
→
wj-common/src/main/java/
net
/wanji/common/framework/i18n/Constants.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
i18n
;
package
net
.
wanji
.
common
.
framework
.
i18n
;
/**
* @Description:国际化中,中文定义的词条
...
...
wj-common/src/main/java/
com
/wanji/common/framework/i18n/Constants_en.java
→
wj-common/src/main/java/
net
/wanji/common/framework/i18n/Constants_en.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
i18n
;
package
net
.
wanji
.
common
.
framework
.
i18n
;
/**
* @Description:国际化中,英文定义的词条
...
...
wj-common/src/main/java/
com
/wanji/common/framework/i18n/I18nResourceBundle.java
→
wj-common/src/main/java/
net
/wanji/common/framework/i18n/I18nResourceBundle.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
i18n
;
package
net
.
wanji
.
common
.
framework
.
i18n
;
import
org.apache.commons.lang3.StringUtils
;
import
java.lang.reflect.Field
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/log/AbstractLog.java
→
wj-common/src/main/java/
net
/wanji/common/framework/log/AbstractLog.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
log
;
package
net
.
wanji
.
common
.
framework
.
log
;
import
com.alibaba.fastjson.JSONObject
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.domain.OperationLog
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.tool.mqtool.MqUtil
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.domain.OperationLog
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.tool.mqtool.MqUtil
;
import
eu.bitwalker.useragentutils.OperatingSystem
;
import
eu.bitwalker.useragentutils.UserAgent
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -18,7 +18,7 @@ import java.util.Date;
import
java.util.Map
;
import
java.util.Objects
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
@Slf4j
public
abstract
class
AbstractLog
{
...
...
wj-common/src/main/java/
com
/wanji/common/framework/mapper/BaseInterfaceMapper.java
→
wj-common/src/main/java/
net
/wanji/common/framework/mapper/BaseInterfaceMapper.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
mapper
;
package
net
.
wanji
.
common
.
framework
.
mapper
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.cache.annotation.Cacheable
;
import
java.util.List
;
import
java.util.Map
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/mapper/ExportImportMapper.java
→
wj-common/src/main/java/
net
/wanji/common/framework/mapper/ExportImportMapper.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
mapper
;
package
net
.
wanji
.
common
.
framework
.
mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/AbstractRestServer.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/AbstractRestServer.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
io.swagger.annotations.*
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.*;
import
javax.validation.constraints.NotBlank
;
import
javax.ws.rs.QueryParam
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Map
;
/**
* @author mapabc
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/BeanValidationGroups.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/BeanValidationGroups.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
/**
* bean验证分组
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/HeaderMapRequestWrapper.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/HeaderMapRequestWrapper.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/JsonViewObject.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/JsonViewObject.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.HttpCode
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.HttpCode
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/LogAbstractRestServer.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/LogAbstractRestServer.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/MyValidator.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/MyValidator.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
//import javax.validation.ConstraintViolation;
//import javax.validation.Validation;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/Node.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/Node.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/NodeDTO.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/NodeDTO.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/Page.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/Page.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/ValidationGroups.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/ValidationGroups.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
;
package
net
.
wanji
.
common
.
framework
.
rest
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
javax.validation.groups.Default
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/impl/AbstractRestServerImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/impl/AbstractRestServerImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
.
impl
;
package
net
.
wanji
.
common
.
framework
.
rest
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.domain.OperationLog
;
import
com
.wanji.common.framework.domain.TrackableEntity
;
import
com
.wanji.common.framework.dubbointerface.BaseDubboInterface
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.framework.i18n.I18nResourceBundle
;
import
com
.wanji.common.framework.rest.AbstractRestServer
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.framework.rest.Page
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.domain.OperationLog
;
import
net
.wanji.common.framework.domain.TrackableEntity
;
import
net
.wanji.common.framework.dubbointerface.BaseDubboInterface
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.i18n.I18nResourceBundle
;
import
net
.wanji.common.framework.rest.AbstractRestServer
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.rest.Page
;
import
com.google.common.collect.Maps
;
import
com
.wanji.common.tool.mqtool.MqUtil
;
import
net
.wanji.common.tool.mqtool.MqUtil
;
import
eu.bitwalker.useragentutils.OperatingSystem
;
import
eu.bitwalker.useragentutils.UserAgent
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -29,7 +29,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Objects
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
/**
* @author mapabc
...
...
wj-common/src/main/java/
com
/wanji/common/framework/rest/impl/LogAbstractRestServerImpl.java
→
wj-common/src/main/java/
net
/wanji/common/framework/rest/impl/LogAbstractRestServerImpl.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
rest
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wanji.common.framework.domain.OperationLog
;
import
com.wanji.common.framework.domain.TrackableEntity
;
import
com.wanji.common.framework.dubbointerface.BaseLogInterface
;
import
com.wanji.common.framework.rest.JsonViewObject
;
import
com.wanji.common.framework.rest.LogAbstractRestServer
;
import
com.wanji.common.tool.mqtool.MqUtil
;
package
net
.
wanji
.
common
.
framework
.
rest
.
impl
;
import
net.wanji.common.framework.dubbointerface.BaseLogInterface
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.LogAbstractRestServer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.ws.rs.core.Context
;
import
java.util.Date
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
LogType
.
OPERATION_LOG
;
@Slf4j
public
abstract
class
LogAbstractRestServerImpl
implements
LogAbstractRestServer
{
...
...
wj-common/src/main/java/
com
/wanji/common/framework/spring/ServiceBeanContext.java
→
wj-common/src/main/java/
net
/wanji/common/framework/spring/ServiceBeanContext.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
spring
;
package
net
.
wanji
.
common
.
framework
.
spring
;
import
org.springframework.context.ApplicationContext
;
...
...
wj-common/src/main/java/
com
/wanji/common/framework/thread/NamedThreadFactory.java
→
wj-common/src/main/java/
net
/wanji/common/framework/thread/NamedThreadFactory.java
View file @
2785c05f
package
com
.
wanji
.
common
.
framework
.
thread
;
package
net
.
wanji
.
common
.
framework
.
thread
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/DBUtils.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/DBUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.exception.NodeException
;
import
org.apache.commons.lang.StringUtils
;
import
java.math.BigDecimal
;
...
...
@@ -14,9 +14,9 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
PATH
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
PATH
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
/**
* 数据库相关处理帮助类
...
...
@@ -114,7 +114,7 @@ public class DBUtils {
case
INT2:
return
Integer
.
valueOf
(
fieldValue
);
case
BOOL:
case
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
BIT
:
case
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
BIT
:
return
Boolean
.
valueOf
(
fieldValue
);
case
NUMERIC:
return
new
BigDecimal
(
fieldValue
);
...
...
@@ -129,7 +129,7 @@ public class DBUtils {
case
BYTEA:
case
TEXT:
case
BPCHAR:
case
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
VARCHAR
:
case
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
VARCHAR
:
case
BOX:
case
CIDR:
case
INET:
...
...
@@ -154,7 +154,7 @@ public class DBUtils {
String
fieldType
=
String
.
valueOf
(
paramMap
.
get
(
FIELD_TYPE
));
String
fieldValue
=
String
.
valueOf
(
paramMap
.
get
(
FIELD_VALUE
));
if
(
com
.
wanji
.
common
.
utils
.
tool
.
StringUtils
.
equalsIgnoreCase
(
fieldValue
,
"null"
))
{
if
(
net
.
wanji
.
common
.
utils
.
tool
.
StringUtils
.
equalsIgnoreCase
(
fieldValue
,
"null"
))
{
list
.
add
(
null
);
}
else
{
list
.
add
(
typeHandler
(
fieldType
,
fieldValue
));
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/DSPool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/DSPool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.google.common.collect.Maps
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/DSUtils.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/DSUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.domain.Table
;
import
com
.wanji.common.framework.exception.NodeException
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.domain.Table
;
import
net
.wanji.common.framework.exception.NodeException
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -16,22 +16,22 @@ import org.apache.commons.lang3.StringUtils;
import
java.sql.*
;
import
java.util.*
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DataBase
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
BEYONDB
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
MYSQL
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
ORACLE
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
SQLSERVER
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
BIT
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
FLOAT
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
VARCHAR
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
OracleColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
DATE
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
TEXT
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
TIMESTAMP
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServiceGateWayConstants
.
D2ADataBase
.*;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
TableInfo
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DataBase
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
BEYONDB
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
MYSQL
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
ORACLE
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DbDriver
.
SQLSERVER
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
BIT
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
FLOAT
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.
VARCHAR
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
MysqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
OracleColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
DATE
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
TEXT
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.
TIMESTAMP
;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
PostGreSqlColumn
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServiceGateWayConstants
.
D2ADataBase
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
TableInfo
.*;
/**
* @author mapabc
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/MySQL.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/MySQL.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
/**
* MySQL sql构造器。
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/Oracle.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/Oracle.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
/**
* Oracle sql 构造器。
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/PostgreSQL.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/PostgreSQL.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
/**
* MySQL sql构造器。
...
...
wj-common/src/main/java/
com
/wanji/common/tool/dbtools/SQLServer.java
→
wj-common/src/main/java/
net
/wanji/common/tool/dbtools/SQLServer.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
dbtools
;
package
net
.
wanji
.
common
.
tool
.
dbtools
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
ServicePublishConstants
.
SqlConstants
.*;
/**
* @Author mapabc6
...
...
wj-common/src/main/java/
com
/wanji/common/tool/drools/AddFunction.java
→
wj-common/src/main/java/
net
/wanji/common/tool/drools/AddFunction.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
drools
;
package
net
.
wanji
.
common
.
tool
.
drools
;
import
com.alipay.jarslink.api.Module
;
import
com.googlecode.aviator.runtime.function.AbstractFunction
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/drools/AviatorTool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/drools/AviatorTool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
drools
;
package
net
.
wanji
.
common
.
tool
.
drools
;
import
com
.wanji.common.action.BuiltInActionLibraryUtils
;
import
com
.wanji.common.action.SpringBean
;
import
net
.wanji.common.action.BuiltInActionLibraryUtils
;
import
net
.wanji.common.action.SpringBean
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/drools/AviatorUtils.java
→
wj-common/src/main/java/
net
/wanji/common/tool/drools/AviatorUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
drools
;
package
net
.
wanji
.
common
.
tool
.
drools
;
import
com
.wanji.common.utils.tool.MD5Util
;
import
net
.wanji.common.utils.tool.MD5Util
;
import
com.google.common.collect.Maps
;
import
com.googlecode.aviator.AviatorEvaluator
;
import
org.apache.commons.collections4.MapUtils
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/drools/DroolsTool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/drools/DroolsTool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
drools
;
package
net
.
wanji
.
common
.
tool
.
drools
;
import
com.alipay.jarslink.api.ModuleManager
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.framework.spring.ServiceBeanContext
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.framework.spring.ServiceBeanContext
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/drools/DroolsUtils.java
→
wj-common/src/main/java/
net
/wanji/common/tool/drools/DroolsUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
drools
;
package
net
.
wanji
.
common
.
tool
.
drools
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
org.drools.compiler.kie.builder.impl.InternalKieModule
;
import
org.kie.api.KieServices
;
import
org.kie.api.builder.KieBuilder
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/estool/EsConfiguration.java
→
wj-common/src/main/java/
net
/wanji/common/tool/estool/EsConfiguration.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
estool
;
package
net
.
wanji
.
common
.
tool
.
estool
;
import
com
.wanji.common.framework.spring.ServiceBeanContext
;
import
net
.wanji.common.framework.spring.ServiceBeanContext
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.client.transport.TransportClient
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/estool/EsProperties.java
→
wj-common/src/main/java/
net
/wanji/common/tool/estool/EsProperties.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
estool
;
package
net
.
wanji
.
common
.
tool
.
estool
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/estool/EsUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/estool/EsUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
estool
;
package
net
.
wanji
.
common
.
tool
.
estool
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/http/HttpsClient.java
→
wj-common/src/main/java/
net
/wanji/common/tool/http/HttpsClient.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
http
;
package
net
.
wanji
.
common
.
tool
.
http
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.Header
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/jobtool/JobTool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/jobtool/JobTool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
jobtool
;
package
net
.
wanji
.
common
.
tool
.
jobtool
;
import
lombok.extern.slf4j.Slf4j
;
import
org.quartz.*
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/jobtool/RetryTemplate.java
→
wj-common/src/main/java/
net
/wanji/common/tool/jobtool/RetryTemplate.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
jobtool
;
package
net
.
wanji
.
common
.
tool
.
jobtool
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/kafkatool/KafkaUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/kafkatool/KafkaUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
kafkatool
;
package
net
.
wanji
.
common
.
tool
.
kafkatool
;
import
com.google.common.collect.Maps
;
import
org.apache.kafka.clients.KafkaClient
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.apache.kafka.clients.consumer.ConsumerRecords
;
import
org.apache.kafka.clients.consumer.KafkaConsumer
;
import
org.apache.kafka.clients.producer.KafkaProducer
;
import
org.apache.kafka.clients.producer.Producer
;
import
org.apache.kafka.common.PartitionInfo
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/mqtool/MqUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/mqtool/MqUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
mqtool
;
package
net
.
wanji
.
common
.
tool
.
mqtool
;
import
com.alibaba.fastjson.JSONObject
;
import
com
.wanji.common.framework.Constants
;
import
com
.wanji.common.framework.spring.ServiceBeanContext
;
import
com
.wanji.common.framework.thread.NamedThreadFactory
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.spring.ServiceBeanContext
;
import
net
.wanji.common.framework.thread.NamedThreadFactory
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
com.rabbitmq.client.*
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/nginxtool/OperationMonitorUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/nginxtool/OperationMonitorUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
nginxtool
;
package
net
.
wanji
.
common
.
tool
.
nginxtool
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.BufferedReader
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/redistool/RedisUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/redistool/RedisUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
redistool
;
package
net
.
wanji
.
common
.
tool
.
redistool
;
import
redis.clients.jedis.Jedis
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/resttool/HttpComponentsClientRestfulHttpRequestFactory.java
→
wj-common/src/main/java/
net
/wanji/common/tool/resttool/HttpComponentsClientRestfulHttpRequestFactory.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
resttool
;
package
net
.
wanji
.
common
.
tool
.
resttool
;
import
org.apache.http.client.methods.HttpEntityEnclosingRequestBase
;
import
org.apache.http.client.methods.HttpUriRequest
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/resttool/RestTemplateConfiguration.java
→
wj-common/src/main/java/
net
/wanji/common/tool/resttool/RestTemplateConfiguration.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
resttool
;
package
net
.
wanji
.
common
.
tool
.
resttool
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4
;
import
org.apache.http.client.HttpClient
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/resttool/RestTemplateTool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/resttool/RestTemplateTool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
resttool
;
package
net
.
wanji
.
common
.
tool
.
resttool
;
import
com.alibaba.fastjson.JSON
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
lombok.Getter
;
import
org.springframework.http.*
;
import
org.springframework.web.client.RestTemplate
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/wsdltool/DoSoapTool.java
→
wj-common/src/main/java/
net
/wanji/common/tool/wsdltool/DoSoapTool.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
wsdltool
;
package
net
.
wanji
.
common
.
tool
.
wsdltool
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.httpclient.HttpStatus
;
...
...
wj-common/src/main/java/
com
/wanji/common/tool/wstool/WebSocketUtil.java
→
wj-common/src/main/java/
net
/wanji/common/tool/wstool/WebSocketUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
tool
.
wstool
;
package
net
.
wanji
.
common
.
tool
.
wstool
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.java_websocket.WebSocket
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.drafts.Draft
;
import
org.java_websocket.drafts.Draft_6455
;
import
org.java_websocket.handshake.ServerHandshake
;
import
java.net.URI
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/file/FileUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/file/FileUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
file
;
package
net
.
wanji
.
common
.
utils
.
file
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/file/XFileUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/file/XFileUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
file
;
package
net
.
wanji
.
common
.
utils
.
file
;
import
com.sun.xfile.XFile
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/geo/GeometryUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/geo/GeometryUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
geo
;
package
net
.
wanji
.
common
.
utils
.
geo
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.locationtech.jts.geom.*
;
import
org.locationtech.jts.io.ParseException
;
import
org.locationtech.jts.io.WKBWriter
;
...
...
@@ -17,7 +16,6 @@ import org.locationtech.jts.operation.buffer.OffsetCurveBuilder;
import
org.apache.commons.lang3.StringUtils
;
import
org.geotools.geojson.geom.GeometryJSON
;
import
org.locationtech.jts.operation.linemerge.LineMerger
;
import
org.locationtech.jts.operation.valid.IsValidOp
;
import
java.io.IOException
;
import
java.io.StringReader
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/mail/MailUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/mail/MailUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
mail
;
package
net
.
wanji
.
common
.
utils
.
mail
;
import
com
.wanji.common.framework.rest.JsonViewObject
;
import
com
.wanji.common.utils.tool.StringUtils
;
import
net
.wanji.common.framework.rest.JsonViewObject
;
import
net
.wanji.common.utils.tool.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/CsvUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/CsvUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
com.csvreader.CsvReader
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/DateUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/DateUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
com
.wanji.common.framework.Constants
;
import
net
.wanji.common.framework.Constants
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
...
...
@@ -14,7 +14,7 @@ import java.util.Calendar;
import
java.util.Date
;
import
java.util.Random
;
import
static
com
.
wanji
.
common
.
framework
.
Constants
.
DATE_FORMAT
.*;
import
static
net
.
wanji
.
common
.
framework
.
Constants
.
DATE_FORMAT
.*;
/**
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/EncryptUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/EncryptUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/ExcelUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/ExcelUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/GroovyUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/GroovyUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
com.google.common.collect.Maps
;
import
groovy.lang.GroovyClassLoader
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/IDGenerator.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/IDGenerator.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/JsonUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/JsonUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com
.wanji.common.framework.exception.DubboProviderException
;
import
com
.wanji.common.utils.webservice.SoapUtils
;
import
com
.wanji.common.utils.webservice.WebServiceUtils
;
import
net
.wanji.common.framework.exception.DubboProviderException
;
import
net
.wanji.common.utils.webservice.SoapUtils
;
import
net
.wanji.common.utils.webservice.WebServiceUtils
;
import
org.dom4j.*
;
import
java.util.ArrayList
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/MD5Util.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/MD5Util.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/PageUtil.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/PageUtil.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/StringUtils.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/StringUtils.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/common/utils/tool/WebCxt.java
→
wj-common/src/main/java/
net
/wanji/common/utils/tool/WebCxt.java
View file @
2785c05f
package
com
.
wanji
.
common
.
utils
.
tool
;
package
net
.
wanji
.
common
.
utils
.
tool
;
import
lombok.extern.slf4j.Slf4j
;
...
...
wj-common/src/main/java/
com
/wanji/structure/BaseModel.java
→
wj-common/src/main/java/
net
/wanji/structure/BaseModel.java
View file @
2785c05f
package
com
.
wanji
.
structure
;
package
net
.
wanji
.
structure
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
...
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