Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
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
赵啸非
smart_gov_platform
Commits
603198ef
Commit
603198ef
authored
May 08, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加站点参数
parent
e88949d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
229 additions
and
11 deletions
+229
-11
base-manager/doc/api.md
base-manager/doc/api.md
+63
-0
base-manager/src/main/java/com/mortals/xhx/busiz/SignRsaDemo.java
...ager/src/main/java/com/mortals/xhx/busiz/SignRsaDemo.java
+79
-0
base-manager/src/main/java/com/mortals/xhx/busiz/web/MidSignApiController.java
.../java/com/mortals/xhx/busiz/web/MidSignApiController.java
+87
-11
No files found.
base-manager/doc/api.md
View file @
603198ef
...
@@ -13468,6 +13468,69 @@ msg|String|消息|-
...
@@ -13468,6 +13468,69 @@ msg|String|消息|-
```
```
## 人员流量统计
### 查询人员流量统计报表
**请求URL:**
refined/realtime/dataflow/stat/list
**请求方式:**
POST
**内容类型:**
application/json;charset=utf-8
**简要描述:**
查询人员流量统计
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
page|Integer|否|当前页
size|Integer|否|每页条数,值为-1,查询所有记录
**请求样例:**
```
{
"page":1,
"size":10
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 
per_page|Integer|每页条数
 
total|Integer|总条数
 
last_page|Integer|总页数
 
current_page|Integer|当前页
 
data|array|结果集列表|数组
  
id|Long|主键ID,主键,自增长
  
siteId|Long|站点Id
  
siteName|String|站点名称
  
personSum|Integer|人流总数
  
strangerSum|Integer|陌生人数量
  
recoginzeSum|Integer|识别注册群众数量
  
year|Integer|年
  
month|Integer|月
  
day|Integer|日
  
hour|Integer|小时
  
createTime|Date|创建时间
  
createUserId|Long|创建人id
  
updateTime|Date|更新时间
  
updateUserId|Long|更新人id
dict|object|字典对象
**响应消息样例:**
```
{
"code":1,
"data":{
}
}
```
## 字典附录
## 字典附录
...
...
base-manager/src/main/java/com/mortals/xhx/busiz/SignRsaDemo.java
0 → 100644
View file @
603198ef
package
com.mortals.xhx.busiz
;
import
org.apache.commons.codec.binary.Base64
;
import
javax.crypto.Cipher
;
import
java.security.KeyFactory
;
import
java.security.interfaces.RSAPrivateKey
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
public
class
SignRsaDemo
{
static
String
PUBLICKEY
=
"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIwYDUWp+QkuihFJxWJmAQ0ZmdTVbOg7yETtckUZkUQ6JUKEzKz9UIbmjrKS8kLY39QDjyzCuOzBR2eF2ZrS89MCAwEAAQ=="
;
static
String
user
=
"yibinTFTB"
;
static
String
pwd
=
"f82c10dea5fc4936853ff90e576ac216"
;
/**
* RSA公钥加密
*
* @param str 加密字符串
* @param publicKey 公钥
* @return 密文
* @throws Exception 加密过程中的异常信息
*/
public
static
String
encrypt
(
String
str
,
String
publicKey
)
throws
Exception
{
//base64编码的公钥
byte
[]
decoded
=
Base64
.
decodeBase64
(
publicKey
);
RSAPublicKey
pubKey
=
(
RSAPublicKey
)
KeyFactory
.
getInstance
(
"RSA"
)
.
generatePublic
(
new
X509EncodedKeySpec
(
decoded
));
//RSA加密
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
pubKey
);
String
outStr
=
Base64
.
encodeBase64String
(
cipher
.
doFinal
(
str
.
getBytes
(
"UTF-8"
)));
return
outStr
;
}
/**
* RSA私钥解密
*
* @param str 加密字符串
* @param privateKey 私钥
* @return 明文
* @throws Exception 解密过程中的异常信息
*/
public
static
String
decrypt
(
String
str
,
String
privateKey
)
throws
Exception
{
//64位解码加密后的字符串
byte
[]
inputByte
=
Base64
.
decodeBase64
(
str
.
getBytes
(
"UTF-8"
));
//base64编码的私钥
byte
[]
decoded
=
Base64
.
decodeBase64
(
privateKey
);
RSAPrivateKey
priKey
=
(
RSAPrivateKey
)
KeyFactory
.
getInstance
(
"RSA"
)
.
generatePrivate
(
new
PKCS8EncodedKeySpec
(
decoded
));
//RSA解密
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
priKey
);
String
outStr
=
new
String
(
cipher
.
doFinal
(
inputByte
));
return
outStr
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Long
curTime
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"====== curTime:"
+
curTime
);
String
pwdRsa
=
pwd
+
"#"
+
curTime
;
System
.
out
.
println
(
"====== pwdRsa:"
+
pwdRsa
);
pwdRsa
=
encrypt
(
pwdRsa
,
PUBLICKEY
);
System
.
out
.
println
(
"====== pwdRsa:"
+
pwdRsa
);
String
param
=
"{\"USER\":\""
+
user
+
"\",\"PWD\":\""
+
pwdRsa
+
"\"}"
;
System
.
out
.
println
(
"====== param:"
+
param
);
param
=
Base64
.
encodeBase64String
(
param
.
getBytes
(
"UTF-8"
));
System
.
out
.
println
(
"====== param:"
+
param
);
String
request
=
"{\"idCardNo\":\"41010229611620007X\",\"orgNo\":\"10080000\"}"
;
request
=
Base64
.
encodeBase64String
(
request
.
getBytes
(
"UTF-8"
));
System
.
out
.
println
(
"====== request:"
+
request
);
}
}
base-manager/src/main/java/com/mortals/xhx/busiz/web/MidSignApiController.java
View file @
603198ef
...
@@ -44,6 +44,14 @@ public class MidSignApiController {
...
@@ -44,6 +44,14 @@ public class MidSignApiController {
@Value
(
"${mid.secretKey:ad80c59e575a78ab}"
)
@Value
(
"${mid.secretKey:ad80c59e575a78ab}"
)
private
String
secretKey
;
private
String
secretKey
;
@Value
(
"${mid.publickey:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIwYDUWp+QkuihFJxWJmAQ0ZmdTVbOg7yETtckUZkUQ6JUKEzKz9UIbmjrKS8kLY39QDjyzCuOzBR2eF2ZrS89MCAwEAAQ==}"
)
private
String
publickey
=
""
;
@Value
(
"${mid.user:yibinTFTB}"
)
private
String
user
;
@Value
(
"${mid.pwd:f82c10dea5fc4936853ff90e576ac216}"
)
private
String
pwd
;
@PostMapping
(
value
=
"sign"
)
@PostMapping
(
value
=
"sign"
)
@UnAuth
@UnAuth
public
Rest
<
SignResp
>
midSign
(
@RequestBody
MidReq
midReq
)
{
public
Rest
<
SignResp
>
midSign
(
@RequestBody
MidReq
midReq
)
{
...
@@ -51,7 +59,7 @@ public class MidSignApiController {
...
@@ -51,7 +59,7 @@ public class MidSignApiController {
try
{
try
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
if
(
"post"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
if
(
"post"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
headerMap
.
put
(
"appId"
,
appId
);
headerMap
.
put
(
"appId"
,
appId
);
headerMap
.
put
(
"appKey"
,
appKey
);
headerMap
.
put
(
"appKey"
,
appKey
);
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
...
@@ -67,14 +75,14 @@ public class MidSignApiController {
...
@@ -67,14 +75,14 @@ public class MidSignApiController {
signResp
.
setTimeStamp
(
timeStamp
);
signResp
.
setTimeStamp
(
timeStamp
);
signResp
.
setNonce
(
nonce
);
signResp
.
setNonce
(
nonce
);
signResp
.
setSecretKey
(
secretKey
);
signResp
.
setSecretKey
(
secretKey
);
}
else
if
(
"get"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
}
else
if
(
"get"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
HashMap
<
String
,
String
>
paramsMap
=
JSON
.
parseObject
(
midReq
.
getBody
(),
HashMap
.
class
);
HashMap
<
String
,
String
>
paramsMap
=
JSON
.
parseObject
(
midReq
.
getBody
(),
HashMap
.
class
);
if
(!
paramsMap
.
isEmpty
())
{
if
(!
paramsMap
.
isEmpty
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
paramsMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
paramsMap
.
entrySet
())
{
headerMap
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
headerMap
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
}
}
}
else
{
}
else
{
}
}
...
@@ -96,19 +104,87 @@ public class MidSignApiController {
...
@@ -96,19 +104,87 @@ public class MidSignApiController {
signResp
.
setSign
(
sign
);
signResp
.
setSign
(
sign
);
return
Rest
.
ok
(
signResp
);
return
Rest
.
ok
(
signResp
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"签名异常"
,
e
);
log
.
error
(
"签名异常"
,
e
);
return
Rest
.
fail
(
"签名异常!"
);
return
Rest
.
fail
(
"签名异常!"
);
}
}
}
}
/**
/**
* 透传请求
* 透传请求
*
* @param midReq
* @param midReq
* @return
* @return
*/
*/
@PostMapping
(
value
=
"trans"
)
@PostMapping
(
value
=
"trans"
)
@UnAuth
@UnAuth
public
Rest
<
String
>
trans
(
@RequestBody
MidReq
midReq
)
{
public
Rest
<
String
>
trans
(
@RequestBody
MidReq
midReq
)
{
try
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
StringBuilder
signSb
=
new
StringBuilder
();
// headerMap.put("appId", appId);
headerMap
.
put
(
"appKey"
,
appKey
);
String
timeStamp
=
System
.
currentTimeMillis
()
+
""
;
headerMap
.
put
(
"timeStamp"
,
timeStamp
);
String
nonce
=
RandomUtil
.
randomNumbers
(
6
);
headerMap
.
put
(
"nonce"
,
nonce
);
headerMap
.
put
(
"secretKey"
,
secretKey
);
if
(
"post"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
}
else
if
(
"get"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
}
}*/
}
else
{
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
}
signSb
.
append
(
"appId"
).
append
(
"="
).
append
(
headerMap
.
get
(
"appId"
)).
append
(
"&"
);
signSb
.
append
(
"appKey"
).
append
(
"="
).
append
(
headerMap
.
get
(
"appKey"
)).
append
(
"&"
);
signSb
.
append
(
"body"
).
append
(
"="
).
append
(
headerMap
.
get
(
"body"
)).
append
(
"&"
);
signSb
.
append
(
"nonce"
).
append
(
"="
).
append
(
headerMap
.
get
(
"nonce"
)).
append
(
"&"
);
signSb
.
append
(
"secretKey"
).
append
(
"="
).
append
(
headerMap
.
get
(
"secretKey"
)).
append
(
"&"
);
signSb
.
append
(
"timeStamp"
).
append
(
"="
).
append
(
headerMap
.
get
(
"timeStamp"
)).
append
(
"&"
);
String
signStr
=
signSb
.
substring
(
0
,
signSb
.
length
()
-
1
);
log
.
info
(
"签名源字符串: "
+
signStr
);
String
sign
=
EncryptionUtils
.
SHA256
(
signStr
);
log
.
info
(
"签名计算结果: "
+
sign
);
headerMap
.
put
(
"sign"
,
sign
);
//请求转发
String
fullUrl
=
UrlBuilder
.
ofHttp
(
midUrl
).
addPath
(
midReq
.
getPath
()).
build
();
//String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
log
.
info
(
"mid url:{},body:{}"
,
fullUrl
,
headerMap
.
get
(
"body"
));
String
body
=
HttpUtil
.
createRequest
(
Method
.
POST
,
fullUrl
).
headerMap
(
headerMap
,
true
).
body
(
headerMap
.
get
(
"body"
)).
execute
().
body
();
JSONObject
bodyJson
=
JSONObject
.
parseObject
(
body
);
log
.
info
(
"mid resp:"
+
bodyJson
.
toJSONString
());
return
Rest
.
ok
(
bodyJson
.
toJSONString
());
}
catch
(
Exception
e
)
{
log
.
error
(
"透传请求异常"
,
e
);
return
Rest
.
fail
(
"透传请求异常!"
);
}
}
/**
* 透传请求 -rsa鉴权
*
* @param midReq
* @return
*/
@PostMapping
(
value
=
"transRsa"
)
@UnAuth
public
Rest
<
String
>
transByRsa
(
@RequestBody
MidReq
midReq
)
{
try
{
try
{
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
Map
<
String
,
String
>
headerMap
=
new
HashMap
<>();
StringBuilder
signSb
=
new
StringBuilder
();
StringBuilder
signSb
=
new
StringBuilder
();
...
@@ -119,17 +195,17 @@ public class MidSignApiController {
...
@@ -119,17 +195,17 @@ public class MidSignApiController {
String
nonce
=
RandomUtil
.
randomNumbers
(
6
);
String
nonce
=
RandomUtil
.
randomNumbers
(
6
);
headerMap
.
put
(
"nonce"
,
nonce
);
headerMap
.
put
(
"nonce"
,
nonce
);
headerMap
.
put
(
"secretKey"
,
secretKey
);
headerMap
.
put
(
"secretKey"
,
secretKey
);
if
(
"post"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
if
(
"post"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
}
else
if
(
"get"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
}
else
if
(
"get"
.
equalsIgnoreCase
(
midReq
.
getMethod
()))
{
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
headerMap.put(entry.getKey(), entry.getValue());
}
}
}*/
}*/
}
else
{
}
else
{
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
JSONObject
object1
=
JSONObject
.
parseObject
(
midReq
.
getBody
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
headerMap
.
put
(
"body"
,
object1
.
toJSONString
());
}
}
...
@@ -147,16 +223,16 @@ public class MidSignApiController {
...
@@ -147,16 +223,16 @@ public class MidSignApiController {
headerMap
.
put
(
"sign"
,
sign
);
headerMap
.
put
(
"sign"
,
sign
);
//请求转发
//请求转发
String
fullUrl
=
UrlBuilder
.
ofHttp
(
midUrl
).
addPath
(
midReq
.
getPath
()).
build
();
String
fullUrl
=
UrlBuilder
.
ofHttp
(
midUrl
).
addPath
(
midReq
.
getPath
()).
build
();
//String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
//String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
log
.
info
(
"mid url:{},body:{}"
,
fullUrl
,
headerMap
.
get
(
"body"
));
log
.
info
(
"mid url:{},body:{}"
,
fullUrl
,
headerMap
.
get
(
"body"
));
String
body
=
HttpUtil
.
createRequest
(
Method
.
POST
,
fullUrl
).
headerMap
(
headerMap
,
true
).
body
(
headerMap
.
get
(
"body"
)).
execute
().
body
();
String
body
=
HttpUtil
.
createRequest
(
Method
.
POST
,
fullUrl
).
headerMap
(
headerMap
,
true
).
body
(
headerMap
.
get
(
"body"
)).
execute
().
body
();
JSONObject
bodyJson
=
JSONObject
.
parseObject
(
body
);
JSONObject
bodyJson
=
JSONObject
.
parseObject
(
body
);
log
.
info
(
"mid resp:"
+
bodyJson
.
toJSONString
());
log
.
info
(
"mid resp:"
+
bodyJson
.
toJSONString
());
return
Rest
.
ok
(
bodyJson
.
toJSONString
());
return
Rest
.
ok
(
bodyJson
.
toJSONString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"透传请求异常"
,
e
);
log
.
error
(
"透传请求异常"
,
e
);
return
Rest
.
fail
(
"透传请求异常!"
);
return
Rest
.
fail
(
"透传请求异常!"
);
}
}
}
}
...
...
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