Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Q
queueForTicket_bl
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
queueForTicket_bl
Commits
3c427401
Commit
3c427401
authored
Feb 12, 2026
by
lings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户个人信息核验(人脸)
parent
fe051a75
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
307 additions
and
11 deletions
+307
-11
ApiLoginController.java
.../src/main/java/io/hmit/controller/ApiLoginController.java
+115
-3
AppointmentOrderController.java
...es/appointment/controller/AppointmentOrderController.java
+2
-2
Constants.java
...rc/main/java/io/hmit/modules/zlb/constants/Constants.java
+9
-0
IdTypeEnum.java
...c/main/java/io/hmit/modules/zlb/constants/IdTypeEnum.java
+47
-0
AuthService.java
...rc/main/java/io/hmit/modules/zlb/service/AuthService.java
+35
-0
IrsUtils.java
...api/src/main/java/io/hmit/modules/zlb/utils/IrsUtils.java
+94
-0
application-prod.yml
hmit-api/src/main/resources/application-prod.yml
+5
-6
No files found.
hmit-api/src/main/java/io/hmit/controller/ApiLoginController.java
View file @
3c427401
...
@@ -15,6 +15,7 @@ import io.hmit.config.ZhelibanUtils;
...
@@ -15,6 +15,7 @@ import io.hmit.config.ZhelibanUtils;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.entity.TokenEntity
;
import
io.hmit.entity.TokenEntity
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.zlb.constants.IdTypeEnum
;
import
io.hmit.modules.zlb.service.AuthService
;
import
io.hmit.modules.zlb.service.AuthService
;
import
io.hmit.service.TokenService
;
import
io.hmit.service.TokenService
;
import
io.hmit.service.UserService
;
import
io.hmit.service.UserService
;
...
@@ -32,9 +33,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -32,9 +33,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.Map
;
import
java.util.UUID
;
/**
/**
* 登录接口
* 登录接口
...
@@ -200,4 +199,117 @@ public class ApiLoginController {
...
@@ -200,4 +199,117 @@ public class ApiLoginController {
return
userService
.
encryptOneTime
();
return
userService
.
encryptOneTime
();
}
}
//个人登录 - 单点登陆
@GetMapping
(
value
=
"/check_zlb_ticket_id"
)
@ApiOperation
(
"单点登录"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"ticketId"
,
value
=
"票据"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)
,
})
public
Result
checkZlbTicketId
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
map
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
// 获取到票据信息ticket
log
.
info
(
"开始进入这个check_zlb_ticket_id了,Map = {}"
,
map
);
Long
userId
;
Map
<
String
,
Object
>
userMap
=
new
HashMap
<>();
if
(
map
.
get
(
"ticketId"
)
!=
null
){
String
accessToken
=
authService
.
getTokenByTicketId
((
String
)
map
.
get
(
"ticketId"
));
JSONObject
userInfoByToken
=
authService
.
getUserInfoByToken
(
accessToken
);
Map
<
String
,
Object
>
user_map
=
(
Map
<
String
,
Object
>)
userInfoByToken
.
get
(
"personInfo"
);
Map
<
String
,
Object
>
user_attributes
=
(
Map
<
String
,
Object
>)
userInfoByToken
.
get
(
"attributes"
);
JSONObject
requestBody
=
new
JSONObject
();
if
(
"LEGAL_PERSON"
.
equals
(
userInfoByToken
.
get
(
"userType"
))){
Map
<
String
,
Object
>
user_legal_map
=
(
Map
<
String
,
Object
>)
userInfoByToken
.
get
(
"legalPersonInfo"
);
userMap
.
put
(
"username"
,
user_legal_map
.
get
(
"name"
));
//构造requestId请求参数
requestBody
.
put
(
"certNo"
,
user_legal_map
.
get
(
"idNo"
));
requestBody
.
put
(
"certName"
,
user_legal_map
.
get
(
"userName"
));
requestBody
.
put
(
"certType"
,
IdTypeEnum
.
getByType
(
user_legal_map
.
get
(
"idType"
).
toString
()).
getCode
());
requestBody
.
put
(
"nation"
,
user_legal_map
.
get
(
"nation"
));
requestBody
.
put
(
"mobile"
,
user_legal_map
.
get
(
"phone"
));
requestBody
.
put
(
"fkSceneCode"
,
"SC-OT01-HT01-c24531c0-b0da-4e38-885f-58f642e30e6a"
);
requestBody
.
put
(
"curLoginMetadata"
,
user_attributes
.
get
(
"curLoginMetadata"
));
}
else
{
userMap
.
put
(
"username"
,
user_map
.
get
(
"userName"
));
requestBody
.
put
(
"certNo"
,
user_map
.
get
(
"idNo"
));
requestBody
.
put
(
"certName"
,
user_map
.
get
(
"userName"
));
requestBody
.
put
(
"certType"
,
IdTypeEnum
.
getByType
(
user_map
.
get
(
"idType"
).
toString
()).
getCode
());
requestBody
.
put
(
"nation"
,
user_map
.
get
(
"nation"
));
requestBody
.
put
(
"mobile"
,
user_map
.
get
(
"phone"
));
requestBody
.
put
(
"fkSceneCode"
,
"SC-OT01-HT01-c24531c0-b0da-4e38-885f-58f642e30e6a"
);
requestBody
.
put
(
"curLoginMetadata"
,
user_attributes
.
get
(
"curLoginMetadata"
));
}
JSONObject
zlbRequestId
=
authService
.
getZlbRequestId
(
requestBody
);
userMap
.
put
(
"requestId"
,
zlbRequestId
.
get
(
"requestId"
));
userMap
.
put
(
"verifyFree"
,
zlbRequestId
.
get
(
"verifyFree"
));
userMap
.
put
(
"userId"
,
user_map
.
get
(
"userId"
));
userMap
.
put
(
"mobile"
,
user_map
.
get
(
"phone"
));
if
(
user_map
.
get
(
"idNo"
)
!=
null
){
//判断是否已经存在了这条信息
UserEntity
oldUser
=
userService
.
queryByIdnum
(
SMUtil
.
SM4Encrypt
(
URLEncoder
.
encode
(
user_map
.
get
(
"idNo"
).
toString
(),
"UTF8"
)));
try
{
userMap
.
put
(
"userId"
,
user_map
.
get
(
"userId"
));
userMap
.
put
(
"userNick"
,
((
Map
<
String
,
Object
>)
user_map
.
get
(
"attributes"
)).
get
(
"nickname"
));
}
catch
(
Exception
ignore
)
{}
if
(
oldUser
==
null
){
//将获得的信息保存到个人登陆表
String
idNo
=
user_map
.
get
(
"idNo"
).
toString
();
UserEntity
user
=
new
UserEntity
();
//信息加密存储
user
.
setUsername
(
SMUtil
.
SM4Encrypt
(
user_map
.
get
(
"userName"
).
toString
()));
user
.
setMobile
(
SMUtil
.
SM4Encrypt
(
URLEncoder
.
encode
(
user_map
.
get
(
"phone"
).
toString
(),
"UTF8"
)));
userService
.
insert
(
user
);
userId
=
user
.
getId
();
userMap
.
put
(
"username"
,
user
.
getUsername
());
userMap
.
put
(
"mobile"
,
SMUtil
.
SM4Decrypt
(
user
.
getMobile
()));
userMap
.
put
(
"idnum"
,
SMUtil
.
SM4Decrypt
(
user
.
getIdCardNo
()));
}
else
{
userId
=
oldUser
.
getId
();
userMap
.
put
(
"username"
,
oldUser
.
getUsername
());
userMap
.
put
(
"mobile"
,
SMUtil
.
SM4Decrypt
(
oldUser
.
getMobile
()));
userMap
.
put
(
"idnum"
,
SMUtil
.
SM4Decrypt
(
oldUser
.
getIdCardNo
()));
}
TokenEntity
tokenEntity
=
tokenService
.
createToken
(
userId
);
userMap
.
put
(
"token"
,
tokenEntity
.
getToken
());
userMap
.
put
(
"expire"
,
tokenEntity
.
getExpireDate
().
getTime
()
-
System
.
currentTimeMillis
());
}
return
new
Result
().
ok
(
userMap
);
}
else
{
return
new
Result
().
error
(
"票据信息为空"
);
}
}
@GetMapping
(
value
=
"/checkResultByRequestId"
)
@ApiOperation
(
"人脸核验结果"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"requestId"
,
value
=
"票据"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"String"
)
,
})
public
Result
checkResultByRequestId
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
map
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
// 获取到票据信息ticket
log
.
info
(
"开始进入这个checkResultByRequestId了,Map = {}"
,
map
);
Map
<
String
,
Object
>
userMap
=
new
HashMap
<>();
if
(
map
.
get
(
"requestId"
)
!=
null
){
JSONObject
result
=
authService
.
checkResultByRequestId
((
String
)
map
.
get
(
"requestId"
));
userMap
.
put
(
"pass"
,
String
.
valueOf
(
result
.
get
(
"pass"
)));
return
new
Result
().
ok
(
userMap
);
}
else
{
return
new
Result
().
error
(
"requestId为空"
);
}
}
}
}
hmit-api/src/main/java/io/hmit/modules/appointment/controller/AppointmentOrderController.java
View file @
3c427401
...
@@ -213,8 +213,8 @@ public class AppointmentOrderController {
...
@@ -213,8 +213,8 @@ public class AppointmentOrderController {
"&sTel="
+
appointmentPhone
+
"&sTel="
+
appointmentPhone
+
"&sName="
+
appointmentPerson
+
"&sName="
+
appointmentPerson
+
"&sCardID="
+
appointmentIdCard
;
"&sCardID="
+
appointmentIdCard
;
//
String s = HttpRequestUtil.sendGetAndRetrieveContent(url);
String
s
=
HttpRequestUtil
.
sendGetAndRetrieveContent
(
url
);
String
s
=
"{\"nStatus\":0,\"sMsg\":\"成功\",\"nWait\":9,\"sCallTime\":\"\",\"sRegTime\":\"2018-12-21 13:49:21\",\"sQueueName\":\"交通违法处理\",\"listWin\":[\"B03\",\"B04\",\"B05\",\"B06\"]}\n"
;
//
String s = "{\"nStatus\":0,\"sMsg\":\"成功\",\"nWait\":9,\"sCallTime\":\"\",\"sRegTime\":\"2018-12-21 13:49:21\",\"sQueueName\":\"交通违法处理\",\"listWin\":[\"B03\",\"B04\",\"B05\",\"B06\"]}\n";
YynumberDTO
yynumberDTO
=
JSONObject
.
parseObject
(
s
,
YynumberDTO
.
class
);
YynumberDTO
yynumberDTO
=
JSONObject
.
parseObject
(
s
,
YynumberDTO
.
class
);
//根据接口返回的结果更新预约单号
//根据接口返回的结果更新预约单号
...
...
hmit-api/src/main/java/io/hmit/modules/zlb/constants/Constants.java
View file @
3c427401
...
@@ -15,6 +15,15 @@ public interface Constants {
...
@@ -15,6 +15,15 @@ public interface Constants {
* 单点登录 token获取用户信息地址
* 单点登录 token获取用户信息地址
*/
*/
String
GET_USER_INFO_URL
=
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220329000008/uc/sso/getUserInfo"
;
String
GET_USER_INFO_URL
=
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220329000008/uc/sso/getUserInfo"
;
// String GET_USER_INFO_URL = "https://ibcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220329000008/uc/sso/getUserInfo";
// String GET_ACCEPT_USER_INFO_URL = "https://ibcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230103000005/uc/verify/v2/accept/userInfo";
String
GET_ACCEPT_USER_INFO_URL
=
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230103000005/uc/verify/v2/accept/userInfo"
;
// String GET_REVERIFY_URL = "https://ibcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230619000008/uc/verify/v2/reVerify";
String
GET_REVERIFY_URL
=
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230619000008/uc/verify/v2/reVerify"
;
/**
/**
* IRS请求携带的请求头
* IRS请求携带的请求头
...
...
hmit-api/src/main/java/io/hmit/modules/zlb/constants/IdTypeEnum.java
0 → 100644
View file @
3c427401
package
io
.
hmit
.
modules
.
zlb
.
constants
;
/**
* 异常枚举类
* @author Shen && syf0412@vip.qq.com
* @since 2021/12/6 13:35
*/
public
enum
IdTypeEnum
{
ID_CARD
(
"ID_CARD"
,
1
),
// 居⺠身份证
MAINLAND_TRAVEL_PERMIT_FOR_HONGKONG_AND_MACAO_RESIDENTS
(
"MAINLAND_TRAVEL_PERMIT_FOR_HONGKONG_AND_MACAO_RESIDENTS"
,
4
),
// 港澳居⺠来往内地通⾏
MAINLAND_TRAVEL_PERMIT_FOR_TAIWAN_RESIDENTS
(
"MAINLAND_TRAVEL_PERMIT_FOR_TAIWAN_RESIDENTS"
,
5
),
// 台湾居⺠来往⼤陆通⾏证
FOREIGN_PERMANENT_RESIDENT_ID_CARD
(
"FOREIGN_PERMANENT_RESIDENT_ID_CARD"
,
8
),
// 外国⼈永久居留身份证
GANG_AO_TAI_RESIDENCE_CART
(
"GANG_AO_TAI_RESIDENCE_CART"
,
14
),
// 港澳台居住证
GANG_AO_ID_CART
(
"GANG_AO_ID_CART"
,
200
),
// 港澳居⺠居住证
TAI_ID_CART
(
"TAI_ID_CART"
,
201
),
// 台湾居⺠居住证
;
private
final
String
type
;
private
final
int
code
;
IdTypeEnum
(
String
type
,
int
code
)
{
this
.
type
=
type
;
this
.
code
=
code
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getType
()
{
return
type
;
}
// 通过数字获取枚举值
public
static
IdTypeEnum
getByType
(
String
type
)
{
for
(
IdTypeEnum
idTypeEnum
:
values
())
{
if
(
idTypeEnum
.
type
.
equals
(
type
)
)
{
return
idTypeEnum
;
}
}
throw
new
IllegalArgumentException
(
"无效的类型: "
+
type
);
}
}
hmit-api/src/main/java/io/hmit/modules/zlb/service/AuthService.java
View file @
3c427401
...
@@ -60,6 +60,41 @@ public class AuthService {
...
@@ -60,6 +60,41 @@ public class AuthService {
return
checkResponse
(
stringResponseEntity
).
getJSONObject
(
"data"
);
return
checkResponse
(
stringResponseEntity
).
getJSONObject
(
"data"
);
}
}
public
JSONObject
getZlbRequestId
(
JSONObject
requestBody
)
{
HttpHeaders
headers
=
IrsUtils
.
generateHeader
(
Constants
.
GET_ACCEPT_USER_INFO_URL
,
"POST"
,
Constants
.
IRS_AK
,
Constants
.
IRS_SK
);
// JSONObject body = new JSONObject();
// body.put("certNo","s");
// body.put("certName","s");
// body.put("certType","s");
// body.put("nation","s");
// body.put("isNetId","s");
// body.put("remark","s");
// body.put("mobile","s");
// body.put("fkSceneCode","SC-OT01-HT01-a95e63ad-b899-420f-a022-5a180c434b83");
// body.put("curLoginMetadata","s");
HttpEntity
<
Map
<
String
,
Object
>>
request
=
new
HttpEntity
<>(
requestBody
,
headers
);
ResponseEntity
<
String
>
stringResponseEntity
=
restTemplate
.
postForEntity
(
Constants
.
GET_ACCEPT_USER_INFO_URL
,
request
,
String
.
class
);
return
checkResponse
(
stringResponseEntity
).
getJSONObject
(
"data"
);
}
public
JSONObject
checkResultByRequestId
(
String
requestId
)
{
HttpHeaders
headers
=
IrsUtils
.
generateHeader
(
Constants
.
GET_REVERIFY_URL
,
"POST"
,
Constants
.
IRS_AK
,
Constants
.
IRS_SK
);
JSONObject
requestBody
=
new
JSONObject
();
requestBody
.
put
(
"requestId"
,
requestId
);
HttpEntity
<
Map
<
String
,
Object
>>
request
=
new
HttpEntity
<>(
requestBody
,
headers
);
ResponseEntity
<
String
>
stringResponseEntity
=
restTemplate
.
postForEntity
(
Constants
.
GET_REVERIFY_URL
,
request
,
String
.
class
);
return
checkResponse
(
stringResponseEntity
).
getJSONObject
(
"data"
);
}
private
JSONObject
checkResponse
(
ResponseEntity
<
String
>
stringResponseEntity
)
{
private
JSONObject
checkResponse
(
ResponseEntity
<
String
>
stringResponseEntity
)
{
if
(!
stringResponseEntity
.
getStatusCode
().
is2xxSuccessful
())
{
if
(!
stringResponseEntity
.
getStatusCode
().
is2xxSuccessful
())
{
//请求失败
//请求失败
...
...
hmit-api/src/main/java/io/hmit/modules/zlb/utils/IrsUtils.java
View file @
3c427401
package
io
.
hmit
.
modules
.
zlb
.
utils
;
package
io
.
hmit
.
modules
.
zlb
.
utils
;
import
io.hmit.modules.zlb.constants.Constants
;
import
io.hmit.modules.zlb.constants.Constants
;
import
javafx.util.Pair
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.util.UriComponents
;
import
org.springframework.web.util.UriComponents
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
javax.crypto.Mac
;
import
javax.crypto.Mac
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.xml.bind.DatatypeConverter
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URI
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* @author jie.chen
* @author jie.chen
...
@@ -71,6 +79,92 @@ public class IrsUtils {
...
@@ -71,6 +79,92 @@ public class IrsUtils {
return
Base64
.
getEncoder
().
encodeToString
(
bytes
);
return
Base64
.
getEncoder
().
encodeToString
(
bytes
);
}
}
/**
* 构造请求 header
* @paramurlStr 请求 url,全路径格式,比如:
https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220905000004/uc/auth/verify/sendMessage
* @paramrequestMethod 请求方法,大写格式,如:GET,POST
* @paramaccessKey 应用的 AK
* @paramsecretKey 应用的 SK
* @return
*/
public
static
HttpHeaders
generateHeader
(
String
urlStr
,
String
requestMethod
,
String
accessKey
,
String
secretKey
)
{
// log.info("params,urlStr={},requestMethod={},accessKey={},secretKey={}",urlStr,requestMethod,accessKey,secretKey);
HttpHeaders
headers
=
new
HttpHeaders
();
// Map<String, String> header = new HashMap<>();
try
{
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"EEE, dd MMM yyyy HH:mm:ss z"
,
Locale
.
US
);
dateFormat
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
String
date
=
dateFormat
.
format
(
new
Date
());
URL
url
=
new
URL
(
urlStr
);
URI
uri
=
new
URI
(
url
.
getProtocol
(),
url
.
getHost
(),
url
.
getPath
(),
url
.
getQuery
(),
null
);
String
canonicalQueryString
=
getCanonicalQueryString
(
uri
.
getQuery
());
String
message
=
requestMethod
.
toUpperCase
()
+
"\n"
+
uri
.
getPath
()
+
"\n"
+
canonicalQueryString
+
"\n"
+
accessKey
+
"\n"
+
date
+
"\n"
;
Mac
hasher
=
Mac
.
getInstance
(
"HmacSHA256"
);
hasher
.
init
(
new
SecretKeySpec
(
secretKey
.
getBytes
(),
"HmacSHA256"
));
byte
[]
hash
=
hasher
.
doFinal
(
message
.
getBytes
());
// to lowercase hexits
DatatypeConverter
.
printHexBinary
(
hash
);
// to base64
String
sign
=
DatatypeConverter
.
printBase64Binary
(
hash
);
headers
.
add
(
"X-BG-HMAC-SIGNATURE"
,
sign
);
headers
.
add
(
"X-BG-HMAC-ALGORITHM"
,
"hmac-sha256"
);
headers
.
add
(
"X-BG-HMAC-ACCESS-KEY"
,
accessKey
);
headers
.
add
(
"X-BG-DATE-TIME"
,
date
);
}
catch
(
Exception
e
)
{
// log.error("generate error",e);
throw
new
RuntimeException
(
"generate header error"
);
}
// log.info("header info,{}",header);
return
headers
;
}
private
static
String
getCanonicalQueryString
(
String
query
)
{
if
(
query
==
null
||
query
.
trim
().
length
()
==
0
)
{
return
""
;
}
List
<
Pair
<
String
,
String
>>
queryParamList
=
new
ArrayList
<>();
String
[]
params
=
query
.
split
(
"&"
);
for
(
String
param
:
params
)
{
int
eqIndex
=
param
.
indexOf
(
"="
);
String
key
=
param
.
substring
(
0
,
eqIndex
);
String
value
=
param
.
substring
(
eqIndex
+
1
);
Pair
<
String
,
String
>
pair
=
new
Pair
<
String
,
String
>(
key
,
value
);
queryParamList
.
add
(
pair
);
}
List
<
Pair
<
String
,
String
>>
sortedParamList
=
queryParamList
.
stream
().
sorted
(
Comparator
.
comparing
(
param
->
param
.
getKey
()
+
"="
+
Optional
.
ofNullable
(
param
.
getValue
()).
orElse
(
""
))).
collect
(
Collectors
.
toList
());
List
<
Pair
<
String
,
String
>>
encodeParamList
=
new
ArrayList
<>();
sortedParamList
.
stream
().
forEach
(
param
->
{
try
{
String
key
=
URLEncoder
.
encode
(
param
.
getKey
(),
"utf-8"
);
String
value
=
URLEncoder
.
encode
(
Optional
.
ofNullable
(
param
.
getValue
()).
orElse
(
""
),
"utf-8"
)
.
replaceAll
(
"\\%2B"
,
"%20"
)
.
replaceAll
(
"\\+"
,
"%20"
)
.
replaceAll
(
"\\%21"
,
"!"
)
.
replaceAll
(
"\\%27"
,
"'"
)
.
replaceAll
(
"\\%28"
,
"("
)
.
replaceAll
(
"\\%29"
,
")"
)
.
replaceAll
(
"\\%7E"
,
"~"
)
.
replaceAll
(
"\\%25"
,
"%"
)
;
encodeParamList
.
add
(
new
Pair
<>(
key
,
value
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
"encoding error"
);
}
});
StringBuilder
queryParamString
=
new
StringBuilder
(
64
);
for
(
Pair
<
String
,
String
>
encodeParam
:
encodeParamList
)
{
queryParamString
.
append
(
encodeParam
.
getKey
()).
append
(
"="
).
append
(
Optional
.
ofNullable
(
encodeParam
.
getValue
()).
orElse
(
""
));
queryParamString
.
append
(
"&"
);
}
return
queryParamString
.
substring
(
0
,
queryParamString
.
length
()-
1
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
sign
(
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220329000007/uc/sso/getUserInfo"
,
"POST"
));
System
.
out
.
println
(
sign
(
"https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220329000007/uc/sso/getUserInfo"
,
"POST"
));
...
...
hmit-api/src/main/resources/application-prod.yml
View file @
3c427401
spring
:
spring
:
datasource
:
datasource
:
druid
:
druid
:
# driver-class-name: com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://localhost:3306/bl_appointment?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
url
:
jdbc:mysql://119.3.143.77:3306/bl_appointment?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username
:
blyyqh
username
:
hmit_user
password
:
blyyqh@2024
password
:
HmitUser@1234
initial-size
:
10
initial-size
:
10
max-active
:
100
max-active
:
100
min-idle
:
10
min-idle
:
10
...
...
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