Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-api-report
Overview
Overview
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
雷紫添
xzxt-api-report
Commits
17632900
Commit
17632900
authored
Sep 02, 2019
by
雷紫添
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传zip
parent
bb9798b4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
27 deletions
+134
-27
src/main/java/com/founder/controller/JccjController.java
+5
-3
src/main/java/com/founder/model/Jccj.java
+5
-5
src/main/java/com/founder/model/Rycj.java
+27
-0
src/main/java/com/founder/service/RycjService.java
+2
-1
src/main/java/com/founder/service/impl/JccjServiceImpl.java
+17
-11
src/main/java/com/founder/service/impl/RycjServiceImpl.java
+46
-1
src/main/java/com/founder/test.java
+4
-0
src/main/java/com/founder/util/FtpUtil.java
+2
-2
src/main/resources/application-dev.yml
+2
-2
src/main/resources/mybatis/mapper/Rycj.xml
+24
-2
No files found.
src/main/java/com/founder/controller/JccjController.java
View file @
17632900
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -24,13 +25,14 @@ import java.util.List;
...
@@ -24,13 +25,14 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
@Controller
@Controller
@RequestMapping
(
"/jccj"
)
public
class
JccjController
{
public
class
JccjController
{
@Autowired
@Autowired
private
JccjService
jccjService
;
private
JccjService
jccjService
;
@RequestMapping
(
value
=
"/jccj/xxbs"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
@RequestMapping
(
value
=
"/xxbs"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
void
queryDatas
(
HttpServletResponse
response
,
@RequestBody
Jccj
jccj
)
{
public
void
queryDatas
(
HttpServletResponse
response
,
HttpServletRequest
request
,
@RequestBody
Jccj
jccj
)
{
//1.验证是否非法调用(1.ip受限访问.2.加锁防止重复提交.3.文件名)
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
res
=
jccjService
.
res
(
jccj
);
res
=
jccjService
.
res
(
jccj
);
...
...
src/main/java/com/founder/model/Jccj.java
View file @
17632900
...
@@ -9,7 +9,7 @@ public class Jccj {
...
@@ -9,7 +9,7 @@ public class Jccj {
private
String
taskid
;
private
String
taskid
;
private
String
xxsb_zip
;
private
String
xxsb_zip
;
private
String
status_code
;
private
String
status_code
;
private
String
message
;
private
String
status_
message
;
/*1. user_id:请求人_公民身份号码,触发本次请求服务的用户身份证号码。必填。
/*1. user_id:请求人_公民身份号码,触发本次请求服务的用户身份证号码。必填。
2. user_dept:请求方_公安机关机构代码,触发本次请求服务的用户所在单位机构代码,采用《GA 380 公安机关机构代码编制规则》统一编制的代码。必填。
2. user_dept:请求方_公安机关机构代码,触发本次请求服务的用户所在单位机构代码,采用《GA 380 公安机关机构代码编制规则》统一编制的代码。必填。
3. version:请求接口版本号,请求接口版本号,默认版本1.00。必填。
3. version:请求接口版本号,请求接口版本号,默认版本1.00。必填。
...
@@ -62,12 +62,12 @@ public class Jccj {
...
@@ -62,12 +62,12 @@ public class Jccj {
this
.
status_code
=
status_code
;
this
.
status_code
=
status_code
;
}
}
public
String
get
M
essage
()
{
public
String
get
Status_m
essage
()
{
return
message
;
return
status_
message
;
}
}
public
void
set
Message
(
String
message
)
{
public
void
set
Status_message
(
String
status_
message
)
{
this
.
message
=
message
;
this
.
status_message
=
status_
message
;
}
}
public
String
getUser_id
()
{
public
String
getUser_id
()
{
...
...
src/main/java/com/founder/model/Rycj.java
View file @
17632900
...
@@ -16,6 +16,33 @@ public class Rycj {
...
@@ -16,6 +16,33 @@ public class Rycj {
private
String
user_id
;
private
String
user_id
;
private
String
user_dept
;
private
String
user_dept
;
private
String
version
;
private
String
version
;
private
String
status_code
;
private
String
status_message
;
private
String
zxjgdm
;
public
String
getStatus_code
()
{
return
status_code
;
}
public
void
setStatus_code
(
String
status_code
)
{
this
.
status_code
=
status_code
;
}
public
String
getStatus_message
()
{
return
status_message
;
}
public
void
setStatus_message
(
String
status_message
)
{
this
.
status_message
=
status_message
;
}
public
String
getZxjgdm
()
{
return
zxjgdm
;
}
public
void
setZxjgdm
(
String
zxjgdm
)
{
this
.
zxjgdm
=
zxjgdm
;
}
public
String
getXxzjbh
()
{
public
String
getXxzjbh
()
{
return
xxzjbh
;
return
xxzjbh
;
...
...
src/main/java/com/founder/service/RycjService.java
View file @
17632900
package
com
.
founder
.
service
;
package
com
.
founder
.
service
;
import
com.founder.model.Jccj
;
import
com.founder.model.Rycj
;
import
com.founder.model.Rycj
;
import
java.util.List
;
import
java.util.List
;
...
@@ -9,5 +10,5 @@ import java.util.Map;
...
@@ -9,5 +10,5 @@ import java.util.Map;
public
interface
RycjService
{
public
interface
RycjService
{
boolean
insertRycj
(
Rycj
ry
cj
);
boolean
insertRycj
(
Jccj
jc
cj
);
}
}
src/main/java/com/founder/service/impl/JccjServiceImpl.java
View file @
17632900
...
@@ -7,6 +7,7 @@ import com.founder.dao.FaceDao;
...
@@ -7,6 +7,7 @@ import com.founder.dao.FaceDao;
import
com.founder.model.Face
;
import
com.founder.model.Face
;
import
com.founder.model.Jccj
;
import
com.founder.model.Jccj
;
import
com.founder.service.AutoSeqService
;
import
com.founder.service.AutoSeqService
;
import
com.founder.service.RycjService
;
import
com.founder.util.RequertUtil
;
import
com.founder.util.RequertUtil
;
import
com.founder.service.JccjService
;
import
com.founder.service.JccjService
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.HttpStatus
;
...
@@ -34,22 +35,22 @@ import java.util.Map;
...
@@ -34,22 +35,22 @@ import java.util.Map;
@Service
@Service
public
class
JccjServiceImpl
implements
JccjService
{
public
class
JccjServiceImpl
implements
JccjService
{
@Autowired
@Autowired
private
AutoSeqService
autoSeq
Service
;
private
RycjService
rycj
Service
;
@Override
@Override
public
Map
<
String
,
Object
>
res
(
Jccj
jccj
){
public
Map
<
String
,
Object
>
res
(
Jccj
jccj
){
String
noo
=
autoSeqService
.
xxzjbhFnVal
(
"TB_ST_ASJ"
,
"1400000000000"
);
//1.验证是否非法调用
//2..将从采集平台获取的信息,在发送给公安部
//2..将从采集平台获取的信息,在发送给公安部
// JSONObject jsonResult= requestByPost("http://api.xz.xz.ga/jccj/xxbs",jccj);
// JSONObject jsonResult= requestByPost("http://api.xz.xz.ga/jccj/xxbs",jccj);
//返回的信息入库并返回第三方
//2.公安部返回的信息jsonResult 中如果成功无误,保存到ftp服务器以及数据库,如果失败直接将失败信息返回
//3.公安部返回的信息jsonResult 中如果成功无误,保存到ftp服务器以及数据库,如果失败直接将失败信息返回
final
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
Boolean
sf
=
rycjService
.
insertRycj
(
jccj
);
//获取zip包 进行入库
//初版 暂时存入库
byte
[]
D
=
decoder
.
decode
(
jccj
.
getXxsb_zip
());
RequertUtil
.
zi1
(
D
);
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
res
.
put
(
"taskid"
,
"success"
);
if
(
sf
){
res
.
put
(
"tstatus_code"
,
"登陆成功"
);
res
.
put
(
"status_code"
,
"010101"
);
res
.
put
(
"message"
,
"存入成功"
);}
else
{
res
.
put
(
"status_code"
,
"010102"
);
res
.
put
(
"message"
,
"存入失败"
);
}
return
res
;
return
res
;
}
}
...
@@ -57,6 +58,11 @@ public class JccjServiceImpl implements JccjService {
...
@@ -57,6 +58,11 @@ public class JccjServiceImpl implements JccjService {
public
static
JSONObject
requestByPost
(
String
url
,
Jccj
jsonParamq
)
{
public
static
JSONObject
requestByPost
(
String
url
,
Jccj
jsonParamq
)
{
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
Map
<
String
,
Object
>
res
=
new
HashMap
<>();
res
.
put
(
"xxsb_zip"
,
jsonParamq
.
getXxsb_zip
());
res
.
put
(
"xxsb_zip"
,
jsonParamq
.
getXxsb_zip
());
res
.
put
(
"user_dept"
,
jsonParamq
.
getUser_dept
());
res
.
put
(
"user_id"
,
jsonParamq
.
getUser_id
());
res
.
put
(
"taskid"
,
jsonParamq
.
getTaskid
());
res
.
put
(
"version"
,
jsonParamq
.
getVersion
());
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
res
));
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
res
));
// post请求返回结果
// post请求返回结果
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
...
...
src/main/java/com/founder/service/impl/RycjServiceImpl.java
View file @
17632900
package
com
.
founder
.
service
.
impl
;
package
com
.
founder
.
service
.
impl
;
import
com.founder.dao.RycjDao
;
import
com.founder.dao.RycjDao
;
import
com.founder.model.Jccj
;
import
com.founder.model.Rycj
;
import
com.founder.model.Rycj
;
import
com.founder.service.AutoSeqService
;
import
com.founder.service.RycjService
;
import
com.founder.service.RycjService
;
import
com.founder.util.FtpUtil
;
import
com.founder.util.RequertUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.Base64
;
import
java.util.Date
;
@Service
@Service
public
class
RycjServiceImpl
implements
RycjService
{
public
class
RycjServiceImpl
implements
RycjService
{
@Autowired
@Autowired
private
RycjDao
rycjDao
;
private
RycjDao
rycjDao
;
@Autowired
private
AutoSeqService
autoSeqService
;
@Value
(
value
=
"${ftpfilePath}"
)
private
String
ftpfilePath
;
@Value
(
value
=
"${ftpserverip}"
)
private
String
ftpserverip
;
@Value
(
value
=
"${ftpport}"
)
private
int
ftpport
;
@Value
(
value
=
"${ftpuser}"
)
private
String
ftpuser
;
@Value
(
value
=
"${ftppass}"
)
private
String
ftppass
;
@Value
(
value
=
"${ftpbathPath}"
)
private
String
ftpbathPath
;
@Override
@Override
public
boolean
insertRycj
(
Rycj
rycj
)
{
public
boolean
insertRycj
(
Jccj
jccj
)
{
Rycj
rycj
=
new
Rycj
();
SimpleDateFormat
sf
=
new
SimpleDateFormat
(
"yyyyMM"
);
String
dateString
=
sf
.
format
(
new
Date
());
rycj
.
setXxzjbh
(
autoSeqService
.
xxzjbhFnVal
(
"TB_ST_RYCJ"
,
jccj
.
getUser_dept
()));
rycj
.
setRycj_dzwjgs
(
".zip"
);
rycj
.
setRycj_dzwjwz
(
ftpfilePath
+
"/"
+
dateString
+
"/"
+
rycj
.
getXxzjbh
()+
rycj
.
getRycj_dzwjgs
());
rycj
.
setRycj_jlsj
(
new
Date
());
rycj
.
setUser_id
(
jccj
.
getUser_id
());
rycj
.
setUser_dept
(
jccj
.
getUser_dept
());
rycj
.
setTaskid
(
jccj
.
getTaskid
());
rycj
.
setVersion
(
jccj
.
getVersion
());
rycj
.
setStatus_code
(
jccj
.
getStatus_code
());
rycj
.
setStatus_message
(
jccj
.
getStatus_message
());
final
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
//获取zip包 进行入库
byte
[]
data
=
decoder
.
decode
(
jccj
.
getXxsb_zip
());
InputStream
in
=
new
ByteArrayInputStream
(
data
);
boolean
bool
=
false
;
boolean
bool
=
false
;
try
{
try
{
int
rows
=
rycjDao
.
insertRycj
(
rycj
);
int
rows
=
rycjDao
.
insertRycj
(
rycj
);
if
(
rows
>
0
){
if
(
rows
>
0
){
FtpUtil
.
uploadFile
(
ftpserverip
,
ftpport
,
ftpuser
,
ftppass
,
ftpbathPath
,
dateString
,
rycj
.
getTaskid
(),
in
);
bool
=
true
;
bool
=
true
;
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
...
src/main/java/com/founder/test.java
View file @
17632900
...
@@ -27,6 +27,10 @@ public class test {
...
@@ -27,6 +27,10 @@ public class test {
//编码
//编码
final
String
encodedText
=
encoder
.
encodeToString
(
buffer
);
final
String
encodedText
=
encoder
.
encodeToString
(
buffer
);
jccj
.
setXxsb_zip
(
encodedText
);
jccj
.
setXxsb_zip
(
encodedText
);
jccj
.
setTaskid
(
"JCXX-R1100000500002014070008"
);
jccj
.
setUser_id
(
"142728188997588823"
);
jccj
.
setUser_dept
(
"140000000000"
);
jccj
.
setVersion
(
"1.00"
);
//发送,httpclient 包含zip包
//发送,httpclient 包含zip包
JSONObject
jsonResult
=
JccjServiceImpl
.
requestByPost
(
"http://localhost/jccj/xxbs"
,
jccj
);
JSONObject
jsonResult
=
JccjServiceImpl
.
requestByPost
(
"http://localhost/jccj/xxbs"
,
jccj
);
System
.
out
.
println
(
jsonResult
.
toJSONString
());
System
.
out
.
println
(
jsonResult
.
toJSONString
());
...
...
src/main/java/com/founder/util/FtpUtil.java
View file @
17632900
...
@@ -162,8 +162,8 @@ public class FtpUtil {
...
@@ -162,8 +162,8 @@ public class FtpUtil {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
try
{
try
{
FileInputStream
in
=
new
FileInputStream
(
new
File
(
"D:\\
1.jpg
"
));
FileInputStream
in
=
new
FileInputStream
(
new
File
(
"D:\\
JCXX-R1100000500002014070008.zip
"
));
boolean
flag
=
uploadFile
(
"47.92.129.99"
,
4546
,
"ftpuser"
,
"p@ssw0rd[123]"
,
"/home/ftpuser/"
,
"/2016/"
,
"
gaigeming.jpg
"
,
in
);
boolean
flag
=
uploadFile
(
"47.92.129.99"
,
4546
,
"ftpuser"
,
"p@ssw0rd[123]"
,
"/home/ftpuser/"
,
"/2016/"
,
"
JCXX-R1100000500002014070008.zip
"
,
in
);
System
.
out
.
println
(
flag
);
System
.
out
.
println
(
flag
);
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/resources/application-dev.yml
View file @
17632900
...
@@ -22,8 +22,8 @@ ftpserverip: 47.92.129.99
...
@@ -22,8 +22,8 @@ ftpserverip: 47.92.129.99
ftpport
:
4546
ftpport
:
4546
ftpuser
:
ftpuser
ftpuser
:
ftpuser
ftppass
:
p@ssw0rd[123]
ftppass
:
p@ssw0rd[123]
ftpbathPath
:
/home/ftpuser/www/
xinjiangbingtuan
/FZXZ
ftpbathPath
:
/home/ftpuser/www/
neimeng
/FZXZ
ftpfilePath
:
/
xinjiangbingtuan
/FZXZ
ftpfilePath
:
/
niemeng
/FZXZ
codemsg
:
codemsg
:
status
:
status
:
...
...
src/main/resources/mybatis/mapper/Rycj.xml
View file @
17632900
...
@@ -16,7 +16,11 @@
...
@@ -16,7 +16,11 @@
TASKID,
TASKID,
USER_ID,
USER_ID,
USER_DEPT,
USER_DEPT,
VERSION
VERSION,
STATUS_CODE,
STATUS_MESSAGE,
ZXJGDM
)VALUES (
)VALUES (
<if
test=
"xxzjbh != null"
>
<if
test=
"xxzjbh != null"
>
#{xxzjbh},
#{xxzjbh},
...
@@ -85,9 +89,27 @@
...
@@ -85,9 +89,27 @@
NULL ,
NULL ,
</if>
</if>
<if
test=
"version != null"
>
<if
test=
"version != null"
>
#{version}
#{version},
</if>
<if
test=
"version == null"
>
NULL,
</if>
<if
test=
"status_code != null"
>
#{status_code},
</if>
</if>
<if
test=
"version == null"
>
<if
test=
"version == null"
>
NULL,
</if>
<if
test=
"status_message != null"
>
#{status_message},
</if>
<if
test=
"status_message == null"
>
NULL,
</if>
<if
test=
"zxjgdm != null"
>
#{zxjgm}
</if>
<if
test=
"zxjgdm == null"
>
NULL
NULL
</if>
</if>
)
)
...
...
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