Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
self-service
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖旭伟
self-service
Commits
b49bb450
Commit
b49bb450
authored
1 year ago
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
综窗对接
parent
bae36404
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
454 additions
and
18 deletions
+454
-18
sst-manager/src/main/java/com/mortals/xhx/common/utils/AESUtil.java
...r/src/main/java/com/mortals/xhx/common/utils/AESUtil.java
+232
-0
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/AcceptHandlingPdu.java
...ava/com/mortals/xhx/module/sst/pdu/AcceptHandlingPdu.java
+2
-1
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/AcceptRspInfo.java
...in/java/com/mortals/xhx/module/sst/pdu/AcceptRspInfo.java
+159
-0
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/HandleAddress.java
...in/java/com/mortals/xhx/module/sst/pdu/HandleAddress.java
+27
-0
sst-manager/src/main/java/com/mortals/xhx/module/sst/web/SyntheticalController.java
...com/mortals/xhx/module/sst/web/SyntheticalController.java
+34
-17
No files found.
sst-manager/src/main/java/com/mortals/xhx/common/utils/AESUtil.java
0 → 100644
View file @
b49bb450
package
com.mortals.xhx.common.utils
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.Base64Utils
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
/**
* AES加密工具类
*
*/
public
class
AESUtil
{
/**
* 日志相关
*/
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AESUtil
.
class
);
/**
* 编码
*/
private
static
final
String
ENCODING
=
"UTF-8"
;
/**
* 算法定义
*/
private
static
final
String
AES_ALGORITHM
=
"AES"
;
/**
* 指定填充方式
*/
private
static
final
String
CIPHER_PADDING
=
"AES/ECB/PKCS5Padding"
;
private
static
final
String
CIPHER_CBC_PADDING
=
"AES/CBC/PKCS5Padding"
;
/**
* 偏移量(CBC中使用,增强加密算法强度)
*/
private
static
final
String
IV_SEED
=
"tdrdadq59tbss5n7"
;
/**
* AES加密
* @param content 待加密内容
* @param aesKey 密码
* @return
*/
public
static
String
encrypt
(
String
content
,
String
aesKey
){
if
(
StringUtils
.
isBlank
(
content
)){
LOGGER
.
info
(
"AES encrypt: the content is null!"
);
return
null
;
}
//判断秘钥是否为16位
if
(
StringUtils
.
isNotBlank
(
aesKey
)
&&
aesKey
.
length
()
==
16
){
try
{
//对密码进行编码
byte
[]
bytes
=
aesKey
.
getBytes
(
ENCODING
);
//设置加密算法,生成秘钥
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
bytes
,
AES_ALGORITHM
);
// "算法/模式/补码方式"
Cipher
cipher
=
Cipher
.
getInstance
(
CIPHER_PADDING
);
//选择加密
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
skeySpec
);
//根据待加密内容生成字节数组
byte
[]
encrypted
=
cipher
.
doFinal
(
content
.
getBytes
(
ENCODING
));
//返回base64字符串
return
Base64Utils
.
encodeToString
(
encrypted
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"AES encrypt exception:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
}
else
{
LOGGER
.
info
(
"AES encrypt: the aesKey is null or error!"
);
return
null
;
}
}
/**
* 解密
*
* @param content 待解密内容
* @param aesKey 密码
* @return
*/
public
static
String
decrypt
(
String
content
,
String
aesKey
){
if
(
StringUtils
.
isBlank
(
content
)){
LOGGER
.
info
(
"AES decrypt: the content is null!"
);
return
null
;
}
//判断秘钥是否为16位
if
(
StringUtils
.
isNotBlank
(
aesKey
)
&&
aesKey
.
length
()
==
16
){
try
{
//对密码进行编码
byte
[]
bytes
=
aesKey
.
getBytes
(
ENCODING
);
//设置解密算法,生成秘钥
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
bytes
,
AES_ALGORITHM
);
// "算法/模式/补码方式"
Cipher
cipher
=
Cipher
.
getInstance
(
CIPHER_PADDING
);
//选择解密
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
skeySpec
);
//先进行Base64解码
byte
[]
decodeBase64
=
Base64Utils
.
decodeFromString
(
content
);
//根据待解密内容进行解密
byte
[]
decrypted
=
cipher
.
doFinal
(
decodeBase64
);
//将字节数组转成字符串
return
new
String
(
decrypted
,
ENCODING
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"AES decrypt exception:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
}
else
{
LOGGER
.
info
(
"AES decrypt: the aesKey is null or error!"
);
return
null
;
}
}
/**
* AES_CBC加密
*
* @param content 待加密内容
* @param aesKey 密码
* @return
*/
public
static
String
encryptCBC
(
String
content
,
String
aesKey
){
if
(
StringUtils
.
isBlank
(
content
)){
LOGGER
.
info
(
"AES_CBC encrypt: the content is null!"
);
return
null
;
}
//判断秘钥是否为16位
if
(
StringUtils
.
isNotBlank
(
aesKey
)
&&
aesKey
.
length
()
==
16
){
try
{
//对密码进行编码
byte
[]
bytes
=
aesKey
.
getBytes
(
ENCODING
);
//设置加密算法,生成秘钥
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
bytes
,
AES_ALGORITHM
);
// "算法/模式/补码方式"
Cipher
cipher
=
Cipher
.
getInstance
(
CIPHER_CBC_PADDING
);
//偏移
IvParameterSpec
iv
=
new
IvParameterSpec
(
IV_SEED
.
getBytes
(
ENCODING
));
//选择加密
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
skeySpec
,
iv
);
//根据待加密内容生成字节数组
byte
[]
encrypted
=
cipher
.
doFinal
(
content
.
getBytes
(
ENCODING
));
//返回base64字符串
return
Base64Utils
.
encodeToString
(
encrypted
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"AES_CBC encrypt exception:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
}
else
{
LOGGER
.
info
(
"AES_CBC encrypt: the aesKey is null or error!"
);
return
null
;
}
}
/**
* AES_CBC解密
*
* @param content 待解密内容
* @param aesKey 密码
* @return
*/
public
static
String
decryptCBC
(
String
content
,
String
aesKey
){
if
(
StringUtils
.
isBlank
(
content
)){
LOGGER
.
info
(
"AES_CBC decrypt: the content is null!"
);
return
null
;
}
//判断秘钥是否为16位
if
(
StringUtils
.
isNotBlank
(
aesKey
)
&&
aesKey
.
length
()
==
16
){
try
{
//对密码进行编码
byte
[]
bytes
=
aesKey
.
getBytes
(
ENCODING
);
//设置解密算法,生成秘钥
SecretKeySpec
skeySpec
=
new
SecretKeySpec
(
bytes
,
AES_ALGORITHM
);
//偏移
IvParameterSpec
iv
=
new
IvParameterSpec
(
IV_SEED
.
getBytes
(
ENCODING
));
// "算法/模式/补码方式"
Cipher
cipher
=
Cipher
.
getInstance
(
CIPHER_CBC_PADDING
);
//选择解密
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
skeySpec
,
iv
);
//先进行Base64解码
byte
[]
decodeBase64
=
Base64Utils
.
decodeFromString
(
content
);
//根据待解密内容进行解密
byte
[]
decrypted
=
cipher
.
doFinal
(
decodeBase64
);
//将字节数组转成字符串
return
new
String
(
decrypted
,
ENCODING
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"AES_CBC decrypt exception:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
}
else
{
LOGGER
.
info
(
"AES_CBC decrypt: the aesKey is null or error!"
);
return
null
;
}
}
public
static
void
main
(
String
[]
args
)
{
// AES支持三种长度的密钥:128位、192位、256位。
// 代码中这种就是128位的加密密钥,16字节 * 8位/字节 = 128位。
String
random
=
"0000000671595991"
;
System
.
out
.
println
(
"随机key:"
+
random
);
System
.
out
.
println
();
System
.
out
.
println
(
"---------加密---------"
);
String
aesResult
=
encrypt
(
"511181198903042414"
,
random
);
System
.
out
.
println
(
"aes加密结果:"
+
aesResult
);
System
.
out
.
println
();
System
.
out
.
println
(
"---------解密---------"
);
String
decrypt
=
decrypt
(
aesResult
,
random
);
System
.
out
.
println
(
"aes解密结果:"
+
decrypt
);
System
.
out
.
println
();
System
.
out
.
println
(
"--------AES_CBC加密解密---------"
);
String
cbcResult
=
encryptCBC
(
"511181198903042414"
,
random
);
System
.
out
.
println
(
"aes_cbc加密结果:"
+
cbcResult
);
System
.
out
.
println
();
System
.
out
.
println
(
"---------解密CBC---------"
);
String
cbcDecrypt
=
decryptCBC
(
"R2tB6mi08cAZytixt0nANWQJxrr4pwpjsBVpQ82I4JM="
,
random
);
System
.
out
.
println
(
"aes解密结果:"
+
cbcDecrypt
);
System
.
out
.
println
();
}
}
This diff is collapsed.
Click to expand it.
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/AcceptHandlingPdu.java
View file @
b49bb450
...
...
@@ -7,10 +7,11 @@ import java.util.List;
import
java.util.Map
;
/**
* 自助设备接件
*
综窗设备
自助设备接件
*/
@Data
public
class
AcceptHandlingPdu
{
private
Long
userId
;
/** 申请人信息 */
private
ApplicantLegal
applicantLegal
;
/** 事项信息 */
...
...
This diff is collapsed.
Click to expand it.
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/AcceptRspInfo.java
0 → 100644
View file @
b49bb450
package
com.mortals.xhx.module.sst.pdu
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
/**
* 综窗受理响应
*/
@Data
public
class
AcceptRspInfo
{
private
Object
handler
;
private
Object
deptName
;
private
Object
btsName
;
private
String
handleAddressId
;
private
String
isOneThing
;
private
Object
cycleAndSteps
;
private
Object
endDate
;
private
Object
functionRole
;
private
Object
printCorrectionReceipt
;
private
Object
handleDeptName
;
private
Object
createUserName
;
private
Object
handlerName
;
private
List
<
Object
>
areas
;
private
String
acceptAreaCode
;
private
Object
tokenUser
;
private
Object
businessTacheName
;
private
Object
floorId
;
private
String
implementName
;
private
Object
stateName
;
private
Object
areaName
;
private
String
acceptObjectType
;
private
boolean
orderByLimitTime
;
private
String
isTongBan
;
private
String
state
;
private
String
applicantId
;
private
String
unifyCode
;
private
Object
deptId
;
private
Object
isIssue
;
private
Object
suspendSecond
;
private
Object
eventType
;
private
Object
packages
;
private
Object
waitHandlingSearch
;
private
Object
replyPrintLicence
;
private
Object
eventIds
;
private
Object
applicantIdNumber
;
private
Object
extend
;
private
Object
itemId
;
private
Object
registerAddress
;
private
Object
hotNum
;
private
String
phone
;
private
String
sourceType
;
private
List
<
Long
>
handlingIds
;
private
String
doSource
;
private
Map
<
String
,
String
>
infoMap
;
private
Object
applyCode
;
private
Object
situationItems
;
private
int
btsOrder
;
private
String
startDate
;
private
Object
printNoAccept
;
private
Object
timeLimitState
;
private
String
businessTacheId
;
private
String
submitType
;
private
Object
btsIds
;
private
Object
eventIdAndTacheIds
;
private
Object
timingStartTime
;
private
String
acceptIsPrint
;
private
Object
thingHandlingId
;
private
Object
conditionTime
;
private
Object
situationId
;
private
Object
stepResult
;
private
Object
printFinishBook
;
private
String
delFlag
;
private
Object
auditState
;
private
Object
search
;
private
Object
rightsDeptName
;
private
Object
commAddress
;
private
Object
handlerPhone
;
private
String
isDissolve
;
private
String
handlingId
;
private
Object
situations
;
private
Object
printUpload
;
private
Object
printAccept
;
private
Object
updateTime
;
private
String
currentArea
;
private
String
userId
;
private
Object
applicant
;
private
Object
thingId
;
private
String
legalPersonId
;
private
Object
dealAreaCode
;
private
Object
rightsDeptId
;
private
String
createTime
;
private
String
ecId
;
private
String
handlingCode
;
private
Object
situationItemIds
;
private
Object
eventTypeName
;
private
Object
warningTimeAll
;
private
int
num
;
private
String
implementCoding
;
private
Object
acceptDeptName
;
private
Object
limitDay
;
private
String
businessTacheCode
;
private
Object
selectSituationItems
;
private
String
eventObjectType
;
private
Object
handlingUseTime
;
private
Object
situationIds
;
private
int
handlingVersion
;
private
Object
processName
;
private
Object
windowName
;
private
Object
deptIds
;
private
Object
dealAreaName
;
private
String
endIsPrint
;
private
String
eventId
;
private
Object
acceptDeptId
;
private
HandleAddress
handleAddress
;
private
String
applicantName
;
private
Object
printLicence
;
private
Object
acceptAreaName
;
private
Object
eventHandleKind
;
private
String
windowId
;
private
Object
areaCode
;
private
Object
materials
;
private
Object
windowUserId
;
private
Object
timingEndTime
;
private
Object
ecName
;
private
Object
areaLinkCode
;
private
Object
beyondTime
;
private
Object
note
;
private
List
<
Object
>
areaLinks
;
private
Object
auditAreaCode
;
private
String
btsId
;
private
Object
cycleAndStep
;
private
Object
stepId
;
private
Object
tenantCode
;
private
Object
states
;
private
Object
tenantName
;
private
Object
updateBy
;
private
String
handlerId
;
private
Object
legalPerson
;
private
Object
eventImplementation
;
private
Object
warningTime
;
private
Object
areaOrder
;
private
Object
eventIdAndTacheId
;
private
Object
handleDept
;
private
String
resultsHandlingType
;
private
Object
isStaging
;
private
Object
thingName
;
private
Object
printDocument
;
private
Object
userName
;
private
Object
timeLimit
;
private
Object
areaCodeList
;
private
Object
oneThingExampleId
;
private
String
createBy
;
private
Object
systemCode
;
private
Object
beyondTimeAll
;
private
Object
isTimeout
;
private
Object
bjlx
;
}
This diff is collapsed.
Click to expand it.
sst-manager/src/main/java/com/mortals/xhx/module/sst/pdu/HandleAddress.java
0 → 100644
View file @
b49bb450
package
com.mortals.xhx.module.sst.pdu
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
HandleAddress
{
private
String
handleAddressDetail
;
private
int
isCenter
;
private
List
<
String
>
callNotification
;
private
Object
eventId
;
private
String
handleAddressId
;
private
int
distance
;
private
double
latitude
;
private
int
userId
;
private
String
areaCode
;
private
String
queueNumberRule
;
private
String
areaName
;
private
String
areaLevel
;
private
String
state
;
private
String
stateDate
;
private
int
timeCost
;
private
int
kilometre
;
private
String
queuingRules
;
private
double
longitude
;
}
This diff is collapsed.
Click to expand it.
sst-manager/src/main/java/com/mortals/xhx/module/sst/web/SyntheticalController.java
View file @
b49bb450
...
...
@@ -6,6 +6,7 @@ import cn.hutool.http.HttpResponse;
import
cn.hutool.http.Method
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
...
...
@@ -24,7 +25,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.crypto.Cipher
;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.net.HttpCookie
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
...
...
@@ -233,26 +240,28 @@ public class SyntheticalController extends BaseJsonBodyController {
/**
* 自助设备接件
* @param
query
* @param
pdu
* @return
*/
@PostMapping
({
"api/self-device-info/acceptHandling"
})
@UnAuth
public
String
acceptHandling
(
@RequestBody
AcceptHandlingPdu
query
)
{
public
String
acceptHandling
(
@RequestBody
AcceptHandlingPdu
pdu
)
{
String
url
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_CWS_HTTP_URL
,
"http://8.136.255.30:1086"
);
url
+=
"/complex/api/self-device-info/acceptHandling"
;
String
resp
=
null
;
Map
<
String
,
Object
>
model
=
new
HashMap
();
String
busiDesc
=
"自助设备接件"
;
try
{
doFileToBase64
(
query
);
resp
=
doPost
(
url
,
JSONObject
.
toJSONString
(
query
));
doFileToBase64
(
pdu
);
resp
=
doPost
(
url
,
JSONObject
.
toJSONString
(
pdu
));
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
resp
);
if
(
jsonObject
.
getIntValue
(
"code"
)==
1
){
}
// Rest<List<AcceptRspInfo>> rest = JSON.parseObject(resp, new TypeReference<Rest<List<AcceptRspInfo>>>() {
// });
// if(rest.getCode()==1){
// if(CollectionUtils.isNotEmpty(rest.getData())) {
// this.userMatterApplyService.saveAcceptRspInfo(rest.getData().get(0), pdu);
// }
// }
}
catch
(
Exception
e
)
{
this
.
doException
(
this
.
request
,
busiDesc
+
" 【异常】"
,
model
,
e
);
Rest
<
Object
>
ret
=
new
Rest
();
...
...
@@ -273,14 +282,21 @@ public class SyntheticalController extends BaseJsonBodyController {
if
(
CollectionUtils
.
isNotEmpty
(
materials
)){
String
rootPath
=
this
.
filePath
.
endsWith
(
"/"
)
?
this
.
filePath
:
this
.
filePath
+
"/"
;
for
(
Material
item:
materials
){
String
filePath
=
rootPath
+
item
.
getMaterialFilePath
();
try
{
Path
path
=
Paths
.
get
(
filePath
);
// 替换为实际文件路径
byte
[]
fileBytes
=
Files
.
readAllBytes
(
path
);
String
base64EncodedString
=
Base64
.
getEncoder
().
encodeToString
(
fileBytes
);
item
.
setMaterialContent
(
base64EncodedString
);
}
catch
(
Exception
e
)
{
throw
new
AppException
(
e
.
getMessage
());
if
(
StringUtils
.
isNotEmpty
(
item
.
getMaterialFilePath
()))
{
String
filePath
=
rootPath
+
item
.
getMaterialFilePath
();
try
{
Path
path
=
Paths
.
get
(
filePath
);
// 替换为实际文件路径
byte
[]
fileBytes
=
Files
.
readAllBytes
(
path
);
String
base64EncodedString
=
Base64
.
getEncoder
().
encodeToString
(
fileBytes
);
item
.
setMaterialContent
(
base64EncodedString
);
}
catch
(
Exception
e
)
{
throw
new
AppException
(
e
.
getMessage
());
}
}
if
(
StringUtils
.
isNotEmpty
(
item
.
getMaterialContent
())){
String
base64
=
String
.
valueOf
(
item
.
getMaterialContent
());
base64
=
base64
.
replaceAll
(
"data:image/png;base64,"
,
""
);
item
.
setMaterialContent
(
base64
);
}
}
}
...
...
@@ -337,4 +353,5 @@ public class SyntheticalController extends BaseJsonBodyController {
// e.printStackTrace();
// }
// }
}
This diff is collapsed.
Click to expand it.
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