Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FrontEndProcessor
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
CrossProvincialPlatform
FrontEndProcessor
Commits
37ccd284
Commit
37ccd284
authored
May 20, 2021
by
华润
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跨省单位开户公积金服务接口
parent
851dab55
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
10 deletions
+84
-10
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
...j/adapter/controller/ProvidentFundServicesController.java
+63
-9
src/main/java/net/cdkj/gjj/adapter/controller/TokenAcquisitionController.java
...kj/gjj/adapter/controller/TokenAcquisitionController.java
+1
-0
src/main/java/net/cdkj/gjj/adapter/domain/TimeExpiredPoolCache.java
...ava/net/cdkj/gjj/adapter/domain/TimeExpiredPoolCache.java
+1
-1
src/main/java/net/cdkj/gjj/adapter/domain/UnitAccountOpeningInformation.java
...dkj/gjj/adapter/domain/UnitAccountOpeningInformation.java
+19
-0
No files found.
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
View file @
37ccd284
...
...
@@ -2,7 +2,9 @@ package net.cdkj.gjj.adapter.controller;
import
com.alibaba.fastjson.JSONObject
;
import
net.cdkj.gjj.adapter.domain.Json
;
import
net.cdkj.gjj.adapter.domain.TimeExpiredPoolCache
;
import
net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -11,6 +13,14 @@ import org.springframework.web.bind.annotation.RestController;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
static
net
.
cdkj
.
gjj
.
adapter
.
domain
.
GzipUtil
.
unzipString
;
import
static
net
.
cdkj
.
gjj
.
adapter
.
domain
.
GzipUtil
.
zipString
;
/**
* 公积金系统服务类
...
...
@@ -33,17 +43,21 @@ public class ProvidentFundServicesController {
if
(!
""
.
equals
(
token
)&&
token
!=
null
){
//若token未过期,则用内存中的token
String
resp
=
null
;
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"app_id"
,
"111"
);
jsonObject
.
put
(
"app_secret"
,
"222"
);
jsonObject
.
put
(
"grant_type"
,
"127.0.0.1"
);
jsonObject
.
put
(
"startTime"
,
currenttime
(
0
));
jsonObject
.
put
(
"endTime"
,
currenttime
(
24
));
jsonObject
.
put
(
"app_id"
,
"xxxxx"
);
jsonObject
.
put
(
"app_secret"
,
"xxxxx"
);
String
str
=
jsonObject
.
toString
();
System
.
out
.
println
(
"发送给第三方的报文:"
+
str
);
System
.
out
.
println
(
"zip压缩处理之前要发送给第三方的报文:"
+
str
);
String
s
=
zipString
(
str
);
//进行zip压缩
System
.
out
.
println
(
"zip压缩处理之后发送给第三方的报文:"
+
s
);
StringBuffer
sb
=
new
StringBuffer
();
HttpURLConnection
conn
=
null
;
OutputStream
out
=
null
;
try
{
// 创建url 资源
URL
url
=
new
URL
(
"http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices2"
);
//测试第三方地址
// URL url = new URL("https://scjg.hubei.gov.cn/sjzt/api/dx/e39a08e0a52b413897f9d23359540b27/GJJ?access_token="+token);//正式第三方地址
URL
url
=
new
URL
(
"http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/ProvidentFundServices2?access_token="
+
token
);
//测试第三方地址
// 创建http 连接
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
// 设置允许输出
...
...
@@ -79,8 +93,10 @@ public class ProvidentFundServicesController {
sb
.
append
(
readLine
);
}
responseReader
.
close
();
System
.
out
.
println
(
"第三方返回的报文:"
+
sb
.
toString
());
return
sb
.
toString
();
System
.
out
.
println
(
"第三方返回的zip压缩过的报文:"
+
sb
.
toString
());
String
s1
=
unzipString
(
sb
.
toString
());
//将第三方返回的压缩过的json字符串解压缩
System
.
out
.
println
(
"第三方返回的zip解压缩之后的报文:"
+
s1
);
return
s1
;
}
else
{
System
.
out
.
println
(
"请求失败!!!"
);
}
...
...
@@ -116,10 +132,48 @@ public class ProvidentFundServicesController {
public
String
ProvidentFundServices2
()
{
String
resp
=
null
;
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"expires_in"
,
60
);
jsonObject
.
put
(
"access_token"
,
"skdfhskjdfhskjdfhskdfjhk"
);
jsonObject
.
put
(
"code"
,
0
);
jsonObject
.
put
(
"message"
,
"数据交换成功"
);
List
<
UnitAccountOpeningInformation
>
data
=
new
ArrayList
<>();
UnitAccountOpeningInformation
openingInformation
=
new
UnitAccountOpeningInformation
();
openingInformation
.
setBusId
(
"332090874"
);
data
.
add
(
openingInformation
);
jsonObject
.
put
(
"data"
,
data
);
String
str
=
jsonObject
.
toString
();
return
jsonObject
.
toString
();
}
/**
* 获取当天零点零分零秒的时间戳和当天24点的时间戳
* @return
*/
@ResponseBody
@PostMapping
(
"currentime"
)
public
static
String
currenttime
(
int
type
){
String
time
=
null
;
if
(
type
==
0
){
// 获取当天零点零分零秒的时间戳
Calendar
curentDay
=
Calendar
.
getInstance
();
curentDay
.
setTime
(
new
Date
());
curentDay
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
curentDay
.
set
(
Calendar
.
MINUTE
,
0
);
curentDay
.
set
(
Calendar
.
SECOND
,
0
);
SimpleDateFormat
df2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
time
=
df2
.
format
(
curentDay
.
getTime
().
getTime
());
System
.
out
.
println
(
time
);
}
else
if
(
type
==
24
){
// 获取当天24点零分零秒的时间戳,即第二天零点时间
Calendar
curentDay
=
Calendar
.
getInstance
();
curentDay
.
setTime
(
new
Date
());
curentDay
.
set
(
Calendar
.
HOUR_OF_DAY
,
24
);
curentDay
.
set
(
Calendar
.
MINUTE
,
0
);
curentDay
.
set
(
Calendar
.
SECOND
,
0
);
SimpleDateFormat
df2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
time
=
df2
.
format
(
curentDay
.
getTime
().
getTime
());
System
.
out
.
println
(
time
);
}
return
time
;
}
}
src/main/java/net/cdkj/gjj/adapter/controller/TokenAcquisitionController.java
View file @
37ccd284
...
...
@@ -40,6 +40,7 @@ public class TokenAcquisitionController {
OutputStream
out
=
null
;
try
{
// 创建url 资源
// URL url = new URL("https://scjg.hubei.gov.cn/sjzt/api/oauth2/token");//正式第三方地址
URL
url
=
new
URL
(
"http://127.0.0.1:8080/FrontEndProcessor/FrontEndProcessor/token2"
);
//测试第三方地址
// 创建http 连接
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
...
...
src/main/java/net/cdkj/gjj/adapter/domain/TimeExpiredPoolCache.java
View file @
37ccd284
...
...
@@ -8,7 +8,7 @@ import java.util.TimerTask;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Cache缓存
工具
类
* Cache缓存类
*/
public
class
TimeExpiredPoolCache
{
private
static
long
defaultCachedMillis
=
30
*
1000L
;
//过期时间默认10秒
...
...
src/main/java/net/cdkj/gjj/adapter/domain/UnitAccountOpeningInformation.java
0 → 100644
View file @
37ccd284
package
net.cdkj.gjj.adapter.domain
;
import
java.util.Objects
;
/**
* 单位开户信息对象
*/
public
class
UnitAccountOpeningInformation
{
private
String
busId
;
public
String
getBusId
()
{
return
busId
;
}
public
void
setBusId
(
String
busId
)
{
this
.
busId
=
busId
;
}
}
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