Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hnxtbaboot
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
杨亮
hnxtbaboot
Commits
f5c702d6
Commit
f5c702d6
authored
Jan 22, 2021
by
yangliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
d0178444
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2432 additions
and
397 deletions
+2432
-397
pom.xml
+15
-0
src/main/java/com/founder/controller/SavePersonInfo4Nmtc.java
+723
-0
src/main/java/com/founder/controller/TbXwRycjController.java
+32
-397
src/main/java/com/founder/login/controller/LoginController.java
+10
-0
src/main/java/com/founder/model/Jzryxx.java
+135
-0
src/main/java/com/founder/util/CommonFunc.java
+1007
-0
src/main/java/com/founder/util/ServiceUtil.java
+392
-0
src/main/java/com/founder/utils/QueryService.java
+116
-0
src/main/resources/application.properties
+2
-0
No files found.
pom.xml
View file @
f5c702d6
...
...
@@ -119,6 +119,21 @@
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.axis
</groupId>
<artifactId>
axis
</artifactId>
<version>
1.0.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.jaxrpc
</groupId>
<artifactId>
jaxrpc
</artifactId>
<version>
1.0.1
</version>
</dependency>
<dependency>
<groupId>
commons-discovery
</groupId>
<artifactId>
commons-discovery
</artifactId>
<version>
0.2
</version>
</dependency>
<dependency>
<groupId>
com.founder.commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
1.0
</version>
...
...
src/main/java/com/founder/controller/SavePersonInfo4Nmtc.java
0 → 100644
View file @
f5c702d6
package
com
.
founder
.
controller
;
import
java.io.*
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
com.founder.login.service.LoginService
;
import
com.founder.model.AutoTbRyZp
;
import
com.founder.model.AutoTbStRy
;
import
com.founder.model.Param
;
import
com.founder.model.User
;
import
com.founder.module.redis.service.IDicItemService
;
import
com.founder.service.AutoTbXwRycjService
;
import
com.founder.service.IParamService
;
import
com.founder.service.ITbRyRyzpService
;
import
com.founder.service.SequenceService
;
import
com.founder.util.ServiceUtil
;
import
com.founder.utils.QueryService
;
import
com.founder.utils.StringUtil
;
import
com.founder.utils.SysUitl
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
@Controller
public
class
SavePersonInfo4Nmtc
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
AutoTbXwRycjService
rycjService
;
@Autowired
private
ITbRyRyzpService
tbRyRyzpService
;
@Autowired
private
IDicItemService
dicItemService
;
@Autowired
private
LoginService
loginService
;
@Autowired
private
IParamService
paramService
;
@RequestMapping
(
"/SavePersonInfo4Nmtc"
)
@ResponseBody
public
String
SavePersonInfo4Nmtc
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
request
.
setCharacterEncoding
(
"GBK"
);
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
PDBS
=
StringUtil
.
checknull
(
request
.
getParameter
(
"PDBS"
));
//判断标识
String
RYBH
=
StringUtil
.
checknull
(
request
.
getParameter
(
"RYBH"
));
//人员编号
if
(
RYBH
==
null
||
""
.
equals
(
RYBH
)){
log
.
info
(
"无人员编号!"
);
return
"-1"
;
}
xyrC
.
setJzrybh
(
RYBH
);
xyrC
.
setRybh
(
RYBH
);
xyrC
.
setXm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XM"
)));
// 姓名
xyrC
.
setXbdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XB"
)));
// 性别
xyrC
.
setCym
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CYM"
)));
// 曾用名
xyrC
.
setBmch
(
StringUtil
.
checknull
(
request
.
getParameter
(
"BMCH"
)));
// 别名绰号
xyrC
.
setXmhypy
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XMHYPY"
)));
// 姓名汉语拼音
xyrC
.
setGjdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"GJ"
)));
// 国籍
xyrC
.
setJgssxdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"JG"
)));
// 籍贯
String
CSRQ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"CSRQ"
));
// 出生日期
xyrC
.
setMzdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"MZ"
)));
// 民族
xyrC
.
setSgsx
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SG"
)));
// 身高
xyrC
.
setTzsx
(
StringUtil
.
checknull
(
request
.
getParameter
(
"TZ"
)));
// 体重
xyrC
.
setZc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZC"
)));
// 足长
xyrC
.
setXldm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WHCD"
)));
// 文化程度
xyrC
.
setZylbdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZYLB"
)));
// 职业类别代码
xyrC
.
setZylbdmbcms
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZY"
)));
// 职业描述
xyrC
.
setLxdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"LXDH"
)));
// 联系电话
xyrC
.
setJyzkdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HYZK"
)));
// 婚姻状况
xyrC
.
setZjxydm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZJXY"
)));
// 宗教信仰
xyrC
.
setZzmmdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZZMM"
)));
// 政治面貌
xyrC
.
setByzkdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"BYZK"
)));
// 服役状况
xyrC
.
setSarysfdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SF"
)));
// 身份
xyrC
.
setTszcdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"TSZC"
)));
// 专长
xyrC
.
setCyzjdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZJLX"
)));
// 证件类型
String
ZHRQ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHRQ"
));
// 抓获日期
xyrC
.
setZhfsdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHFS"
)));
// 抓获方式
xyrC
.
setZhddqh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDQ"
)));
// 抓获地点区划
xyrC
.
setZhddxz
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDD"
)));
// 抓获地点详址
xyrC
.
setZhdwdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDW"
)));
// 抓获单位
xyrC
.
setAsjbh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"AJBH"
)));
// 案件编号
xyrC
.
setWffzjlms
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WFFZJL"
)));
// 违法犯罪经历
xyrC
.
setJyaq
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WFFZJL"
)));
// 违法犯罪经历
xyrC
.
setZjhm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SFZH"
)));
//身份证号
xyrC
.
setHjdzXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HJQH"
)));
//户籍区划
xyrC
.
setHjdzDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HJXZ"
)));
//户籍详址
xyrC
.
setXzzXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XZQH"
)));
//现住地区划
xyrC
.
setXzzDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XZXZ"
)));
//现住地详址
xyrC
.
setCsdXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CSDQH"
)));
//出生地区划
xyrC
.
setCsdDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CSDXZ"
)));
//出生地详址
xyrC
.
setFwcs
(
StringUtil
.
checknull
(
request
.
getParameter
(
"GZDW"
)));
//工作单位
xyrC
.
setSzzwbh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZWBH"
)));
//指纹编号
xyrC
.
setDnabh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"DNABH"
)));
//DNA编号
xyrC
.
setBzw
(
StringUtil
.
checknull
(
request
.
getParameter
(
"RYLX"
)));
//人员类型
//xyrC.setZwcjr(StringUtil.checknull(request.getParameter("CJR")));//采集人
//xyrC.setZwcjrXm(StringUtil.checknull(request.getParameter("CJR")));//采集人
//xyrC.setZwcjdwdm(StringUtil.checknull(request.getParameter("CJDW")));//采集单位
//String zwcjsj=StringUtil.checknull(request.getParameter("CJSJ"));//采集时间
String
DJDW
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJDW"
));
//登记单位
String
DJR
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJR"
));
//登记人
String
DJSJ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJSJ"
));
//登记时间
Date
djsj_temp
=
null
;
try
{
if
(
CSRQ
==
null
||
CSRQ
.
equals
(
""
)){
xyrC
.
setCsrqQsrq
(
null
);
}
else
{
xyrC
.
setCsrqQsrq
(
df
.
parse
(
CSRQ
));
}
if
(
ZHRQ
==
null
||
ZHRQ
.
equals
(
""
)){
xyrC
.
setZhsj
(
null
);
}
else
{
xyrC
.
setZhsj
(
df
.
parse
(
ZHRQ
));
}
//if(zwcjsj==null||zwcjsj.equals("")){
//}else{
// xyrC.setZwcjsj(df.parse(zwcjsj));
//}
if
(
DJSJ
==
null
||
DJSJ
.
equals
(
""
)){
}
else
{
djsj_temp
=
df
.
parse
(
DJSJ
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
xyrC
.
setLrdwdm
(
DJDW
);
xyrC
.
setLrr
(
DJR
);
xyrC
.
setGxr
(
DJR
);
xyrC
.
setLrsj
(
djsj_temp
);
xyrC
.
setGxsj
(
djsj_temp
);
if
(
DJDW
!=
null
&&
DJDW
.
length
()>=
12
&&!
"43"
.
equals
(
DJDW
.
substring
(
0
,
2
))){
xyrC
.
setGxdwdm
(
DJDW
);
xyrC
.
setXxdjdwGajgjgdm
(
DJDW
);
xyrC
.
setXxczdwGajgjgdm
(
DJDW
);
xyrC
.
setDjsj
(
djsj_temp
);
}
int
iRet
=-
1
;
//返回值 -1表示失败,1表示成功
boolean
bool
=
false
;
if
(
"JZTS"
.
equals
(
PDBS
)){
AutoTbStRy
jzxyr
=
rycjService
.
getRyxxByJzrybh
(
RYBH
);
if
(
jzxyr
!=
null
&&
jzxyr
.
getRybh
()!=
null
&&!
""
.
equals
(
jzxyr
.
getRybh
())){
xyrC
.
setRybh
(
jzxyr
.
getRybh
());
bool
=
rycjService
.
updateRyxx
(
xyrC
);
//updateRycj(RYBH,XM,XB,BMCH,GJ,CSRQ,MZ,SFZH,HJQH,HJXZ,XZQH,XZXZ,RYLX,DJDW,DJR,DJSJ,CYM,JG,WHCD,ZYLB,ZY,LXDH,HYZK,ZJXY,SF,ZC,ZJLX,ZHRQ,ZHFS,ZHDQ,ZHDD,ZHDW,AJBH,WFFZJL);
}
else
{
User
user
=
loginService
.
getUserByUsername
(
DJR
);
if
(
user
==
null
){
user
=
loginService
.
getUserByUsername
(
"admin"
);
}
user
.
setUnitcode
(
DJDW
);
//String rybhString = sequenceService.getNextSerialNo("TB_ST_RY",user.getUnitcode(), user);
//xyrC.setRybh(rybhString);
bool
=
rycjService
.
insertRyxx
(
xyrC
);
//bool=insertRycj(RYBH,XM,XB,BMCH,GJ,CSRQ,MZ,SFZH,HJQH,HJXZ,XZQH,XZXZ,RYLX,DJDW,DJR,DJSJ,CYM,JG,WHCD,ZYLB,ZY,LXDH,HYZK,ZJXY,SF,ZC,ZJLX,ZHRQ,ZHFS,ZHDQ,ZHDD,ZHDW,AJBH,WFFZJL);
}
}
if
(
bool
){
iRet
=
1
;
}
return
iRet
+
""
;
}
@RequestMapping
(
value
=
"/singleLoginAct"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
String
singleLoginAct
(
HttpServletRequest
request
,
Model
model
,
String
paramval
,
String
asjxgrybh
,
String
rybh
,
String
username
,
String
sfhlcjy
,
String
cjxm
){
String
userId
=
request
.
getParameter
(
"userId"
);
String
pv
=
request
.
getParameter
(
"paramval"
);
if
(
paramval
==
null
||
""
.
equals
(
paramval
)){
paramval
=
pv
;
}
if
(
asjxgrybh
==
null
||
""
.
equals
(
asjxgrybh
)){
asjxgrybh
=
rybh
;
}
if
(
asjxgrybh
==
null
||
""
.
equals
(
asjxgrybh
)){
asjxgrybh
=
paramval
;
}
String
returnStr
=
""
;
String
perurl
=
""
;
String
pagetype
=
""
;
User
user
=
null
;
user
=(
User
)
request
.
getSession
().
getAttribute
(
"User"
);
if
(
asjxgrybh
!=
null
&&!
""
.
equals
(
asjxgrybh
))
{
String
[]
rst
=
asjxgrybh
.
split
(
","
);
//System.out.println(rst);
if
(
rst
.
length
>=
4
)
{
rybh
=
rst
[
0
];
userId
=
rst
[
1
];
pagetype
=
rst
[
2
];
perurl
=
rst
[
3
];
String
cjcs
=
rst
[
4
];
if
(!
"JZTS"
.
equals
(
cjcs
)){
log
.
info
(
"参数错误!"
);
return
"login/login.html"
;
}
}
else
{
log
.
info
(
"参数错误!"
);
return
"login/login.html"
;
}
}
//if(user==null){
if
(
asjxgrybh
!=
null
&&!
""
.
equals
(
asjxgrybh
)){
user
=
loginService
.
getUserByUsername
(
userId
);
}
else
{
user
=
loginService
.
getUserById
(
userId
);
}
//}
if
(
user
!=
null
){
if
(
userId
==
null
||
""
.
equals
(
userId
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitname"
,
user
.
getUnitname
());
model
.
addAttribute
(
"truename"
,
user
.
getTrueName
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
returnStr
=
"home.html"
;
log
.
info
(
"登陆成功"
);
}
else
{
if
(
"RYCJ"
.
equals
(
pagetype
)||
"rycj"
.
equals
(
pagetype
)){
if
(
rybh
==
null
||
""
.
equals
(
rybh
)){
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"user"
,
user
);
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"cjsb"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
model
.
addAttribute
(
"hmzt"
,
"0"
);
model
.
addAttribute
(
"zjzt"
,
"0"
);
model
.
addAttribute
(
"swzt"
,
"0"
);
model
.
addAttribute
(
"sjzt"
,
"0"
);
model
.
addAttribute
(
"yhkzt"
,
"0"
);
model
.
addAttribute
(
"sswpzt"
,
"rybh is null"
);
model
.
addAttribute
(
"jztszt"
,
"rybh is null"
);
}
else
{
int
rstnum
=
0
;
if
(
user
.
getUnitcode
().
startsWith
(
"15"
))
{
rstnum
=
savePerson
(
rybh
,
user
.
getUnitcode
());
//表示刑专库没有警综的人员信息也没有获取到人员信息
if
(
rstnum
<
1
)
{
System
.
out
.
println
(
"jzerror"
);
}
else
{
String
rybhrst
=
existRycj
(
rybh
);
rybh
=
rybhrst
;
}
}
AutoTbStRy
xyrC
=
rycjService
.
getRyxxByRybh
(
rybh
);
if
(
xyrC
==
null
||
xyrC
.
getRybh
()
==
null
||
""
.
equals
(
xyrC
.
getRybh
()))
{
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"user"
,
user
);
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"cjsb"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
model
.
addAttribute
(
"hmzt"
,
"0"
);
model
.
addAttribute
(
"zjzt"
,
"0"
);
model
.
addAttribute
(
"swzt"
,
"0"
);
model
.
addAttribute
(
"sjzt"
,
"0"
);
model
.
addAttribute
(
"yhkzt"
,
"0"
);
if
(
rstnum
<
1
)
{
model
.
addAttribute
(
"sswpzt"
,
"jzerror"
);
model
.
addAttribute
(
"jztszt"
,
"jzerror"
);
}
else
{
model
.
addAttribute
(
"sswpzt"
,
"ythcjerror"
);
model
.
addAttribute
(
"jztszt"
,
"ythcjerror"
);
}
}
else
{
if
(
rstnum
<
1
)
{
model
.
addAttribute
(
"sswpzt"
,
"xttrue"
);
model
.
addAttribute
(
"jztszt"
,
"jzerror"
);
}
else
{
model
.
addAttribute
(
"sswpzt"
,
"true"
);
model
.
addAttribute
(
"jztszt"
,
"true"
);
}
if
(
xyrC
.
getLrr
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getLrr
()))
{
try
{
xyrC
.
setLrrXm
(
dicItemService
.
queryNameByCode
(
xyrC
.
getLrr
(),
"CODE_JY"
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"代码内容获取异常!"
+
e
);
}
if
(
xyrC
.
getLrrXm
()
==
null
||
""
.
equals
(
xyrC
.
getLrrXm
()))
{
xyrC
.
setLrrXm
(
xyrC
.
getLrr
());
}
}
else
{
xyrC
.
setLrrXm
(
user
.
getTrueName
());
}
if
(
xyrC
.
getZwcjr
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getZwcjr
()))
{
try
{
xyrC
.
setZwcjrXm
(
dicItemService
.
queryNameByCode
(
xyrC
.
getZwcjr
(),
"CODE_JY"
));
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"代码内容获取异常!"
+
e
);
}
}
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
if
(
xyrC
.
getLrsj
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getLrsj
()))
{
xyrC
.
setLrsjStr
(
df
.
format
(
xyrC
.
getLrsj
()));
}
if
(
xyrC
.
getCsrqQsrq
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getCsrqQsrq
()))
{
xyrC
.
setCsrqQsrqStr
(
df
.
format
(
xyrC
.
getCsrqQsrq
()));
}
if
(
xyrC
.
getZhsj
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getZhsj
()))
{
xyrC
.
setZhsjStr
(
df
.
format
(
xyrC
.
getZhsj
()));
}
if
(
xyrC
.
getZwcjsj
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getZwcjsj
()))
{
xyrC
.
setZwcjsjStr
(
df
.
format
(
xyrC
.
getZwcjsj
()));
}
String
rybhstr
=
xyrC
.
getRybh
();
String
savePath
=
"/personphoto/"
+
rybhstr
.
substring
(
rybhstr
.
length
()
-
10
,
rybhstr
.
length
()
-
4
)
+
"/"
+
rybhstr
.
substring
(
rybhstr
.
length
()
-
3
,
rybhstr
.
length
());
//String hcfilePath = request.getServletContext().getRealPath("/").replaceAll("\\\\","/");
AutoTbRyZp
ryzp_pd
=
null
;
// 判断照片编号是否有对应照片
Param
param
=
paramService
.
getParamById
(
"0100"
);
String
zplj
=
param
.
getParamvalue
();
String
filePath
=
zplj
;
filePath
=
filePath
+
savePath
;
File
filejia1
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"1.jpg"
);
if
(
filejia1
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"1.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"1");
xyrC
.
setEdzzpStr64
(
zpBase64
);
//xyrC.setEdzzplj("static/img"+savePath+"/"+rybhstr+"1.jpg");
xyrC
.
setEDZZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getEdzzpxxbh
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getEdzzpxxbh
()))
{
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getEdzzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
)
{
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setEdzzpStr64
(
zpBase64
);
xyrC
.
setEDZZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia2
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"2.jpg"
);
if
(
filejia2
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"2.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"2");
xyrC
.
setZmzpStr64
(
zpBase64
);
//xyrC.setZmzplj("static/img"+savePath+"/"+rybhstr+"2.jpg");
xyrC
.
setZMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getZmzpxxbh
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getZmzpxxbh
()))
{
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getZmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
)
{
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setZmzpStr64
(
zpBase64
);
xyrC
.
setZMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia3
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"3.jpg"
);
if
(
filejia3
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"3.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"3");
xyrC
.
setCmzpStr64
(
zpBase64
);
//xyrC.setCmzplj("static/img"+savePath+"/"+rybhstr+"3.jpg");
xyrC
.
setCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getCmzpxxbh
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getCmzpxxbh
()))
{
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getCmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
)
{
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setCmzpStr64
(
zpBase64
);
xyrC
.
setCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia4
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"4.jpg"
);
if
(
filejia4
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"4.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"4");
xyrC
.
setYcmzpStr64
(
zpBase64
);
//xyrC.setYcmzplj("static/img"+savePath+"/"+rybhstr+"4.jpg");
xyrC
.
setYCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getYcmzpxxbh
()
!=
null
&&
!
""
.
equals
(
xyrC
.
getYcmzpxxbh
()))
{
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getYcmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
)
{
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setYcmzpStr64
(
zpBase64
);
xyrC
.
setYCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
if
(
user
.
getUnitcode
()
!=
null
&&
user
.
getUnitcode
().
indexOf
(
"46"
)
==
0
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"rybh"
,
xyrC
.
getRybh
());
List
<
AutoTbRyZp
>
zjzpxxs
=
tbRyRyzpService
.
getTbRyZjzpListByRybh
(
map
);
if
(
zjzpxxs
!=
null
&&
zjzpxxs
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
zjzpxxs
.
size
();
i
++)
{
AutoTbRyZp
zjzp
=
zjzpxxs
.
get
(
i
);
if
(
"11"
.
equals
(
zjzp
.
getZpbw
()))
{
String
zpBase64
=
GetImageStrsByByte
(
zjzp
.
getDzwjnr
());
xyrC
.
setR_zjLeftBase64
(
zpBase64
.
replace
(
"\r\n"
,
""
));
}
else
if
(
"12"
.
equals
(
zjzp
.
getZpbw
()))
{
String
zpBase64
=
GetImageStrsByByte
(
zjzp
.
getDzwjnr
());
xyrC
.
setR_zjRightBase64
(
zpBase64
.
replace
(
"\r\n"
,
""
));
}
}
}
}
File
filejia21
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"21.jpg"
);
if
(
filejia21
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"21.jpg"
);
xyrC
.
setR_hmLeftBase64
(
zpBase64
);
}
File
filejia22
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"22.jpg"
);
if
(
filejia22
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"22.jpg"
);
xyrC
.
setR_hmRightBase64
(
zpBase64
);
}
File
filejia31
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"31.jpg"
);
if
(
filejia31
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"31.jpg"
);
xyrC
.
setTstz1Base64
(
zpBase64
);
}
File
filejia32
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"32.jpg"
);
if
(
filejia32
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"32.jpg"
);
xyrC
.
setTstz2Base64
(
zpBase64
);
}
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"user"
,
user
);
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"cjsb"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
model
.
addAttribute
(
"hmzt"
,
"0"
);
model
.
addAttribute
(
"zjzt"
,
"0"
);
model
.
addAttribute
(
"swzt"
,
"0"
);
model
.
addAttribute
(
"sjzt"
,
"0"
);
model
.
addAttribute
(
"yhkzt"
,
"0"
);
}
}
String
ips
=
""
;
try
{
ips
=
SysUitl
.
getIp
(
request
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
model
.
addAttribute
(
"clent"
,
ips
);
if
(
sfhlcjy
!=
null
&&!
"1"
.
equals
(
sfhlcjy
)){
returnStr
=
"rygl/addryxx_gk.html"
;
}
else
{
returnStr
=
"rygl/addryxx.html"
;
}
log
.
info
(
"人员采集单点登陆成功"
);
}
else
if
(
"XTSY"
.
equals
(
pagetype
)||
"xtsy"
.
equals
(
pagetype
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"cxqssj"
,
getSystemTime
());
returnStr
=
"rygl/ryxxlist"
;
}
else
if
(
"RYCX"
.
equals
(
pagetype
)||
"rycx"
.
equals
(
pagetype
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"cxqssj"
,
getSystemTime
());
model
.
addAttribute
(
"unitname"
,
user
.
getUnitname
());
model
.
addAttribute
(
"truename"
,
user
.
getTrueName
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
returnStr
=
"home.html"
;
}
else
if
(
"ZWBZ"
.
equals
(
pagetype
)||
"zwbz"
.
equals
(
pagetype
)){
returnStr
=
"zwbzgl/cxlist"
;
}
}
request
.
getSession
().
setAttribute
(
"User"
,
user
);
}
else
{
returnStr
=
"login/login.html"
;
log
.
info
(
"没有登录"
);
}
return
returnStr
;
}
public
static
String
getSystemTime
()
{
Calendar
ca
=
Calendar
.
getInstance
();
//得到一个Calendar的实例
ca
.
setTime
(
new
Date
());
//设置时间为当前时间
ca
.
add
(
Calendar
.
DATE
,
-
3
);
//天份减3
Date
lastday
=
ca
.
getTime
();
//结果
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
lastday
);
}
public
static
String
GetImageStrs
(
String
imgFilePath
)
{
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
byte
[]
data
=
null
;
// 读取图片字节数组
try
{
InputStream
in
=
new
FileInputStream
(
imgFilePath
);
data
=
new
byte
[
in
.
available
()];
in
.
read
(
data
);
in
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// 对字节数组Base64编码
BASE64Encoder
encoder
=
new
BASE64Encoder
();
return
encoder
.
encode
(
data
);
// 返回Base64编码过的字节数组字符串
}
public
static
String
GetImageStrsByByte
(
byte
[]
data
)
{
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
// 对字节数组Base64编码
if
(
data
==
null
||
data
.
length
<=
0
){
return
null
;
}
BASE64Encoder
encoder
=
new
BASE64Encoder
();
return
encoder
.
encode
(
data
);
// 返回Base64编码过的字节数组字符串
}
public
int
savePerson
(
String
rybh
,
String
unitCode
){
QueryService
service
=
new
QueryService
();
//根据警综传过来的人员编号调用警综接口返回一个人员基本信息Map集合
Map
map
=
null
;
String
PDBS
=
"JZTS"
;
//判断标识
String
RYBH
=
""
;
//人员编号
String
XM
=
""
;
// 姓名
String
XB
=
""
;
// 性别
String
CYM
=
""
;
// 曾用名0000
String
BMCH
=
""
;
// 别名绰号
String
GJ
=
""
;
// 国籍
String
JG
=
""
;
// 籍贯
String
CSRQ
=
""
;
// 出生日期
String
MZ
=
""
;
// 民族
String
WHCD
=
""
;
// 文化程度
String
ZYLB
=
""
;
// 职业类别代码
String
ZY
=
""
;
// 职业描述
String
LXDH
=
""
;
// 联系电话
String
HYZK
=
""
;
// 婚姻状况
String
ZJXY
=
""
;
// 宗教信仰
String
SF
=
""
;
// 身份
String
ZC
=
""
;
// 专长
String
ZJLX
=
""
;
// 证件类型
String
ZHRQ
=
""
;
// 抓获日期
String
ZHFS
=
""
;
// 抓获方式
String
ZHDQ
=
""
;
// 抓获地点区划
String
ZHDD
=
""
;
// 抓获地点详址
String
ZHDW
=
""
;
// 抓获单位
String
AJBH
=
""
;
// 案件编号
String
WFFZJL
=
""
;
// 违法犯罪经历
String
SFZH
=
""
;
//身份证号
String
HJQH
=
""
;
//户籍区划
String
HJXZ
=
""
;
//户籍详址
String
XZQH
=
""
;
//现住地区划
String
XZXZ
=
""
;
//现住地详址
String
RYLX
=
""
;
//人员类型
String
DJDW
=
""
;
//登记单位
String
DJR
=
""
;
//登记人
String
DJSJ
=
""
;
//登记时间
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
String
rybhrst
=
existRycj
(
rybh
);
if
(
rybhrst
==
null
||
rybhrst
.
length
()<
20
){
map
=
ServiceUtil
.
xmlChangeMap
(
service
.
QueryPersonByRybh
(
rybh
));
if
(
map
!=
null
){
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
PDBS
=
"JZTS"
;
//判断标识
RYBH
=
map
.
get
(
"XYRBH"
).
toString
();
//人员编号
xyrC
.
setJzrybh
(
RYBH
);
xyrC
.
setRybh
(
RYBH
);
XM
=
map
.
get
(
"XM"
).
toString
();
// 姓名
XB
=
map
.
get
(
"XB"
).
toString
();
// 性别
CYM
=
""
;
// 曾用名0000
BMCH
=
map
.
get
(
"BMCH"
).
toString
();
// 别名绰号
GJ
=
map
.
get
(
"JGGJDQ"
).
toString
();
// 国籍
JG
=
map
.
get
(
"JGSSQX"
).
toString
();
// 籍贯
CSRQ
=
map
.
get
(
"CSRQ"
).
toString
();
// 出生日期
MZ
=
map
.
get
(
"MZ"
).
toString
();
// 民族
WHCD
=
map
.
get
(
"WHCD"
).
toString
();
// 文化程度
xyrC
.
setXm
(
map
.
get
(
"XM"
).
toString
());
// 姓名
xyrC
.
setXbdm
(
map
.
get
(
"XB"
).
toString
());
// 性别
xyrC
.
setBmch
(
map
.
get
(
"BMCH"
).
toString
());
// 别名绰号
xyrC
.
setGjdm
(
map
.
get
(
"JGGJDQ"
).
toString
());
// 国籍
xyrC
.
setJgssxdm
(
map
.
get
(
"JGSSQX"
).
toString
());
// 籍贯
xyrC
.
setMzdm
(
map
.
get
(
"MZ"
).
toString
());
// 民族
xyrC
.
setXldm
(
map
.
get
(
"WHCD"
).
toString
());
// 文化程度
ZYLB
=
""
;
// 职业类别代码
ZY
=
""
;
// 职业描述
LXDH
=
map
.
get
(
"LXDH"
).
toString
();
// 联系电话
HYZK
=
""
;
// 婚姻状况
ZJXY
=
""
;
// 宗教信仰
SF
=
""
;
// 身份
ZC
=
map
.
get
(
"ZC"
).
toString
();
// 专长
ZJLX
=
map
.
get
(
"ZJZL"
).
toString
();
// 证件类型
xyrC
.
setLxdm
(
map
.
get
(
"LXDH"
).
toString
());
// 联系电话
xyrC
.
setTszcdm
(
map
.
get
(
"ZC"
).
toString
());
// 专长
xyrC
.
setCyzjdm
(
map
.
get
(
"ZJZL"
).
toString
());
// 证件类型
ZHRQ
=
""
;
// 抓获日期
ZHFS
=
""
;
// 抓获方式
ZHDQ
=
""
;
// 抓获地点区划
ZHDD
=
""
;
// 抓获地点详址
ZHDW
=
""
;
// 抓获单位
AJBH
=
""
;
// 案件编号
WFFZJL
=
""
;
// 违法犯罪经历
SFZH
=
map
.
get
(
"GMSFHM"
).
toString
();
//身份证号
HJQH
=
map
.
get
(
"HJDSSXQ"
).
toString
();
//户籍区划
HJXZ
=
map
.
get
(
"HJDXZ"
).
toString
();
//户籍详址
XZQH
=
map
.
get
(
"XZQH"
).
toString
();
//现住地区划
XZXZ
=
map
.
get
(
"ZZXZ"
).
toString
();
//现住地详址
RYLX
=
""
;
//人员类型
DJDW
=
unitCode
;
//登记单位
DJR
=
map
.
get
(
"DJR"
).
toString
();
//登记人
DJSJ
=
map
.
get
(
"DJRQ"
).
toString
();
//登记时间
xyrC
.
setZjhm
(
map
.
get
(
"GMSFHM"
).
toString
());
//身份证号
xyrC
.
setGmsfhm
(
map
.
get
(
"GMSFHM"
).
toString
());
//身份证号
xyrC
.
setHjdzXzqhdm
(
map
.
get
(
"HJDSSXQ"
).
toString
());
//户籍区划
xyrC
.
setHjdzDzmc
(
map
.
get
(
"HJDXZ"
).
toString
());
//户籍详址
xyrC
.
setXzzXzqhdm
(
map
.
get
(
"XZQH"
).
toString
());
//现住地区划
xyrC
.
setXzzDzmc
(
map
.
get
(
"ZZXZ"
).
toString
());
//现住地详址
Date
djsj_temp
=
null
;
try
{
if
(
CSRQ
==
null
||
CSRQ
.
equals
(
""
)){
xyrC
.
setCsrqQsrq
(
null
);
}
else
{
xyrC
.
setCsrqQsrq
(
df
.
parse
(
CSRQ
));
}
if
(
ZHRQ
==
null
||
ZHRQ
.
equals
(
""
)){
xyrC
.
setZhsj
(
null
);
}
else
{
xyrC
.
setZhsj
(
df
.
parse
(
ZHRQ
));
}
if
(
DJSJ
==
null
||
DJSJ
.
equals
(
""
)){
}
else
{
djsj_temp
=
df
.
parse
(
DJSJ
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
xyrC
.
setLrdwdm
(
DJDW
);
xyrC
.
setLrr
(
DJR
);
xyrC
.
setGxr
(
DJR
);
xyrC
.
setLrsj
(
djsj_temp
);
xyrC
.
setGxsj
(
djsj_temp
);
if
(
DJDW
!=
null
&&
DJDW
.
length
()>=
12
&&!
"43"
.
equals
(
DJDW
.
substring
(
0
,
2
))){
xyrC
.
setGxdwdm
(
DJDW
);
xyrC
.
setXxdjdwGajgjgdm
(
DJDW
);
xyrC
.
setXxczdwGajgjgdm
(
DJDW
);
xyrC
.
setDjsj
(
djsj_temp
);
}
}
}
int
iRet
=-
1
;
//返回值 -1表示失败,1表示成功
if
(
"JZTS"
.
equals
(
PDBS
)){
if
(
rybhrst
!=
null
&&
rybhrst
.
length
()>
20
){
iRet
=
1
;
System
.
out
.
println
(
"此人员在刑专已经存在,人员编号"
+
rybhrst
);
}
else
{
if
(!
""
.
equals
(
RYBH
)){
System
.
out
.
println
(
"此人员在刑专不存在,插入数据库人员编号"
+
RYBH
);
iRet
=
insertRycj
(
xyrC
);
}
else
{
System
.
out
.
println
(
"获取警综人员信息失败"
+
rybh
);
}
}
}
else
{
if
(!
DJDW
.
startsWith
(
"15"
)){
System
.
out
.
println
(
DJDW
+
"单位代码校验不通过,不予处理!"
);
}
else
{
if
(!
DJDW
.
startsWith
(
"15"
)){
System
.
out
.
println
(
DJDW
+
"单位代码校验不通过,不予处理!"
);
}
else
{
System
.
out
.
println
(
DJDW
+
"非警综数据,不予处理!"
);
}
}
}
return
iRet
;
}
private
String
existRycj
(
String
RYBH
)
{
AutoTbStRy
ryxx
=
rycjService
.
getRyxxByJzrybh
(
RYBH
);
try
{
if
(
ryxx
!=
null
&&
ryxx
.
getRybh
()!=
null
&&!
""
.
equals
(
ryxx
.
getRybh
())){
return
ryxx
.
getRybh
();
}
else
{
return
"0"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
"-1"
;
}
}
private
int
insertRycj
(
AutoTbStRy
ryxx
)
{
//String rybhstr = getPtRycjRybh(ryxx.getRybh(),DJSJ);
//ryxx.setRybh(rybhstr);
boolean
flg
=
rycjService
.
insertRyxx
(
ryxx
);
if
(!
flg
)
return
-
1
;
//插入不成功的时候
return
1
;
}
private
int
updateRycj
(
AutoTbStRy
ryxx
)
{
boolean
flg
=
rycjService
.
updateRyxx
(
ryxx
);
if
(!
flg
)
return
-
1
;
//更新不成功的时候
return
1
;
}
public
static
void
main
(
String
[]
args
)
{
//String ss =new SavePersonInfo4Nmtc().getPtRybh("R4300000000002013110008", "430000000000");
//System.out.println(ss+"------"+ss.length());
new
SavePersonInfo4Nmtc
().
savePerson
(
"R4300000000002019050001"
,
"150600000000"
);
}
public
int
getRylxFromStr
(
String
str
){
char
[]
cArry
=
str
.
toCharArray
();
int
x
=
0
;
for
(
int
idx
=
cArry
.
length
-
1
;
idx
>=
0
;
idx
--)
{
char
c
=
cArry
[
idx
];
x
=
x
*
2
+
(
c
==
'1'
?
1
:
0
);
}
return
x
;
}
}
src/main/java/com/founder/controller/TbXwRycjController.java
View file @
f5c702d6
...
...
@@ -1027,6 +1027,7 @@ public class TbXwRycjController {
}
System
.
out
.
println
(
"是否有二代证照:"
+
zbfzxyr
.
getEdzzpflag
()+
" 是否有正面照:"
+
zbfzxyr
.
getZmzpflag
()+
" 是否有左侧面照:"
+
zbfzxyr
.
getCmzpflag
()+
" 是否有右侧面照:"
+
zbfzxyr
.
getYcmzpflag
());
User
user
=
(
User
)
request
.
getSession
().
getAttribute
(
"User"
);
Jzryxx
jzryxx
=
new
Jzryxx
();
boolean
photoflag
=
true
;
String
edzimg
=
null
;
String
zmimg
=
null
;
...
...
@@ -1040,12 +1041,13 @@ public class TbXwRycjController {
if
(!
R_EDZZP_File
.
isEmpty
())
{
try
{
byte
[]
bytes
=
R_EDZZP_File
.
getBytes
();
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"1"
,
zbfzxyr
.
getEdzzpxxbh
(),
request
);
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"1"
,
zbfzxyr
.
getEdzzpxxbh
(),
request
);
jzryxx
.
setEdzbase64
(
GetImageStrsByByte
(
bytes
)
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
zbfzxyr
.
setEdzzpxxbh
(
num
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
@@ -1066,8 +1068,8 @@ public class TbXwRycjController {
}
}
if
(
edzimg
!=
null
)
{
String
num
=
insPic
(
edzimg
,
zbfzxyr
.
getRybh
(),
user
,
"1"
,
zbfzxyr
.
getEdzzpxxbh
(),
request
);
String
num
=
insPic
(
edzimg
,
zbfzxyr
.
getRybh
(),
user
,
"1"
,
zbfzxyr
.
getEdzzpxxbh
(),
request
);
jzryxx
.
setEdzbase64
(
edzimg
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1079,8 +1081,8 @@ public class TbXwRycjController {
if
(!
R_ZMZP_File
.
isEmpty
())
{
try
{
byte
[]
bytes
=
R_ZMZP_File
.
getBytes
();
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"2"
,
zbfzxyr
.
getZmzpxxbh
(),
request
);
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"2"
,
zbfzxyr
.
getZmzpxxbh
(),
request
);
jzryxx
.
setZmzpbASE64
(
GetImageStrsByByte
(
bytes
)
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1105,8 +1107,8 @@ public class TbXwRycjController {
}
}
if
(
zmimg
!=
null
)
{
String
num
=
insPic
(
zmimg
,
zbfzxyr
.
getRybh
(),
user
,
"2"
,
zbfzxyr
.
getZmzpxxbh
(),
request
);
String
num
=
insPic
(
zmimg
,
zbfzxyr
.
getRybh
(),
user
,
"2"
,
zbfzxyr
.
getZmzpxxbh
(),
request
);
jzryxx
.
setZmzpbASE64
(
zmimg
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1120,6 +1122,7 @@ public class TbXwRycjController {
byte
[]
bytes
=
R_CMZP_File
.
getBytes
();
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"3"
,
zbfzxyr
.
getCmzpxxbh
(),
request
);
jzryxx
.
setZcmzpbase64
(
GetImageStrsByByte
(
bytes
));
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1146,6 +1149,7 @@ public class TbXwRycjController {
if
(
cmimg
!=
null
)
{
String
num
=
insPic
(
cmimg
,
zbfzxyr
.
getRybh
(),
user
,
"3"
,
zbfzxyr
.
getCmzpxxbh
(),
request
);
jzryxx
.
setZcmzpbase64
(
cmimg
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1159,6 +1163,7 @@ public class TbXwRycjController {
byte
[]
bytes
=
R_YCMZP_File
.
getBytes
();
String
num
=
insPic
(
GetImageStrsByByte
(
bytes
),
zbfzxyr
.
getRybh
(),
user
,
"4"
,
zbfzxyr
.
getYcmzpxxbh
(),
request
);
jzryxx
.
setYcmzmbase64
(
GetImageStrsByByte
(
bytes
));
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1185,6 +1190,7 @@ public class TbXwRycjController {
if
(
ycmimg
!=
null
)
{
String
num
=
insPic
(
ycmimg
,
zbfzxyr
.
getRybh
(),
user
,
"4"
,
zbfzxyr
.
getYcmzpxxbh
(),
request
);
jzryxx
.
setYcmzmbase64
(
ycmimg
);
if
(
num
==
"-1"
)
{
photoflag
=
false
;
}
else
{
...
...
@@ -1195,6 +1201,7 @@ public class TbXwRycjController {
//保存足迹
if
(!
"43"
.
equals
(
user
.
getUnitcode
().
substring
(
0
,
2
)))
{
if
(
"0"
.
equals
(
zbfzxyr
.
getZjleftflag
()))
{
jzryxx
.
setZjbh
(
zbfzxyr
.
getRybh
()+
"11"
);
if
(
zbfzxyr
.
getR_zjLeftBase64
()
!=
null
&&
zbfzxyr
.
getR_zjLeftBase64
().
length
()
>
0
)
{
if
(
zbfzxyr
.
getR_zjLeftBase64
().
indexOf
(
"/9j/"
)
>=
0
)
{
zjleftimg
=
zbfzxyr
.
getR_zjLeftBase64
().
substring
(
zbfzxyr
.
getR_zjLeftBase64
().
indexOf
(
"/9j/"
));
...
...
@@ -1213,6 +1220,7 @@ public class TbXwRycjController {
}
}
if
(
"0"
.
equals
(
zbfzxyr
.
getZjrightflag
()))
{
jzryxx
.
setZjbh
(
zbfzxyr
.
getRybh
()+
"12"
);
if
(
zbfzxyr
.
getR_zjRightBase64
()
!=
null
&&
zbfzxyr
.
getR_zjRightBase64
().
length
()
>
0
)
{
if
(
zbfzxyr
.
getR_zjRightBase64
().
indexOf
(
"/9j/"
)
>=
0
)
{
zjrightimg
=
zbfzxyr
.
getR_zjRightBase64
().
substring
(
zbfzxyr
.
getR_zjRightBase64
().
indexOf
(
"/9j/"
));
...
...
@@ -1397,6 +1405,16 @@ public class TbXwRycjController {
//调用AMSISService服务器程序
doRyxxToAMSIS
(
xyrC
);
}
if
(
user
.
getUnitcode
().
startsWith
(
"15"
)){
jzryxx
.
setXyrbh
(
xyrC
.
getJzrybh
());
jzryxx
.
setZwbh
(
xyrC
.
getSzzwbh
());
jzryxx
.
setDnabh
(
xyrC
.
getDnabh
());
jzryxx
.
setSg
(
xyrC
.
getSgsx
());
jzryxx
.
setTz
(
xyrC
.
getTzsx
());
jzryxx
.
setZc
(
xyrC
.
getZc
());
jzryxx
.
setFlag
(
"0"
);
sendRyxxToJz
(
jzryxx
);
}
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"user"
,
user
);
...
...
@@ -1694,6 +1712,12 @@ public class TbXwRycjController {
return
encoder
.
encode
(
data
);
// 返回Base64编码过的字节数组字符串
}
public
String
sendRyxxToJz
(
Jzryxx
jzryxx
)
{
QueryService
service
=
new
QueryService
();
service
.
ReportSrevice
(
jzryxx
);
return
""
;
}
public
static
byte
[]
GenerateImage
(
String
imgStr
,
String
imgFilePath
)
{
// 对字节数组字符串进行Base64解码并生成图片
if
(
imgStr
==
null
)
// 图像数据为空
return
null
;
...
...
@@ -3361,396 +3385,7 @@ public class TbXwRycjController {
return
xml
.
toString
();
}
@RequestMapping
(
"/SavePersonInfo4Nmtc"
)
@ResponseBody
public
String
SavePersonInfo4Nmtc
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
request
.
setCharacterEncoding
(
"GBK"
);
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
PDBS
=
StringUtil
.
checknull
(
request
.
getParameter
(
"PDBS"
));
//判断标识
String
RYBH
=
StringUtil
.
checknull
(
request
.
getParameter
(
"RYBH"
));
//人员编号
if
(
RYBH
==
null
||
""
.
equals
(
RYBH
)){
log
.
info
(
"无人员编号!"
);
return
"-1"
;
}
xyrC
.
setJzrybh
(
RYBH
);
xyrC
.
setRybh
(
RYBH
);
xyrC
.
setXm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XM"
)));
// 姓名
xyrC
.
setXbdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XB"
)));
// 性别
xyrC
.
setCym
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CYM"
)));
// 曾用名
xyrC
.
setBmch
(
StringUtil
.
checknull
(
request
.
getParameter
(
"BMCH"
)));
// 别名绰号
xyrC
.
setXmhypy
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XMHYPY"
)));
// 姓名汉语拼音
xyrC
.
setGjdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"GJ"
)));
// 国籍
xyrC
.
setJgssxdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"JG"
)));
// 籍贯
String
CSRQ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"CSRQ"
));
// 出生日期
xyrC
.
setMzdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"MZ"
)));
// 民族
xyrC
.
setSgsx
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SG"
)));
// 身高
xyrC
.
setTzsx
(
StringUtil
.
checknull
(
request
.
getParameter
(
"TZ"
)));
// 体重
xyrC
.
setZc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZC"
)));
// 足长
xyrC
.
setXldm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WHCD"
)));
// 文化程度
xyrC
.
setZylbdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZYLB"
)));
// 职业类别代码
xyrC
.
setZylbdmbcms
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZY"
)));
// 职业描述
xyrC
.
setLxdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"LXDH"
)));
// 联系电话
xyrC
.
setJyzkdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HYZK"
)));
// 婚姻状况
xyrC
.
setZjxydm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZJXY"
)));
// 宗教信仰
xyrC
.
setZzmmdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZZMM"
)));
// 政治面貌
xyrC
.
setByzkdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"BYZK"
)));
// 服役状况
xyrC
.
setSarysfdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SF"
)));
// 身份
xyrC
.
setTszcdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"TSZC"
)));
// 专长
xyrC
.
setCyzjdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZJLX"
)));
// 证件类型
String
ZHRQ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHRQ"
));
// 抓获日期
xyrC
.
setZhfsdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHFS"
)));
// 抓获方式
xyrC
.
setZhddqh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDQ"
)));
// 抓获地点区划
xyrC
.
setZhddxz
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDD"
)));
// 抓获地点详址
xyrC
.
setZhdwdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZHDW"
)));
// 抓获单位
xyrC
.
setAsjbh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"AJBH"
)));
// 案件编号
xyrC
.
setWffzjlms
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WFFZJL"
)));
// 违法犯罪经历
xyrC
.
setJyaq
(
StringUtil
.
checknull
(
request
.
getParameter
(
"WFFZJL"
)));
// 违法犯罪经历
xyrC
.
setZjhm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"SFZH"
)));
//身份证号
xyrC
.
setHjdzXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HJQH"
)));
//户籍区划
xyrC
.
setHjdzDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"HJXZ"
)));
//户籍详址
xyrC
.
setXzzXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XZQH"
)));
//现住地区划
xyrC
.
setXzzDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"XZXZ"
)));
//现住地详址
xyrC
.
setCsdXzqhdm
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CSDQH"
)));
//出生地区划
xyrC
.
setCsdDzmc
(
StringUtil
.
checknull
(
request
.
getParameter
(
"CSDXZ"
)));
//出生地详址
xyrC
.
setFwcs
(
StringUtil
.
checknull
(
request
.
getParameter
(
"GZDW"
)));
//工作单位
xyrC
.
setSzzwbh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"ZWBH"
)));
//指纹编号
xyrC
.
setDnabh
(
StringUtil
.
checknull
(
request
.
getParameter
(
"DNABH"
)));
//DNA编号
xyrC
.
setBzw
(
StringUtil
.
checknull
(
request
.
getParameter
(
"RYLX"
)));
//人员类型
//xyrC.setZwcjr(StringUtil.checknull(request.getParameter("CJR")));//采集人
//xyrC.setZwcjrXm(StringUtil.checknull(request.getParameter("CJR")));//采集人
//xyrC.setZwcjdwdm(StringUtil.checknull(request.getParameter("CJDW")));//采集单位
//String zwcjsj=StringUtil.checknull(request.getParameter("CJSJ"));//采集时间
String
DJDW
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJDW"
));
//登记单位
String
DJR
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJR"
));
//登记人
String
DJSJ
=
StringUtil
.
checknull
(
request
.
getParameter
(
"DJSJ"
));
//登记时间
Date
djsj_temp
=
null
;
try
{
if
(
CSRQ
==
null
||
CSRQ
.
equals
(
""
)){
xyrC
.
setCsrqQsrq
(
null
);
}
else
{
xyrC
.
setCsrqQsrq
(
df
.
parse
(
CSRQ
));
}
if
(
ZHRQ
==
null
||
ZHRQ
.
equals
(
""
)){
xyrC
.
setZhsj
(
null
);
}
else
{
xyrC
.
setZhsj
(
df
.
parse
(
ZHRQ
));
}
//if(zwcjsj==null||zwcjsj.equals("")){
//}else{
// xyrC.setZwcjsj(df.parse(zwcjsj));
//}
if
(
DJSJ
==
null
||
DJSJ
.
equals
(
""
)){
}
else
{
djsj_temp
=
df
.
parse
(
DJSJ
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
xyrC
.
setLrdwdm
(
DJDW
);
xyrC
.
setLrr
(
DJR
);
xyrC
.
setGxr
(
DJR
);
xyrC
.
setLrsj
(
djsj_temp
);
xyrC
.
setGxsj
(
djsj_temp
);
if
(
DJDW
!=
null
&&
DJDW
.
length
()>=
12
&&!
"43"
.
equals
(
DJDW
.
substring
(
0
,
2
))){
xyrC
.
setGxdwdm
(
DJDW
);
xyrC
.
setXxdjdwGajgjgdm
(
DJDW
);
xyrC
.
setXxczdwGajgjgdm
(
DJDW
);
xyrC
.
setDjsj
(
djsj_temp
);
}
int
iRet
=-
1
;
//返回值 -1表示失败,1表示成功
boolean
bool
=
false
;
if
(
"JZTS"
.
equals
(
PDBS
)){
AutoTbStRy
jzxyr
=
rycjService
.
getRyxxByJzrybh
(
RYBH
);
if
(
jzxyr
!=
null
&&
jzxyr
.
getRybh
()!=
null
&&!
""
.
equals
(
jzxyr
.
getRybh
())){
xyrC
.
setRybh
(
jzxyr
.
getRybh
());
bool
=
rycjService
.
updateRyxx
(
xyrC
);
//updateRycj(RYBH,XM,XB,BMCH,GJ,CSRQ,MZ,SFZH,HJQH,HJXZ,XZQH,XZXZ,RYLX,DJDW,DJR,DJSJ,CYM,JG,WHCD,ZYLB,ZY,LXDH,HYZK,ZJXY,SF,ZC,ZJLX,ZHRQ,ZHFS,ZHDQ,ZHDD,ZHDW,AJBH,WFFZJL);
}
else
{
User
user
=
loginService
.
getUserByUsername
(
DJR
);
if
(
user
==
null
){
user
=
loginService
.
getUserByUsername
(
"admin"
);
}
user
.
setUnitcode
(
DJDW
);
//String rybhString = sequenceService.getNextSerialNo("TB_ST_RY",user.getUnitcode(), user);
//xyrC.setRybh(rybhString);
bool
=
rycjService
.
insertRyxx
(
xyrC
);
//bool=insertRycj(RYBH,XM,XB,BMCH,GJ,CSRQ,MZ,SFZH,HJQH,HJXZ,XZQH,XZXZ,RYLX,DJDW,DJR,DJSJ,CYM,JG,WHCD,ZYLB,ZY,LXDH,HYZK,ZJXY,SF,ZC,ZJLX,ZHRQ,ZHFS,ZHDQ,ZHDD,ZHDW,AJBH,WFFZJL);
}
}
if
(
bool
){
iRet
=
1
;
}
return
iRet
+
""
;
}
@RequestMapping
(
value
=
"/singleLoginAct"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
String
singleLoginAct
(
HttpServletRequest
request
,
Model
model
,
String
paramval
,
String
asjxgrybh
,
String
rybh
,
String
username
,
String
sfhlcjy
,
String
cjxm
){
String
userId
=
request
.
getParameter
(
"userId"
);
String
pv
=
request
.
getParameter
(
"paramval"
);
if
(
paramval
==
null
||
""
.
equals
(
paramval
)){
paramval
=
pv
;
}
if
(
asjxgrybh
==
null
||
""
.
equals
(
asjxgrybh
)){
asjxgrybh
=
rybh
;
}
if
(
asjxgrybh
==
null
||
""
.
equals
(
asjxgrybh
)){
asjxgrybh
=
paramval
;
}
String
returnStr
=
""
;
String
perurl
=
""
;
String
pagetype
=
""
;
User
user
=
null
;
user
=(
User
)
request
.
getSession
().
getAttribute
(
"User"
);
if
(
asjxgrybh
!=
null
&&!
""
.
equals
(
asjxgrybh
))
{
String
[]
rst
=
asjxgrybh
.
split
(
","
);
//System.out.println(rst);
if
(
rst
.
length
>=
4
)
{
rybh
=
rst
[
0
];
userId
=
rst
[
1
];
pagetype
=
rst
[
2
];
perurl
=
rst
[
3
];
String
cjcs
=
rst
[
4
];
if
(!
"JZTS"
.
equals
(
cjcs
)){
log
.
info
(
"参数错误!"
);
return
"login/login.html"
;
}
}
else
{
log
.
info
(
"参数错误!"
);
return
"login/login.html"
;
}
}
//if(user==null){
if
(
asjxgrybh
!=
null
&&!
""
.
equals
(
asjxgrybh
)){
user
=
loginService
.
getUserByUsername
(
userId
);
}
else
{
user
=
loginService
.
getUserById
(
userId
);
}
//}
if
(
user
!=
null
){
if
(
userId
==
null
||
""
.
equals
(
userId
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitname"
,
user
.
getUnitname
());
model
.
addAttribute
(
"truename"
,
user
.
getTrueName
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
returnStr
=
"home.html"
;
log
.
info
(
"登陆成功"
);
}
else
{
if
(
"RYCJ"
.
equals
(
pagetype
)||
"rycj"
.
equals
(
pagetype
)){
if
(
rybh
==
null
||
""
.
equals
(
rybh
)){
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
}
else
{
AutoTbStRy
xyrC
=
rycjService
.
getRyxxByRybh
(
rybh
);
if
(
xyrC
==
null
||
xyrC
.
getRybh
()==
null
||
""
.
equals
(
xyrC
.
getRybh
())){
xyrC
=
new
AutoTbStRy
();
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
model
.
addAttribute
(
"cjsb"
,
cjxm
);
String
ips
=
""
;
try
{
ips
=
SysUitl
.
getIp
(
request
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
model
.
addAttribute
(
"clent"
,
ips
);
if
(
sfhlcjy
!=
null
&&!
"1"
.
equals
(
sfhlcjy
)){
return
"rygl/addryxx_gk.html"
;
}
else
{
return
"rygl/addryxx.html"
;
}
}
if
(
xyrC
.
getLrr
()!=
null
&&!
""
.
equals
(
xyrC
.
getLrr
())){
try
{
xyrC
.
setLrrXm
(
dicItemService
.
queryNameByCode
(
xyrC
.
getLrr
(),
"CODE_JY"
));
}
catch
(
Exception
e
){
System
.
out
.
println
(
"代码内容获取异常!"
+
e
);
}
if
(
xyrC
.
getLrrXm
()==
null
||
""
.
equals
(
xyrC
.
getLrrXm
())){
xyrC
.
setLrrXm
(
xyrC
.
getLrr
());
}
}
else
{
xyrC
.
setLrrXm
(
user
.
getTrueName
());
}
if
(
xyrC
.
getZwcjr
()!=
null
&&!
""
.
equals
(
xyrC
.
getZwcjr
())){
try
{
xyrC
.
setZwcjrXm
(
dicItemService
.
queryNameByCode
(
xyrC
.
getZwcjr
(),
"CODE_JY"
));
}
catch
(
Exception
e
){
System
.
out
.
println
(
"代码内容获取异常!"
+
e
);
}
}
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
if
(
xyrC
.
getLrsj
()!=
null
&&!
""
.
equals
(
xyrC
.
getLrsj
())){
xyrC
.
setLrsjStr
(
df
.
format
(
xyrC
.
getLrsj
()));
}
if
(
xyrC
.
getCsrqQsrq
()!=
null
&&!
""
.
equals
(
xyrC
.
getCsrqQsrq
()))
{
xyrC
.
setCsrqQsrqStr
(
df
.
format
(
xyrC
.
getCsrqQsrq
()));
}
if
(
xyrC
.
getZhsj
()!=
null
&&!
""
.
equals
(
xyrC
.
getZhsj
())){
xyrC
.
setZhsjStr
(
df
.
format
(
xyrC
.
getZhsj
()));
}
if
(
xyrC
.
getZwcjsj
()!=
null
&&!
""
.
equals
(
xyrC
.
getZwcjsj
())){
xyrC
.
setZwcjsjStr
(
df
.
format
(
xyrC
.
getZwcjsj
()));
}
String
rybhstr
=
xyrC
.
getRybh
();
String
savePath
=
"/personphoto/"
+
rybhstr
.
substring
(
rybhstr
.
length
()
-
10
,
rybhstr
.
length
()
-
4
)+
"/"
+
rybhstr
.
substring
(
rybhstr
.
length
()
-
3
,
rybhstr
.
length
());
//String hcfilePath = request.getServletContext().getRealPath("/").replaceAll("\\\\","/");
AutoTbRyZp
ryzp_pd
=
null
;
// 判断照片编号是否有对应照片
Param
param
=
paramService
.
getParamById
(
"0100"
);
String
zplj
=
param
.
getParamvalue
();
String
filePath
=
zplj
;
filePath
=
filePath
+
savePath
;
File
filejia1
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"1.jpg"
);
if
(
filejia1
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"1.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"1");
xyrC
.
setEdzzpStr64
(
zpBase64
);
//xyrC.setEdzzplj("static/img"+savePath+"/"+rybhstr+"1.jpg");
xyrC
.
setEDZZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getEdzzpxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getEdzzpxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getEdzzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setEdzzpStr64
(
zpBase64
);
xyrC
.
setEDZZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia2
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"2.jpg"
);
if
(
filejia2
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"2.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"2");
xyrC
.
setZmzpStr64
(
zpBase64
);
//xyrC.setZmzplj("static/img"+savePath+"/"+rybhstr+"2.jpg");
xyrC
.
setZMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getZmzpxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getZmzpxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getZmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setZmzpStr64
(
zpBase64
);
xyrC
.
setZMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia3
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"3.jpg"
);
if
(
filejia3
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"3.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"3");
xyrC
.
setCmzpStr64
(
zpBase64
);
//xyrC.setCmzplj("static/img"+savePath+"/"+rybhstr+"3.jpg");
xyrC
.
setCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getCmzpxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getCmzpxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getCmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setCmzpStr64
(
zpBase64
);
xyrC
.
setCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia4
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"4.jpg"
);
if
(
filejia4
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"4.jpg"
);
//insPic2(hcfilePath,zpBase64,rybhstr,"4");
xyrC
.
setYcmzpStr64
(
zpBase64
);
//xyrC.setYcmzplj("static/img"+savePath+"/"+rybhstr+"4.jpg");
xyrC
.
setYCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
else
if
(
xyrC
.
getYcmzpxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getYcmzpxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getYcmzpxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setYcmzpStr64
(
zpBase64
);
xyrC
.
setYCMZPL64
(
String
.
valueOf
(
zpBase64
.
getBytes
().
length
));
}
}
File
filejia11
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"11.jpg"
);
if
(
filejia11
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"11.jpg"
);
xyrC
.
setR_zjLeftBase64
(
zpBase64
);
}
else
if
(
xyrC
.
getZjleftxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getZjleftxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getZjleftxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setR_zjLeftBase64
(
zpBase64
);
}
}
File
filejia12
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"12.jpg"
);
if
(
filejia12
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"12.jpg"
);
xyrC
.
setR_zjRightBase64
(
zpBase64
);
}
else
if
(
xyrC
.
getZjrightxxbh
()!=
null
&&!
""
.
equals
(
xyrC
.
getZjrightxxbh
())){
ryzp_pd
=
tbRyRyzpService
.
getTbRyRyzpById
(
xyrC
.
getZjrightxxbh
(),
user
.
getUnitcode
());
if
(
ryzp_pd
!=
null
){
String
zpBase64
=
new
BASE64Encoder
().
encode
(
ryzp_pd
.
getDzwjnr
()).
replace
(
"\r\n"
,
""
);
// 转为字符串
xyrC
.
setR_zjRightBase64
(
zpBase64
);
}
}
File
filejia21
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"21.jpg"
);
if
(
filejia21
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"21.jpg"
);
xyrC
.
setR_hmLeftBase64
(
zpBase64
);
}
File
filejia22
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"22.jpg"
);
if
(
filejia22
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"22.jpg"
);
xyrC
.
setR_hmRightBase64
(
zpBase64
);
}
File
filejia31
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"31.jpg"
);
if
(
filejia31
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"31.jpg"
);
xyrC
.
setTstz1Base64
(
zpBase64
);
}
File
filejia32
=
new
File
(
filePath
+
"/"
+
rybhstr
+
"32.jpg"
);
if
(
filejia32
.
exists
())
{
String
zpBase64
=
GetImageStrs
(
filePath
+
"/"
+
rybhstr
+
"32.jpg"
);
xyrC
.
setTstz2Base64
(
zpBase64
);
}
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"cjsb"
,
cjxm
);
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
String
ips
=
""
;
try
{
ips
=
SysUitl
.
getIp
(
request
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
model
.
addAttribute
(
"clent"
,
ips
);
}
if
(
sfhlcjy
!=
null
&&!
"1"
.
equals
(
sfhlcjy
)){
returnStr
=
"rygl/addryxx_gk.html"
;
}
else
{
returnStr
=
"rygl/addryxx.html"
;
}
log
.
info
(
"人员采集单点登陆成功"
);
}
else
if
(
"XTSY"
.
equals
(
pagetype
)||
"xtsy"
.
equals
(
pagetype
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"cxqssj"
,
getSystemTime
());
returnStr
=
"rygl/ryxxlist"
;
}
else
if
(
"RYCX"
.
equals
(
pagetype
)||
"rycx"
.
equals
(
pagetype
)){
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"cxqssj"
,
getSystemTime
());
model
.
addAttribute
(
"unitname"
,
user
.
getUnitname
());
model
.
addAttribute
(
"truename"
,
user
.
getTrueName
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
returnStr
=
"home.html"
;
}
else
if
(
"ZWBZ"
.
equals
(
pagetype
)||
"zwbz"
.
equals
(
pagetype
)){
returnStr
=
"zwbzgl/cxlist"
;
}
}
request
.
getSession
().
setAttribute
(
"User"
,
user
);
}
else
{
returnStr
=
"login/login.html"
;
log
.
info
(
"没有登录"
);
}
return
returnStr
;
}
// 向AMSIS系统推送人员信息 add by jiaorong 20150106
public
String
doRyxxToAMSIS
(
AutoTbStRy
newryxx
)
{
...
...
src/main/java/com/founder/login/controller/LoginController.java
View file @
f5c702d6
...
...
@@ -98,8 +98,18 @@ public class LoginController {
}
else
{
if
(
rybh
==
null
||
""
.
equals
(
rybh
)){
AutoTbStRy
xyrC
=
new
AutoTbStRy
();
model
.
addAttribute
(
"username"
,
user
.
getUsername
());
model
.
addAttribute
(
"unitcode"
,
user
.
getUnitcode
());
model
.
addAttribute
(
"user"
,
user
);
model
.
addAttribute
(
"ryxx"
,
xyrC
);
model
.
addAttribute
(
"saveflag"
,
"0"
);
model
.
addAttribute
(
"perurl"
,
perurl
);
model
.
addAttribute
(
"hmzt"
,
"0"
);
model
.
addAttribute
(
"zjzt"
,
"0"
);
model
.
addAttribute
(
"swzt"
,
"0"
);
model
.
addAttribute
(
"sjzt"
,
"0"
);
model
.
addAttribute
(
"yhkzt"
,
"0"
);
model
.
addAttribute
(
"sswpzt"
,
"0"
);
}
else
{
AutoTbStRy
xyrC
=
rycjService
.
getRyxxByRybh
(
rybh
);
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
...
src/main/java/com/founder/model/Jzryxx.java
0 → 100644
View file @
f5c702d6
package
com
.
founder
.
model
;
/**
* <P>Copyright: Founder Copyright (c) 2021</P>
* <P>Description:定义警综人员实体</P>
* <P>Company: Founder</P>
* <P>Author yangliang</P>
* <P>E-mail:yangliang.hl@founder.com.com</P>
* <P>Careate: 2021-01-20 下午16:01:32</P>
* <P>Version 1.0</P>
* TODO :
*/
public
class
Jzryxx
{
// 嫌疑人编号
private
String
xyrbh
;
// 二代证base64
private
String
edzbase64
;
// 正面照片base64
private
String
zmzpbASE64
;
// 左侧面照片base64
private
String
zcmzpbase64
;
// 右侧面照片base64
private
String
ycmzmbase64
;
// 指纹编号
private
String
zwbh
;
// DNA编号
private
String
dnabh
;
// 足迹编号
private
String
zjbh
;
// 声纹编号
private
String
swbh
;
// SIS手机号码
private
String
sissjhm
;
// 身高
private
String
sg
;
// 足长
private
String
zc
;
// 体重
private
String
tz
;
//单位代码
private
String
unitcode
;
//设置标志
private
String
flag
;
public
String
getXyrbh
()
{
return
xyrbh
;
}
public
void
setXyrbh
(
String
xyrbh
)
{
this
.
xyrbh
=
xyrbh
;
}
public
String
getEdzbase64
()
{
return
edzbase64
;
}
public
void
setEdzbase64
(
String
edzbase64
)
{
this
.
edzbase64
=
edzbase64
;
}
public
String
getZmzpbASE64
()
{
return
zmzpbASE64
;
}
public
void
setZmzpbASE64
(
String
zmzpbASE64
)
{
this
.
zmzpbASE64
=
zmzpbASE64
;
}
public
String
getZcmzpbase64
()
{
return
zcmzpbase64
;
}
public
void
setZcmzpbase64
(
String
zcmzpbase64
)
{
this
.
zcmzpbase64
=
zcmzpbase64
;
}
public
String
getYcmzmbase64
()
{
return
ycmzmbase64
;
}
public
void
setYcmzmbase64
(
String
ycmzmbase64
)
{
this
.
ycmzmbase64
=
ycmzmbase64
;
}
public
String
getZwbh
()
{
return
zwbh
;
}
public
void
setZwbh
(
String
zwbh
)
{
this
.
zwbh
=
zwbh
;
}
public
String
getDnabh
()
{
return
dnabh
;
}
public
void
setDnabh
(
String
dnabh
)
{
this
.
dnabh
=
dnabh
;
}
public
String
getZjbh
()
{
return
zjbh
;
}
public
void
setZjbh
(
String
zjbh
)
{
this
.
zjbh
=
zjbh
;
}
public
String
getSwbh
()
{
return
swbh
;
}
public
void
setSwbh
(
String
swbh
)
{
this
.
swbh
=
swbh
;
}
public
String
getSissjhm
()
{
return
sissjhm
;
}
public
void
setSissjhm
(
String
sissjhm
)
{
this
.
sissjhm
=
sissjhm
;
}
public
String
getSg
()
{
return
sg
;
}
public
void
setSg
(
String
sg
)
{
this
.
sg
=
sg
;
}
public
String
getZc
()
{
return
zc
;
}
public
void
setZc
(
String
zc
)
{
this
.
zc
=
zc
;
}
public
String
getTz
()
{
return
tz
;
}
public
void
setTz
(
String
tz
)
{
this
.
tz
=
tz
;
}
public
String
getUnitcode
()
{
return
unitcode
;
}
public
void
setUnitcode
(
String
unitcode
)
{
this
.
unitcode
=
unitcode
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
}
src/main/java/com/founder/util/CommonFunc.java
0 → 100644
View file @
f5c702d6
package
com
.
founder
.
util
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.UnsupportedEncodingException
;
import
java.sql.Blob
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Random
;
import
java.util.StringTokenizer
;
import
java.util.TimeZone
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.naming.Context
;
import
javax.naming.InitialContext
;
/**
* @<p>Title: CommonFunc.java
* @<p>Description:公用函数集合
* @<p>Copyright: 北京汉林信通信息技术有限公司'S Copyright (c) 2009</p>
* @<p>author: zrd
* @<p> 创建时间:2010-4-30 下午05:48:25
* @<p>version 1.1
*/
@SuppressWarnings
({
"deprecation"
,
"unused"
})
final
public
class
CommonFunc
{
/**
* 将字符时间转化成日期,格式为yyyy-MM-dd
* @param num
* @return
*/
public
static
Date
StoDate
(
String
num
){
Date
date
=
null
;
try
{
if
(
num
!=
null
&&
!
""
.
equals
(
num
)){
DateFormat
fmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
date
=
fmt
.
parse
(
num
);
}
}
catch
(
Exception
e
){
System
.
out
.
println
(
"StoDate(A)方法执行异常:"
+
e
.
getMessage
());
}
return
date
;
}
public
static
Random
ran
=
new
Random
();
//随机数为了保持其在循环中的离散性,只能定个全局的 ByLilei
/**
* ORACLE日期类型与Java日期类型的转换
* @param sDate
* @param len
* @return
*/
public
static
java
.
sql
.
Timestamp
strToDate
(
String
sDate
,
int
len
){
if
(
sDate
==
null
||
sDate
.
equals
(
""
))
return
null
;
//2002-12-12 12:24
int
year
=
Integer
.
parseInt
(
sDate
.
substring
(
0
,
4
))-
1900
;
int
month
=
Integer
.
parseInt
(
sDate
.
substring
(
5
,
7
))-
1
;
int
day
=
Integer
.
parseInt
(
sDate
.
substring
(
8
,
10
));
if
(
len
==
8
){
java
.
sql
.
Timestamp
dd
=
new
java
.
sql
.
Timestamp
(
new
java
.
util
.
Date
(
year
,
month
,
day
).
getTime
());
return
dd
;
}
else
{
int
hour
=
Integer
.
parseInt
(
sDate
.
substring
(
11
,
13
));
int
minute
=
Integer
.
parseInt
(
sDate
.
substring
(
14
,
16
));
java
.
sql
.
Timestamp
dd
=
new
java
.
sql
.
Timestamp
(
new
java
.
util
.
Date
(
year
,
month
,
day
,
hour
,
minute
).
getTime
());
return
dd
;
}
}
/**
* 常量功能:日期转换对象
*/
protected
DateFormat
df
=
DateFormat
.
getDateInstance
();
public
synchronized
static
String
createPrimaryKey
()
{
String
ID
=
""
;
String
idTemp
=
new
SimpleDateFormat
(
"yyyyMMddHHmmssS"
).
format
(
new
Date
());
do
{
ID
=
new
SimpleDateFormat
(
"yyyyMMddHHmmssS"
).
format
(
new
Date
());
}
while
(
idTemp
.
equals
(
ID
));
return
ID
;
}
/**
* 常量功能:保留系统路径
*/
public
static
String
syspath
;
static
final
public
void
setSyspath
(
String
pathstr
){
syspath
=
pathstr
;
}
/**
* 常量功能:debug状态下是否要输出1要0不要
*/
private
static
int
ifdebugprint
;
static
final
public
void
setIfDebugprint
(
int
flg
){
ifdebugprint
=
flg
;
}
/**
* 函数功能:判断字符串是否全是数字
* @param str:待判断的字符串
* @return:true全是,false不全是
*/
static
final
public
boolean
isNumeric
(
String
str
){
Pattern
pattern
=
Pattern
.
compile
(
"[0-9]*"
);
Matcher
isNum
=
pattern
.
matcher
(
str
);
if
(!
isNum
.
matches
()){
return
false
;
}
return
true
;
}
/**
* 函数功能:将时间串表示为**小时××分钟格式
* @param timepass:总的秒数
* @return:格式字符串
*/
static
final
public
String
getHour
(
double
timepass
){
long
totlemi
=
Math
.
round
(
timepass
*
24
*
60
);
long
totlehour
=
totlemi
/
60
;
totlemi
=
totlemi
%
60
;
String
rs
=
String
.
valueOf
(
totlehour
)+
"小时"
+
String
.
valueOf
(
totlemi
)+
"分钟"
;
return
rs
;
}
/**
* 函数功能:得到当前的年月字符串
* @return:返回YYYYMM
*/
static
final
public
String
getCurYearMonth
(){
String
rs
=
""
;
java
.
util
.
Date
today
=
new
java
.
util
.
Date
();
rs
=
String
.
valueOf
(
today
.
getYear
()+
1900
);
if
(
today
.
getMonth
()+
1
<
10
){
rs
+=
"0"
+
String
.
valueOf
(
today
.
getMonth
()+
1
);
}
else
{
rs
+=
String
.
valueOf
(
today
.
getMonth
()+
1
);
}
return
rs
;
}
/**
* 函数功能:打印输入字符串
* @param infotype:打印类型,分Error和Debug
* infostr:待打印输出的字符串
* @return:String
*/
static
final
public
void
PrintInfo
(
String
infotype
,
String
infostr
){
if
(
infotype
.
toUpperCase
().
equals
(
"ERROR"
)){
System
.
out
.
println
(
getNowTimeStr
()+
"-"
+
infostr
);
}
if
(
infotype
.
toUpperCase
().
equals
(
"DEBUG"
)){
if
(
ifdebugprint
>
0
){
System
.
out
.
println
(
getNowTimeStr
()+
"-"
+
infostr
);
}
}
}
/**
* 函数功能:字符串asc转gb2312
* @param asc:待转的字符串
* @return:String
*/
static
final
public
String
asc2gb
(
String
asc
){
String
ret
;
if
(
asc
==
null
)
return
asc
;
try
{
ret
=
new
String
(
asc
.
getBytes
(
"ISO8859_1"
),
"GB2312"
);
}
catch
(
UnsupportedEncodingException
e
)
{
ret
=
asc
;
}
return
ret
;
}
static
final
public
String
gb2asc
(
String
gb
)
{
String
ret
;
if
(
gb
==
null
)
return
gb
;
try
{
ret
=
new
String
(
gb
.
getBytes
(
"GB2312"
),
"ISO8859_1"
);
}
catch
(
UnsupportedEncodingException
e
)
{
ret
=
gb
;
}
return
ret
;
}
static
final
public
int
byte2int
(
byte
b
){
return
((-
1
)>>>
24
)&
b
;
}
/**
* 函数功能:得到sys_param参数
* @param paramid:参数ID
* @return:参数值
*/
static
final
public
synchronized
String
getParamValbyId
(
String
paramid
){
String
rs
=
""
;
Connection
conn
=
null
;
Statement
stmt
=
null
;
ResultSet
rset
=
null
;
String
strSql
=
""
;
try
{
Context
ictx
=
new
InitialContext
();
javax
.
sql
.
DataSource
ds
=
(
javax
.
sql
.
DataSource
)
ictx
.
lookup
(
"TQXXDS"
);
conn
=
ds
.
getConnection
();
stmt
=
conn
.
createStatement
();
strSql
=
"select paramvalue+1 value from sys_param where paramid='"
+
paramid
+
"'"
;
rset
=
stmt
.
executeQuery
(
strSql
);
if
(
rset
.
next
()){
rs
=
rset
.
getString
(
"value"
);
}
}
catch
(
Exception
e
){
PrintInfo
(
"error"
,
"ERROR--[取系统参数发生异常]"
+
e
+
"\n"
+
strSql
);
}
finally
{
if
(
rset
!=
null
){
try
{
rset
.
close
();
}
catch
(
Exception
ignore
)
{};
}
if
(
stmt
!=
null
){
try
{
stmt
.
close
();
}
catch
(
Exception
ignore
)
{};
}
if
(
conn
!=
null
){
try
{
conn
.
close
();
}
catch
(
Exception
ignore
)
{};
}
}
return
rs
;
}
/**
* 函数功能:给行政区划代码右截0
* @param code:待处理字符串
* @return:参数值
*/
static
final
public
String
TrimQhZero
(
String
code
){
String
rs
=
code
;
if
(
rs
.
substring
(
2
).
equals
(
"0000"
)){
rs
=
rs
.
substring
(
0
,
2
);
}
else
{
if
(
rs
.
substring
(
4
).
equals
(
"00"
)){
rs
=
rs
.
substring
(
0
,
4
);
}
}
return
rs
;
}
/**
* 函数功能:给单位代码右截0
* @param code:待处理字符串
* @return:参数值
*/
static
final
public
String
TrimDwZero
(
String
code
){
String
rs
=
code
;
if
(
rs
.
substring
(
2
).
equals
(
"0000000000"
)){
rs
=
rs
.
substring
(
0
,
2
);
}
else
{
if
(
rs
.
substring
(
4
).
equals
(
"00000000"
)){
rs
=
rs
.
substring
(
0
,
4
);
}
else
{
if
(
rs
.
substring
(
6
).
equals
(
"000000"
)){
rs
=
rs
.
substring
(
0
,
6
);
}
else
{
if
(
rs
.
substring
(
9
).
equals
(
"000"
)){
rs
=
rs
.
substring
(
0
,
9
);
}
}
}
}
return
rs
;
}
/**
* 函数功能:获得主键编号,替换用sqence产生的编号
* @return:产生的主键
*/
public
static
synchronized
String
getMainSeq
(){
String
rs
=
""
;
Calendar
chinaCal
=
Calendar
.
getInstance
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
int
YY
=
chinaCal
.
get
(
Calendar
.
YEAR
)
;
int
MM
=
chinaCal
.
get
(
Calendar
.
MONTH
)+
1
;
int
DD
=
chinaCal
.
get
(
Calendar
.
DATE
);
int
HH
=
chinaCal
.
get
(
Calendar
.
HOUR_OF_DAY
);
//System.out.println(HH);
int
NN
=
chinaCal
.
get
(
Calendar
.
MINUTE
);
int
SS
=
chinaCal
.
get
(
Calendar
.
SECOND
);
int
MI
=
chinaCal
.
get
(
Calendar
.
MILLISECOND
);
rs
+=
String
.
valueOf
(
YY
);
rs
+=
getLongStr
(
String
.
valueOf
(
MM
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
DD
),
2
);
//rs+=":";
rs
+=
getLongStr
(
String
.
valueOf
(
HH
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
NN
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
SS
),
2
);
//rs+="-";
rs
+=
getLongStr
(
String
.
valueOf
(
MI
),
3
);
//rs+="#";
rs
+=
getLongStr
(
String
.
valueOf
(
Math
.
abs
(
ran
.
nextInt
())),
6
);
// com.CommonFunc.PrintInfo("DEBUG", "[CommonFunc.java:L398]rs ="+rs+","+System.currentTimeMillis());
return
rs
;
}
/**
* 函数功能:获得定长的字符,服务于getMainSeq函数
* @return:产生的字符
*/
private
static
String
getLongStr
(
String
s
,
int
len
){
String
temps
=
s
;
int
strlen
=
temps
.
length
();
if
(
strlen
>=
len
){
return
temps
.
substring
(
0
,
len
);
}
else
{
for
(
int
i
=
0
;
i
<
len
-
strlen
;
i
++){
temps
=
"0"
+
temps
;
}
return
temps
;
}
}
/**
* 函数功能:判断对象是否为null并返回字符串
*/
public
static
String
checknull
(
Object
ss
){
if
(
ss
==
null
||
"null"
.
equals
(
ss
.
toString
().
trim
()))
return
""
;
else
return
ss
.
toString
().
trim
();
}
/**
* 函数功能:将时间字符串处理成***年***月***日**时的样子
*/
public
static
String
FormatDateStr
(
String
timestr
){
String
temps
=
""
;
if
(
timestr
!=
null
&&!
timestr
.
equals
(
""
)){
if
(
timestr
.
length
()==
7
){
temps
=
timestr
.
substring
(
0
,
4
)+
"年"
+
timestr
.
substring
(
5
,
7
)+
"月"
;
}
else
if
(
timestr
.
length
()==
10
){
temps
=
timestr
.
substring
(
0
,
4
)+
"年"
+
timestr
.
substring
(
5
,
7
)+
"月"
+
timestr
.
substring
(
8
,
10
)+
"日"
;
}
else
if
(
timestr
.
length
()==
13
){
temps
=
timestr
.
substring
(
0
,
4
)+
"年"
+
timestr
.
substring
(
5
,
7
)+
"月"
+
timestr
.
substring
(
8
,
10
)+
"日"
+
timestr
.
substring
(
11
,
13
)+
"时"
;
}
else
if
(
timestr
.
length
()==
16
){
temps
=
timestr
.
substring
(
0
,
4
)+
"年"
+
timestr
.
substring
(
5
,
7
)+
"月"
+
timestr
.
substring
(
8
,
10
)+
"日"
+
timestr
.
substring
(
11
,
13
)+
"时"
+
timestr
.
substring
(
14
,
16
)+
"分"
;
}
else
if
(
timestr
.
length
()==
19
){
temps
=
timestr
.
substring
(
0
,
4
)+
"年"
+
timestr
.
substring
(
5
,
7
)+
"月"
+
timestr
.
substring
(
8
,
10
)+
"日"
+
timestr
.
substring
(
11
,
13
)+
"时"
+
timestr
.
substring
(
14
,
16
)+
"分"
+
timestr
.
substring
(
17
,
19
)+
"秒"
;
}
else
{
temps
=
""
;
}
}
return
temps
;
}
/**
* 与MakeWhereStr (String segname相比,segname可以多个
*/
public
static
String
MakeWhereStr
(
String
[]
segname
,
String
type1
,
String
mode1
,
String
[]
ss
){
String
rt
=
""
;
for
(
int
i
=
0
;
i
<
segname
.
length
;
i
++){
String
ttt
=
MakeWhereStr
(
segname
[
i
],
type1
,
mode1
,
ss
);
ttt
=
ttt
.
trim
();
if
(
ttt
.
equals
(
""
)){
break
;
}
if
(
ttt
.
substring
(
0
,
3
).
equals
(
"and"
)){
ttt
=
ttt
.
substring
(
3
);}
ttt
=
"("
+
ttt
.
trim
()+
")"
;
if
(
i
>
0
)
rt
+=
" or "
;
rt
+=
ttt
;
}
if
(!
rt
.
equals
(
""
)){
rt
=
" and ("
+
rt
.
trim
()+
")"
;
}
return
rt
;
}
public
static
String
eolByZero
(
String
ss
){
String
str
=
RtrimZero
(
ss
);
if
(
str
==
ss
){
return
" = '"
+
ss
+
"'"
;
}
else
{
return
" like '"
+
str
+
"%'"
;
}
}
public
static
String
eol2
(
String
ss
){
if
(
ss
.
indexOf
(
"%"
)!=-
1
||
ss
.
indexOf
(
"_"
)!=
-
1
)
return
" like '"
+
ss
+
"' "
;
else
return
" = '"
+
ss
+
"' "
;
}
// 右截零函数
public
static
String
RtrimZero
(
String
str
){
if
(
str
==
null
)
return
""
;
String
s
=
str
;
int
count
=
0
;
if
(
s
!=
null
&&
!
s
.
equals
(
""
)
){
count
=
0
;
for
(
int
i
=
s
.
length
()-
1
;
i
>
0
;
i
--){
if
(
s
.
charAt
(
i
)!=
'0'
)
break
;
else
count
++;
}
}
if
(
count
==
s
.
length
()){
return
""
;
}
else
{
return
s
.
substring
(
0
,
s
.
length
()-
count
);
}
}
static
public
String
FormatStr
(
String
strSRC
)
{
if
(
strSRC
==
null
)
strSRC
=
""
;
byte
[]
bb
=
strSRC
.
getBytes
();
for
(
int
i
=
0
;
i
<
bb
.
length
;
i
++)
{
bb
[
i
]
=
(
byte
)(
bb
[
i
]
+
1
);
}
return
new
String
(
bb
);
}
static
public
String
UnFormatStr
(
String
strSRC
)
{
if
(
strSRC
==
null
)
strSRC
=
""
;
byte
[]
bb
=
strSRC
.
getBytes
();
for
(
int
i
=
0
;
i
<
bb
.
length
;
i
++)
{
bb
[
i
]
=
(
byte
)(
bb
[
i
]
-
1
);
}
return
new
String
(
bb
);
}
public
static
String
MakeWhereStr
(
String
segname
,
String
type1
,
String
mode1
,
String
ss
){
String
[]
tt
=
new
String
[
1
];
tt
[
0
]
=
ss
;
return
MakeWhereStr
(
segname
,
type1
,
mode1
,
tt
);
}
/**
* 计算现在累计amount小时候的时间
*/
private
static
String
getSomeHoursTime
(
int
amount
){
java
.
util
.
Date
date
=
new
java
.
util
.
Date
();
java
.
util
.
Calendar
c
=
java
.
util
.
Calendar
.
getInstance
();
c
.
setTime
(
date
);
c
.
add
(
java
.
util
.
Calendar
.
MINUTE
,
amount
);
java
.
text
.
SimpleDateFormat
sf
=
new
java
.
text
.
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
return
sf
.
format
(
c
.
getTime
());
}
static
public
String
pingWhereSql
(
String
cxm
,
String
xm
,
String
cxb
,
String
xb
,
String
cxbname
,
String
xbname
,
String
csfzh1
,
String
csfzh2
,
String
sfzh
,
String
ccsrq1
,
String
csrq1
,
String
ccsrq2
,
String
csrq2
,
String
csrqtype
,
String
chdsj1
,
String
hdsj1
,
String
chdsj2
,
String
hdsj2
)
{
String
wstr
=
""
;
if
(
xm
!=
null
&&
!
xm
.
equals
(
""
)
&&
!
xm
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
cxm
+
"='"
+
xm
+
"'"
;
}
if
(
cxb
!=
null
&&
!
cxb
.
equals
(
""
)
&&
!
xb
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
cxb
+
"='"
+
xb
+
"'"
;
}
if
(
cxbname
!=
null
&&
!
cxbname
.
equals
(
""
)
&&
!
xbname
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
cxbname
+
"='"
+
xbname
+
"'"
;
}
if
(!
csfzh1
.
equals
(
""
)
&&
!
csfzh2
.
equals
(
""
)
&&
!
sfzh
.
equals
(
""
)){
wstr
=
wstr
+
" and ("
+
csfzh1
+
"='"
+
sfzh
+
"' or "
+
csfzh2
+
"='"
+
sfzh
+
"') "
;
}
else
if
(!
csfzh1
.
equals
(
""
)
&&
!
sfzh
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
csfzh1
+
"='"
+
sfzh
+
"'"
;
}
if
(
csrqtype
.
equalsIgnoreCase
(
"c"
)){
if
(
ccsrq1
!=
null
&&
!
ccsrq1
.
equals
(
""
)
&&
!
csrq1
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
ccsrq1
+
">=to_char(to_date('"
+
csrq1
+
"','YYYY-MM-DD'),'YYYYMMDD')"
;
}
if
(
ccsrq2
!=
null
&&
!
ccsrq2
.
equals
(
""
)
&&
!
csrq2
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
ccsrq2
+
"<=to_char(to_date('"
+
csrq2
+
"','YYYY-MM-DD'),'YYYYMMDD')"
;
}
}
else
{
if
(
ccsrq1
!=
null
&&
!
ccsrq1
.
equals
(
""
)
&&
!
csrq1
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
ccsrq1
+
">=to_date('"
+
csrq1
+
"','YYYY-MM-DD')"
;
}
if
(
ccsrq2
!=
null
&&
!
ccsrq2
.
equals
(
""
)
&&
!
csrq2
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
ccsrq2
+
"<=to_date('"
+
csrq2
+
"','YYYY-MM-DD')"
;
}
}
if
(
chdsj1
!=
null
&&
!
chdsj1
.
equals
(
""
)
&&
!
hdsj1
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
chdsj1
+
">=to_date('"
+
hdsj1
+
"','YYYY-MM-DD')"
;
}
if
(
chdsj2
!=
null
&&
!
chdsj2
.
equals
(
""
)
&&
!
hdsj2
.
equals
(
""
)){
wstr
=
wstr
+
" and "
+
chdsj2
+
"<=to_date('"
+
hdsj2
+
"','YYYY-MM-DD')"
;
}
return
wstr
;
}
//20100525zlj增加一组功能,用于拼接sql语句
/**
* 函数功能:根据字段名,一系列值,字段类型,匹配模式 拼接sql语句
* type: string|number|date|time 可以扩展
* mode: like|rtrimlike|dwtrimlike|qhtrimlike|baifenhao|>|<|>=|<=|= 可以扩展
* 返回sqlwhere语句
*/
public
static
String
MakeWhereStr
(
String
segname
,
String
type1
,
String
mode1
,
String
[]
ss
){
if
(
ss
==
null
)
return
""
;
if
(
ss
.
length
==
0
)
return
""
;
segname
=
segname
.
toLowerCase
();
type1
=
type1
.
toLowerCase
();
mode1
=
mode1
.
toLowerCase
();
String
rt
=
""
;
for
(
int
i
=
0
;
i
<
ss
.
length
;
i
++){
if
(!
ss
[
i
].
equals
(
""
)){
if
(
i
>
0
)
rt
+=
" or "
;
rt
+=
" "
+
segname
+
" "
;
if
(
type1
.
equals
(
"string"
)){
if
(
mode1
.
equals
(
"rtrimlike"
)){
rt
+=
eolByZero
(
ss
[
i
]);
}
else
if
(
mode1
.
equals
(
"dwtrimlike"
)){
if
(
ss
[
i
].
length
()==
12
){
String
str
=
TrimDwZero
(
ss
[
i
]);
if
(
str
==
ss
[
i
]){
rt
+=
" = '"
+
ss
[
i
]+
"'"
;
}
else
{
rt
+=
" like '"
+
str
+
"%'"
;
}
}
}
else
if
(
mode1
.
equals
(
"qhtrimlike"
)){
if
(
ss
[
i
].
length
()==
6
){
String
str
=
TrimQhZero
(
ss
[
i
]);
if
(
str
==
ss
[
i
]){
rt
+=
" = '"
+
ss
[
i
]+
"'"
;
}
else
{
rt
+=
" like '"
+
str
+
"%'"
;
}
}
}
else
if
(
mode1
.
equals
(
"baifenhao"
)){
//自动加百分号
if
(
ss
[
i
].
indexOf
(
"%"
)>=
0
||
ss
[
i
].
indexOf
(
"_"
)>=
0
){
rt
+=
" like '"
+
ss
[
i
]
+
"'"
;
}
else
{
rt
+=
" like '%"
+
ss
[
i
]
+
"%'"
;
}
}
else
{
rt
+=
" "
+
mode1
+
" '"
+
ss
[
i
]
+
"' "
;
}
}
else
if
(
type1
.
equals
(
"number"
)){
rt
+=
" "
+
mode1
+
" "
+
ss
[
i
];
}
else
if
(
type1
.
equals
(
"date"
)){
rt
+=
" "
+
mode1
+
" to_date('"
+
ss
[
i
]
+
"','YYYY-mm-dd') "
+
" "
;
}
else
if
(
type1
.
equals
(
"time"
)){
rt
+=
" "
+
mode1
+
" to_date('"
+
ss
[
i
]
+
"','YYYY-mm-dd hh24:mi') "
+
" "
;
}
}
}
if
(
ss
.
length
>
1
){
rt
=
"("
+
rt
+
")"
;
}
if
(!
rt
.
equals
(
""
)){
rt
=
" and "
+
rt
;
}
return
rt
;
}
/**
* 函数功能:将ip地址换算成整数
* 返回整数
*/
public
static
int
GetLongIP
(
String
ipstr
){
int
ri
=
0
;
//System.out.println(ipstr);
StringTokenizer
st
=
new
StringTokenizer
(
ipstr
,
"."
);
//String[] s=ipstr.split(".");
//System.out.println(s.length);
ri
+=
255
*
255
*
255
*
Integer
.
parseInt
(
st
.
nextToken
());
ri
+=
255
*
255
*
Integer
.
parseInt
(
st
.
nextToken
());
ri
+=
255
*
Integer
.
parseInt
(
st
.
nextToken
());
ri
+=
Integer
.
parseInt
(
st
.
nextToken
());
return
ri
;
}
/**
* 函数功能:代码右截0
* @param code:待处理字符串
* @return:参数值
*/
static
final
public
String
TrimZero
(
String
code
){
String
rs
=
code
;
for
(
int
i
=
0
;
i
<
code
.
length
()-
1
;
i
++){
if
(
rs
.
charAt
(
rs
.
length
()-
1
)==
'0'
){
rs
=
rs
.
substring
(
0
,
rs
.
length
()-
1
);
}
else
{
break
;
}
}
return
rs
;
}
static
final
public
String
convertBlob
(
Blob
blob
){
StringBuffer
temp
=
new
StringBuffer
();
String
line
=
""
;
BufferedReader
reader
=
null
;
try
{
reader
=
new
BufferedReader
(
new
InputStreamReader
(
blob
.
getBinaryStream
(),
"GBK"
),
1024
);
while
(
(
line
=
reader
.
readLine
())
!=
null
)
{
temp
.
append
(
line
).
append
(
"\n"
);
}
}
catch
(
UnsupportedEncodingException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
IOException
e2
)
{
e2
.
printStackTrace
();}
catch
(
SQLException
e3
)
{
e3
.
printStackTrace
();}
finally
{
try
{
line
=
null
;
if
(
reader
!=
null
)
reader
.
close
();
}
catch
(
IOException
e4
)
{
e4
.
printStackTrace
();}
}
return
temp
.
toString
();
//return getStr(temp.toString());
}
//将字符串转换成html格式以便out.print输出
public
static
String
WriteStrHTML
(
String
str
){
String
outstr
=
str
;
outstr
=
outstr
.
replaceAll
(
" "
,
" "
);
outstr
=
outstr
.
replaceAll
(
" "
,
" "
);
outstr
=
outstr
.
replaceAll
(
"\n"
,
"<br>"
);
return
outstr
;
}
/**
* 函数功能:当字符串长度超过maxlen时,截去maxlen-2,并加上省略号,主要用于标题列表防止标题过长
* @return:处理之后的字符
*/
public
static
String
titleCut
(
String
s
,
int
maxlen
){
if
(
maxlen
<
3
)
return
s
;
if
(
s
==
null
||
s
.
equals
(
""
))
return
""
;
if
(
s
.
length
()>
maxlen
){
return
s
.
substring
(
0
,
maxlen
-
2
)+
"..."
;
}
else
{
return
s
;
}
}
/**
* 函数功能:处理日期格式
* 参数:datestr待处理的字符串
* flg:
* true将日期处理成没有符号的字符串,如yyyymmddhhnnss
* false将日期处理成没有符号的字符串,如yyyy-mm-dd hh:nn:ss
* @return:处理之后的字符
*/
public
static
String
formatdate
(
String
datestr
,
boolean
flg
){
if
(
datestr
==
null
){
return
""
;
}
else
{
if
(
flg
){
if
(
datestr
.
length
()==
10
){
return
datestr
.
substring
(
0
,
4
)+
datestr
.
substring
(
5
,
7
)+
datestr
.
substring
(
8
);
}
else
if
(
datestr
.
length
()==
16
){
return
datestr
.
substring
(
0
,
4
)+
datestr
.
substring
(
5
,
7
)+
datestr
.
substring
(
8
,
10
)+
datestr
.
substring
(
11
,
13
)+
datestr
.
substring
(
14
);
}
else
if
(
datestr
.
length
()==
19
){
return
datestr
.
substring
(
0
,
4
)+
datestr
.
substring
(
5
,
7
)+
datestr
.
substring
(
8
,
10
)+
datestr
.
substring
(
11
,
13
)+
datestr
.
substring
(
14
,
16
)+
datestr
.
substring
(
17
);
}
else
{
return
datestr
;
}
}
else
{
if
(
datestr
.
length
()==
8
){
return
datestr
.
substring
(
0
,
4
)+
"-"
+
datestr
.
substring
(
4
,
6
)+
"-"
+
datestr
.
substring
(
6
);
}
else
if
(
datestr
.
length
()==
12
){
return
datestr
.
substring
(
0
,
4
)+
"-"
+
datestr
.
substring
(
4
,
6
)+
"-"
+
datestr
.
substring
(
6
,
8
)+
" "
+
datestr
.
substring
(
8
,
10
)+
":"
+
datestr
.
substring
(
10
);
}
else
if
(
datestr
.
length
()==
14
){
return
datestr
.
substring
(
0
,
4
)+
"-"
+
datestr
.
substring
(
4
,
6
)+
"-"
+
datestr
.
substring
(
6
,
8
)+
" "
+
datestr
.
substring
(
8
,
10
)+
":"
+
datestr
.
substring
(
10
,
12
)+
":"
+
datestr
.
substring
(
12
);
}
else
{
return
datestr
;
}
}
}
}
/**
* 函数功能:获得当前日期时间字符串
* 参数:无
* @return:处理之后的字符串
*/
public
static
String
getNowTimeStr
(){
String
rs
=
""
;
Calendar
chinaCal
=
Calendar
.
getInstance
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
int
YY
=
chinaCal
.
get
(
Calendar
.
YEAR
)
;
int
MM
=
chinaCal
.
get
(
Calendar
.
MONTH
)+
1
;
int
DD
=
chinaCal
.
get
(
Calendar
.
DATE
);
int
HH
=
chinaCal
.
get
(
Calendar
.
HOUR_OF_DAY
);
int
NN
=
chinaCal
.
get
(
Calendar
.
MINUTE
);
int
SS
=
chinaCal
.
get
(
Calendar
.
SECOND
);
rs
+=
String
.
valueOf
(
YY
);
rs
+=
getLongStr
(
String
.
valueOf
(
MM
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
DD
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
HH
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
NN
),
2
);
rs
+=
getLongStr
(
String
.
valueOf
(
SS
),
2
);
return
rs
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"main..."
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
System
.
out
.
println
(
getMainSeq
());
Random
ran
=
new
Random
();
System
.
out
.
println
(
Math
.
abs
(
ran
.
nextInt
()));
}
String
s
=
"gET"
;
String
s111
=
"GET"
;
}
/**
* 函数功能:获得当前网页路径
* 参数:flg:1 当前文件路径下
* 2 当前文件父路径下
* @return:处理之后的字符串
*/
public
static
String
getUrlPath
(
String
paths
,
int
flg
){
String
ts
=
paths
;
//System.out.println("ts="+ts);
String
fileseparator
=
"/"
;
//System.out.println("fileseparator="+fileseparator);
int
p
=
ts
.
lastIndexOf
(
fileseparator
);
ts
=
ts
.
substring
(
0
,
p
);
//System.out.println("1ts="+ts);
if
(
flg
==
2
){
p
=
ts
.
lastIndexOf
(
fileseparator
);
ts
=
ts
.
substring
(
0
,
p
);
//System.out.println("2ts="+ts);
}
return
ts
+
fileseparator
;
}
/**
* 警终移植
*/
public
static
String
Strreplaceall
(
String
str
,
String
oldstr
,
String
newstr
){
String
tempstr
=
str
;
String
headstr
=
""
,
endstr
=
""
;
int
p
=
tempstr
.
indexOf
(
oldstr
);
if
(
p
<
0
){
return
tempstr
;
}
else
{
headstr
=
tempstr
.
substring
(
0
,
p
);
endstr
=
tempstr
.
substring
(
p
+
oldstr
.
length
());
return
headstr
+
newstr
+
endstr
;
}
}
public
static
String
beforeDate
(
int
p_days
)
{
java
.
util
.
Date
d
=
new
java
.
util
.
Date
();
String
s
=
""
;
int
Yr
,
Mon
,
Day
,
Hour
,
Mi
;
String
sYr
,
sMon
,
sDay
,
sHour
,
sMi
;
Yr
=
1900
+
d
.
getYear
();
Mon
=
d
.
getMonth
();
Mon
++;
Day
=
d
.
getDate
();
Hour
=
d
.
getHours
();
Mi
=
d
.
getMinutes
();
if
(
p_days
>
Day
){
if
(
Mon
!=
1
){
Mon
--;
}
else
{
Mon
=
12
;
Yr
--;
}
Day
=
lastMonDay
(
Mon
,
Yr
)-(
p_days
-
Day
);
}
else
if
(
p_days
==
Day
){
if
(
Mon
!=
1
){
Mon
--;
}
else
{
Mon
=
12
;
Yr
--;
}
Day
=
lastMonDay
(
Mon
,
Yr
)-(
p_days
-
Day
);
}
else
{
Day
=
Day
-
p_days
;
}
if
(
Mon
<
10
)
sMon
=
"0"
+
String
.
valueOf
(
Mon
);
else
sMon
=
String
.
valueOf
(
Mon
);
if
(
Day
<
10
)
sDay
=
"0"
+
String
.
valueOf
(
Day
);
else
sDay
=
String
.
valueOf
(
Day
);
if
(
Hour
<
10
)
sHour
=
"0"
+
String
.
valueOf
(
Hour
);
else
sHour
=
String
.
valueOf
(
Hour
);
if
(
Mi
<
10
)
sMi
=
"0"
+
String
.
valueOf
(
Mi
);
else
sMi
=
String
.
valueOf
(
Mi
);
s
=
String
.
valueOf
(
Yr
)+
"-"
+
sMon
+
"-"
+
sDay
+
" "
+
sHour
+
":"
+
sMi
;
return
(
s
);
//return "";
}
public
static
int
lastMonDay
(
int
mon
,
int
year
){
if
(
mon
==
1
||
mon
==
3
||
mon
==
5
||
mon
==
7
||
mon
==
8
||
mon
==
10
||
mon
==
12
){
return
31
;
}
else
{
if
(
mon
==
2
){
if
(
isLeapYear
(
year
)){
return
29
;
}
else
{
return
28
;
}
}
else
{
return
30
;
}
}
}
public
static
boolean
isLeapYear
(
int
year
){
if
(
year
%
400
==
0
||
(
year
%
4
==
0
&&
year
%
100
!=
0
))
{
return
true
;
}
else
{
return
false
;
}
}
void
ptr
(
String
s
)
{
;
}
public
static
String
getTimeByStr
(
String
str
)
{
String
sRet
=
""
;
String
sTmp
=
""
;
str
=
str
.
trim
();
if
(
str
.
indexOf
(
' '
)
>
-
1
)
{
sTmp
=
str
.
substring
(
str
.
indexOf
(
' '
)
+
1
);
}
else
{
sTmp
=
str
;
}
int
idx
=
0
;
String
HH
=
""
;
String
MI
=
""
;
String
SS
=
""
;
for
(
int
i
=
0
;
i
<
sTmp
.
length
();
i
++)
{
char
c
=
sTmp
.
charAt
(
i
);
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
{
if
(
idx
==
0
)
HH
=
HH
+
c
;
if
(
idx
==
1
)
MI
=
MI
+
c
;
if
(
idx
!=
2
)
continue
;
SS
=
SS
+
c
;
}
else
{
idx
++;
}
}
HH
=
HH
.
trim
();
MI
=
MI
.
trim
();
SS
=
SS
.
trim
();
int
len
=
HH
.
length
();
for
(
int
j
=
0
;
j
<
2
-
len
;
j
++)
HH
=
"0"
+
HH
;
len
=
MI
.
length
();
for
(
int
j
=
0
;
j
<
2
-
len
;
j
++)
MI
=
"0"
+
MI
;
len
=
SS
.
length
();
for
(
int
j
=
0
;
j
<
2
-
len
;
j
++)
SS
=
"0"
+
SS
;
sRet
=
HH
+
":"
+
MI
+
":"
+
SS
;
return
sRet
;
}
public
static
String
getDateByStr
(
String
str
)
{
String
sRet
=
""
;
String
sTmp
=
""
;
str
=
str
.
trim
();
if
(
str
.
indexOf
(
' '
)
>
-
1
)
{
str
.
substring
(
0
,
str
.
indexOf
(
' '
));
}
else
{
sTmp
=
str
;
}
int
idx
=
0
;
String
yyyy
=
""
;
String
mm
=
""
;
String
dd
=
""
;
for
(
int
i
=
0
;
i
<
sTmp
.
length
();
i
++)
{
char
c
=
sTmp
.
charAt
(
i
);
if
((
c
>=
'0'
)
&&
(
c
<=
'9'
))
{
if
(
idx
==
0
)
yyyy
=
yyyy
+
c
;
if
(
idx
==
1
)
mm
=
mm
+
c
;
if
(
idx
!=
2
)
continue
;
dd
=
dd
+
c
;
}
else
{
idx
++;
}
}
yyyy
=
yyyy
.
trim
();
mm
=
mm
.
trim
();
dd
=
dd
.
trim
();
if
(
yyyy
.
length
()
==
2
)
yyyy
=
"20"
+
yyyy
;
if
(
yyyy
.
length
()
==
1
)
yyyy
=
"200"
+
yyyy
;
int
len
=
mm
.
length
();
for
(
int
j
=
0
;
j
<
2
-
len
;
j
++)
mm
=
"0"
+
mm
;
len
=
dd
.
length
();
for
(
int
j
=
0
;
j
<
2
-
len
;
j
++)
dd
=
"0"
+
dd
;
sRet
=
yyyy
+
"-"
+
mm
+
"-"
+
dd
;
return
sRet
;
}
public
static
String
getDateTimeByStr
(
String
str
)
{
String
sRet
=
""
;
String
sTmpD
=
""
;
String
sTmpT
=
""
;
str
=
str
.
trim
();
if
(
str
.
indexOf
(
' '
)
>
-
1
)
{
sTmpD
=
str
.
substring
(
0
,
str
.
indexOf
(
' '
));
sTmpT
=
str
.
substring
(
str
.
indexOf
(
' '
)
+
1
);
}
else
{
return
str
;
}
return
getDateByStr
(
sTmpD
)
+
" "
+
getTimeByStr
(
sTmpT
);
}
}
src/main/java/com/founder/util/ServiceUtil.java
0 → 100644
View file @
f5c702d6
package
com
.
founder
.
util
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
com.founder.model.Jzryxx
;
import
com.founder.utils.QueryService
;
import
org.dom4j.Document
;
import
org.dom4j.DocumentException
;
import
org.dom4j.DocumentHelper
;
import
org.dom4j.Element
;
public
class
ServiceUtil
{
static
QueryService
queryService
=
new
QueryService
();
/**
*
* <P>Title: createXmlQureyPerson </P>
* <P>Description:创建查询警综人员Xml</P>
* <P>param 参数类型@param condition
* <P>param 参数类型@param dataObjectCode
* <P>param 参数类型@return </P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
static
String
createXmlQureyPerson
(
String
condition
,
String
dataObjectCode
){
Document
document
=
DocumentHelper
.
createDocument
();
document
.
setXMLEncoding
(
"GB2312"
);
Element
root
=
document
.
addElement
(
"RBSPMessage"
);
root
.
addElement
(
"RequesterID"
).
addText
(
"C410000-BZCJ0001"
);
Element
method
=
root
.
addElement
(
"Method"
);
method
.
addElement
(
"Name"
).
addText
(
"Query"
);
Element
security
=
method
.
addElement
(
"Security"
);
security
.
addElement
(
"Signature"
);
security
.
addElement
(
"Encrypt"
).
addAttribute
(
"Algorithm"
,
""
);
Element
items
=
method
.
addElement
(
"Items"
);
Element
item
=
items
.
addElement
(
"Item"
);
item
.
addElement
(
"Name"
).
addText
(
"SysAlias"
);
item
.
addElement
(
"Value"
).
addAttribute
(
"Type"
,
"string"
).
addElement
(
"Data"
).
addText
(
"DSjwzhxt"
);
Element
item01
=
items
.
addElement
(
"Item"
);
item01
.
addElement
(
"Name"
).
addText
(
"DataObjectCode"
);
item01
.
addElement
(
"Value"
).
addAttribute
(
"Type"
,
"string"
).
addElement
(
"Data"
).
addText
(
dataObjectCode
);
Element
item02
=
items
.
addElement
(
"Item"
);
item02
.
addElement
(
"Name"
).
addText
(
"Condition"
);
item02
.
addElement
(
"Value"
).
addAttribute
(
"Type"
,
"string"
).
addElement
(
"Data"
).
addText
(
condition
);
Element
item03
=
items
.
addElement
(
"Item"
);
item03
.
addElement
(
"Name"
).
addText
(
"Pager"
);
Element
value03
=
item03
.
addElement
(
"Value "
).
addAttribute
(
"Type"
,
"string"
);
Element
row03
=
value03
.
addElement
(
"Row"
);
row03
.
addElement
(
"Data"
).
addText
(
"1"
);
row03
.
addElement
(
"Data"
).
addText
(
"10"
);
Element
item04
=
items
.
addElement
(
"Item"
);
item04
.
addElement
(
"Name"
).
addText
(
"RequiredItems"
);
Element
value04
=
item04
.
addElement
(
"Value "
).
addAttribute
(
"Type"
,
"arrayOf_string"
);
Element
row04
=
value04
.
addElement
(
"Row"
);
row04
.
addElement
(
"Data"
).
addText
(
"XYRBH"
);
row04
.
addElement
(
"Data"
).
addText
(
"GMSFHM"
);
row04
.
addElement
(
"Data"
).
addText
(
"CSRQ"
);
row04
.
addElement
(
"Data"
).
addText
(
"XM"
);
row04
.
addElement
(
"Data"
).
addText
(
"BMCH"
);
row04
.
addElement
(
"Data"
).
addText
(
"XB"
);
row04
.
addElement
(
"Data"
).
addText
(
"MZ"
);
row04
.
addElement
(
"Data"
).
addText
(
"JGGJDQ"
);
row04
.
addElement
(
"Data"
).
addText
(
"JGSSQX"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZZMM"
);
row04
.
addElement
(
"Data"
).
addText
(
"WHCD"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZY"
);
row04
.
addElement
(
"Data"
).
addText
(
"FWCS"
);
row04
.
addElement
(
"Data"
).
addText
(
"HJDSSXQ"
);
row04
.
addElement
(
"Data"
).
addText
(
"HJDXZ"
);
row04
.
addElement
(
"Data"
).
addText
(
"XZQH"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZZXZ"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZJZL"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZJHM"
);
row04
.
addElement
(
"Data"
).
addText
(
"LXDH"
);
row04
.
addElement
(
"Data"
).
addText
(
"FWCSLXDH"
);
row04
.
addElement
(
"Data"
).
addText
(
"ZC"
);
row04
.
addElement
(
"Data"
).
addText
(
"BZ"
);
row04
.
addElement
(
"Data"
).
addText
(
"DJDW"
);
row04
.
addElement
(
"Data"
).
addText
(
"DJR"
);
row04
.
addElement
(
"Data"
).
addText
(
"DJRQ"
);
row04
.
addElement
(
"Data"
).
addText
(
"SJJZDXZ"
);
System
.
out
.
println
(
document
.
asXML
());
return
document
.
asXML
();
}
/**
*
* <P>Title: createKry </P>
* <P>Description:创建获取警综主键编号Xml</P>
* <P>param 参数类型@param unitCode
* <P>param 参数类型@return </P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
static
String
createKeyXml
(
String
unitCode
){
Document
document
=
DocumentHelper
.
createDocument
();
document
.
setXMLEncoding
(
"GB2312"
);
Element
root
=
document
.
addElement
(
"CKRequest"
);
root
.
addElement
(
"RequesterID"
).
addText
(
"C410000-BZCJ0001"
);
Element
method
=
root
.
addElement
(
"Method"
);
method
.
addElement
(
"Name"
).
addText
(
"CreateGiapPrimaryKey"
);
Element
security
=
method
.
addElement
(
"Security"
);
security
.
addElement
(
"Signature"
);
security
.
addElement
(
"Encrypt"
).
addAttribute
(
"Algorithm"
,
""
);
Element
parameter
=
method
.
addElement
(
"Parameter"
);
parameter
.
addElement
(
"TableName"
).
addText
(
"R-BZCJ-RXXX-001"
);
parameter
.
addElement
(
"GroupNo"
).
addText
(
unitCode
+
new
java
.
text
.
SimpleDateFormat
(
"yyyyMM"
).
format
(
new
java
.
util
.
Date
()));
parameter
.
addElement
(
"KeyLength"
).
addText
(
"25"
);
parameter
.
addElement
(
"KeyName"
);
return
document
.
asXML
();
}
/**
*
* <P>Title: analysisKry </P>
* <P>Description:解析返回的主键XML</P>
* <P>param 参数类型@param xml
* <P>param 参数类型@return </P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
static
String
analysisKey
(
String
xml
){
String
key
=
""
;
Document
document
;
try
{
document
=
DocumentHelper
.
parseText
(
xml
);
Element
root
=
document
.
getRootElement
();
Element
Method
=
root
.
element
(
"Method"
);
Element
Items
=
Method
.
element
(
"Items"
);
List
<
Element
>
list
=
Items
.
elements
(
"Item"
);
for
(
Element
e:
list
){
Iterator
item
=
e
.
elementIterator
();
while
(
item
.
hasNext
())
{
Element
row
=
(
Element
)
item
.
next
();
if
(
"Row"
.
equals
(
row
.
getName
()))
{
key
=
row
.
element
(
"Data"
).
getTextTrim
();
}
}
}
//System.out.println(key);
}
catch
(
DocumentException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
key
;
}
/**
*
* <P>Title: createXmlReport </P>
* <P>Description:创建回传给警综数据的XML</P>
* <P>param 参数类型@return </P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
static
String
createXmlReport
(
Jzryxx
ryxx
){
Document
document
=
DocumentHelper
.
createDocument
();
document
.
setXMLEncoding
(
"GB2312"
);
Element
root
=
document
.
addElement
(
"RBSPMessage"
);
root
.
addElement
(
"RequesterID"
).
addText
(
"C410000-BZCJ0001"
);
Element
method
=
root
.
addElement
(
"Method"
);
method
.
addElement
(
"Name"
).
addText
(
"Report"
);
Element
security
=
method
.
addElement
(
"Security"
);
security
.
addElement
(
"Signature"
);
security
.
addElement
(
"Encrypt"
).
addAttribute
(
"Algorithm"
,
""
);
Element
items
=
method
.
addElement
(
"Items"
);
Element
item
=
items
.
addElement
(
"Item"
);
item
.
addElement
(
"Name"
).
addText
(
"SysAlias"
);
item
.
addElement
(
"Value"
).
addAttribute
(
"Type"
,
"string"
).
addElement
(
"Data"
).
addText
(
"DSjwzhxt"
);
Element
item01
=
items
.
addElement
(
"Item"
);
item01
.
addElement
(
"Name"
).
addText
(
"Recorders"
);
Element
value
=
item01
.
addElement
(
"Value"
).
addAttribute
(
"Type"
,
"arrayOfArrayOf_string"
);
//判断一系列的值是否为空
if
(
ifNull
(
ryxx
)){
Element
row
=
value
.
addElement
(
"Row"
).
addAttribute
(
"tablename"
,
"R-AJXYRXX-001"
).
addAttribute
(
"state"
,
"u"
);
Element
data
=
row
.
addElement
(
"Data"
);
if
(!
""
.
equals
(
ryxx
.
getZwbh
())&&
ryxx
.
getZwbh
()!=
null
)
{
data
.
addAttribute
(
"ZWBH"
,
ryxx
.
getZwbh
());
}
if
(!
""
.
equals
(
ryxx
.
getDnabh
())&&
ryxx
.
getDnabh
()!=
null
)
{
data
.
addAttribute
(
"DNABH"
,
ryxx
.
getDnabh
());
}
if
(!
""
.
equals
(
ryxx
.
getZjbh
())&&
ryxx
.
getZjbh
()!=
null
)
{
data
.
addAttribute
(
"XZ_ZJBH"
,
ryxx
.
getZjbh
());
}
if
(!
""
.
equals
(
ryxx
.
getSwbh
())&&
ryxx
.
getSwbh
()!=
null
)
{
data
.
addAttribute
(
"SWBH"
,
ryxx
.
getSwbh
());
}
if
(!
""
.
equals
(
ryxx
.
getSissjhm
())&&
ryxx
.
getSissjhm
()!=
null
)
{
data
.
addAttribute
(
"SISSJBH"
,
ryxx
.
getSissjhm
());
}
if
(!
""
.
equals
(
ryxx
.
getSg
())&&
ryxx
.
getSg
()!=
null
)
{
data
.
addAttribute
(
"SGSX"
,
ryxx
.
getSg
());
}
if
(!
""
.
equals
(
ryxx
.
getTz
())&&
ryxx
.
getTz
()!=
null
)
{
data
.
addAttribute
(
"TZSX"
,
ryxx
.
getTz
());
}
if
(!
""
.
equals
(
ryxx
.
getZc
())&&
ryxx
.
getZc
()!=
null
)
{
data
.
addAttribute
(
"ZCSX"
,
ryxx
.
getZc
());
}
row
.
addElement
(
"SqlWhere"
).
addText
(
"XYRBH ='"
+
ryxx
.
getXyrbh
()+
"'"
);
}
//判断照片信息
if
(
ryxx
.
getZmzpbASE64
()!=
null
||
ryxx
.
getZcmzpbase64
()!=
null
||
ryxx
.
getYcmzmbase64
()!=
null
){
Element
row
=
value
.
addElement
(
"Row"
).
addAttribute
(
"tablename"
,
"R-BZCJ-RXXX-001"
);
//表示插入
if
(
"1"
.
equals
(
ryxx
.
getFlag
())){
row
.
addAttribute
(
"state"
,
"i"
);
}
else
{
//表示更新
row
.
addAttribute
(
"state"
,
"u"
);
}
Element
data
=
row
.
addElement
(
"Data"
).
addAttribute
(
"XYRBH"
,
ryxx
.
getXyrbh
());
//调用警综服务根据单位代码生成住建编号,服务有问题,暂时不能调用
//data.addAttribute("BZCJ_RXBH",analysisKey(queryService.createKey(ryxx.getUnitcode())));
//这个调用函数生成23位的主键编号
data
.
addAttribute
(
"BZCJ_RXBH"
,
CommonFunc
.
getMainSeq
());
if
(!
""
.
equals
(
ryxx
.
getZmzpbASE64
())){
/**zhang_shaohui modify by 2020-07-29
* 这里特别注意,如果服务器是Linux系统,那么在发送照片Base64编码的时候把换行符替换掉。
* 否则在警综服务方收到的照片Base64编码每76个字符后会自动加换行,这样Base64入库之
* 后照片就不能正常显示,经过多次测试才发现的这个问题,很坑,因为测试的时候用的是Windows系统是没有问题的。
*/
if
(
getOsName
().
contains
(
"linux"
)){
data
.
addAttribute
(
"ZP_ZM"
,
ryxx
.
getZmzpbASE64
().
replaceAll
(
"\n"
,
""
));
}
else
{
data
.
addAttribute
(
"ZP_ZM"
,
ryxx
.
getZmzpbASE64
());
}
}
if
(!
""
.
equals
(
ryxx
.
getZcmzpbase64
())){
/**zhang_shaohui modify by 2020-07-29
* 这里特别注意,如果服务器是Linux系统,那么在发送照片Base64编码的时候把换行符替换掉。
* 否则在警综服务方收到的照片Base64编码每76个字符后会自动加换行,这样Base64入库之
* 后照片就不能正常显示,经过多次测试才发现的这个问题,很坑,因为测试的时候用的是Windows系统是没有问题的。
*/
if
(
getOsName
().
contains
(
"linux"
)){
data
.
addAttribute
(
"ZP_ZCM"
,
ryxx
.
getZcmzpbase64
().
replaceAll
(
"\n"
,
""
));
}
else
{
data
.
addAttribute
(
"ZP_ZCM"
,
ryxx
.
getZcmzpbase64
());
}
}
if
(!
""
.
equals
(
ryxx
.
getYcmzmbase64
())){
/**zhang_shaohui modify by 2020-07-29
* 这里特别注意,如果服务器是Linux系统,那么在发送照片Base64编码的时候把换行符替换掉。
* 否则在警综服务方收到的照片Base64编码每76个字符后会自动加换行,这样Base64入库之
* 后照片就不能正常显示,经过多次测试才发现的这个问题,很坑,因为测试的时候用的是Windows系统是没有问题的。
*/
if
(
getOsName
().
contains
(
"linux"
)){
data
.
addAttribute
(
"ZP_YCM"
,
ryxx
.
getYcmzmbase64
().
replaceAll
(
"\n"
,
""
));
}
else
{
data
.
addAttribute
(
"ZP_YCM"
,
ryxx
.
getYcmzmbase64
());
}
}
data
.
addAttribute
(
"RKSJ"
,
new
java
.
text
.
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
java
.
util
.
Date
()));
//表示更新,加更新条件
if
(
"0"
.
equals
(
ryxx
.
getFlag
())){
row
.
addElement
(
"SqlWhere"
).
addText
(
"XYRBH ='"
+
ryxx
.
getXyrbh
()+
"'"
);
}
}
//判断特征信息,目前还没有
String
xml
=
document
.
asXML
();
//System.out.println(xml);
return
document
.
asXML
();
}
public
static
Map
xmlChangeMap
(
String
xml
){
Document
document
;
Map
map
=
null
;
try
{
document
=
DocumentHelper
.
parseText
(
xml
);
Element
root
=
document
.
getRootElement
();
Element
Method
=
root
.
element
(
"Method"
);
Element
Items
=
Method
.
element
(
"Items"
);
Element
Item
=
Items
.
element
(
"Item"
);
Element
Value
=
Item
.
element
(
"Value"
);
List
<
Element
>
dataElement
=
Value
.
elements
();
if
(
dataElement
.
size
()>
1
){
List
<
Element
>
element
=
dataElement
.
get
(
1
).
elements
();
map
=
new
HashMap
();
//for(int i=0;i<element.size();i++){
map
.
put
(
"XYRBH"
,
element
.
get
(
0
).
getTextTrim
());
map
.
put
(
"GMSFHM"
,
element
.
get
(
1
).
getTextTrim
());
map
.
put
(
"CSRQ"
,
element
.
get
(
2
).
getTextTrim
());
map
.
put
(
"XM"
,
element
.
get
(
3
).
getTextTrim
());
map
.
put
(
"BMCH"
,
element
.
get
(
4
).
getTextTrim
());
map
.
put
(
"XB"
,
element
.
get
(
5
).
getTextTrim
());
map
.
put
(
"MZ"
,
element
.
get
(
6
).
getTextTrim
());
map
.
put
(
"JGGJDQ"
,
element
.
get
(
7
).
getTextTrim
());
map
.
put
(
"JGSSQX"
,
element
.
get
(
8
).
getTextTrim
());
map
.
put
(
"ZZMM"
,
element
.
get
(
9
).
getTextTrim
());
map
.
put
(
"WHCD"
,
element
.
get
(
10
).
getTextTrim
());
map
.
put
(
"ZY"
,
element
.
get
(
11
).
getTextTrim
());
map
.
put
(
"FWCS"
,
element
.
get
(
12
).
getTextTrim
());
map
.
put
(
"HJDSSXQ"
,
element
.
get
(
13
).
getTextTrim
());
map
.
put
(
"HJDXZ"
,
element
.
get
(
14
).
getTextTrim
());
map
.
put
(
"XZQH"
,
element
.
get
(
15
).
getTextTrim
());
map
.
put
(
"ZZXZ"
,
element
.
get
(
16
).
getTextTrim
());
map
.
put
(
"ZJZL"
,
element
.
get
(
17
).
getTextTrim
());
map
.
put
(
"ZJHM"
,
element
.
get
(
18
).
getTextTrim
());
map
.
put
(
"LXDH"
,
element
.
get
(
19
).
getTextTrim
());
map
.
put
(
"FWCSLXDH"
,
element
.
get
(
20
).
getTextTrim
());
map
.
put
(
"ZC"
,
element
.
get
(
21
).
getTextTrim
());
map
.
put
(
"BZ"
,
element
.
get
(
22
).
getTextTrim
());
map
.
put
(
"DJDW"
,
element
.
get
(
23
).
getTextTrim
());
map
.
put
(
"DJR"
,
element
.
get
(
24
).
getTextTrim
());
map
.
put
(
"DJRQ"
,
element
.
get
(
25
).
getTextTrim
());
map
.
put
(
"SJJZDXZ"
,
element
.
get
(
26
).
getTextTrim
());
}
// }
//System.out.println(key);
}
catch
(
DocumentException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
map
;
}
/**
*
* <P>Title: ifNull </P>
* <P>Description:判断是否为空</P>
* <P>param 参数类型Jzryxx ryxx </P>
* <P>return 返回类型boolean</P>
* <P>throws抛出异常</P>
*/
public
static
boolean
ifNull
(
Jzryxx
ryxx
){
boolean
b
=
false
;
if
(!
""
.
equals
(
ryxx
.
getZwbh
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getDnabh
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getZjbh
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getSwbh
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getSissjhm
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getSg
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getTz
())){
b
=
true
;
}
else
if
(!
""
.
equals
(
ryxx
.
getZc
())){
b
=
true
;
}
return
b
;
}
/**
* <P>Title: getOsName </P>
* <P>Description:获取操作系统名称</P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
static
String
getOsName
(){
String
osName
=
""
;
osName
=
System
.
getProperty
(
"os.name"
).
toLowerCase
();
return
osName
;
}
public
static
void
main
(
String
ss
[]){
//analysisKey("<?xml version=\"1.0\" encoding=\"GB2312\"?><CKRequest> <RequesterID>C00-00000000</RequesterID> <Method><Name>CreateGiapPrimaryKey</Name><Security><Signature/><Encrypt Algorithm=\"\"/> </Security> <Items> <Item> <Error> <Flag>False</Flag> <ErrID/> <Msg/> </Error> </Item> <Item> <Row> <Data>6101035300002009090000001</Data> </Row> </Item> </Items> </Method></CKRequest>");
//createKry("150000000000");
QueryService
QueryService
=
new
QueryService
();
//R1506276520002020075005
System
.
out
.
println
(
ServiceUtil
.
xmlChangeMap
(
QueryService
.
QueryPersonByRybh
(
"R1506226500002020075032"
)));
//RyRycj ry=new RyRycj();
if
(
getOsName
().
contains
(
"windows"
)){
System
.
out
.
println
(
getOsName
());
}
}
}
src/main/java/com/founder/utils/QueryService.java
0 → 100644
View file @
f5c702d6
package
com
.
founder
.
utils
;
import
com.founder.model.Jzryxx
;
import
com.founder.util.ServiceUtil
;
import
org.apache.axis.client.Call
;
import
org.apache.axis.client.Service
;
import
javax.xml.namespace.QName
;
import
javax.xml.rpc.ParameterMode
;
import
javax.xml.rpc.ServiceException
;
import
javax.xml.rpc.encoding.XMLType
;
import
java.rmi.RemoteException
;
/**
* <P>Copyright: Founder Copyright (c) 2020</P>
* <P>Description:Axis调用内蒙古新警综人员查询服务</P>
* <P>Company: Founder</P>
* <P>Author yangliang</P>
* <P>E-mail:yangliang.hl@founder.com.com</P>
* <P>Careate: 2021-01-04 上午11:36:25</P>
* <P>Version 1.0</P>
* TODO :
*/
public
class
QueryService
{
PropertiesUtil
propertiesUtil
=
new
PropertiesUtil
(
"application.properties"
);
//定义请求方已授权ID
static
String
senderID
=
"C410000-BZCJ0001"
;
//定义授权对象
static
String
dataObjectCode
=
"R-BZCJ-XYRXX-001"
;
//警综接口URL
String
url
=
propertiesUtil
.
getValue
(
"nmjz_interfaceurl"
);
/**
*
* <P>Title: callService </P>
* <P>Description:调用警综webservice接口</P>
* <P>param 参数类型@param xml
* <P>param 参数类型@param interfaceMethod
* <P>param 参数类型@return </P>
* <P>return 返回类型String</P>
* <P>throws抛出异常</P>
*/
public
String
callService
(
String
xml
,
String
interfaceMethod
){
//定义接口
Service
service
=
null
;
Call
call
=
null
;
service
=
new
Service
();
String
result
=
""
;
//创建调用接口的XML
try
{
call
=
(
Call
)
service
.
createCall
();
//设置WebService接口路径
call
.
setTargetEndpointAddress
(
url
);
//设置WebService接口调用方法
call
.
setOperationName
(
new
QName
(
interfaceMethod
));
//设置WebService接口调用方法对应参数类型
call
.
addParameter
(
"arg0"
,
XMLType
.
XSD_STRING
,
ParameterMode
.
IN
);
call
.
setUseSOAPAction
(
true
);
//设置WebService接口方法的返回值类型
call
.
setReturnType
(
XMLType
.
XSD_STRING
);
result
=(
String
)
call
.
invoke
(
new
Object
[]{
xml
});
System
.
out
.
println
(
"打印结果警综返回:"
+
result
);
}
catch
(
ServiceException
e
)
{
e
.
printStackTrace
();
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
public
String
QueryPersonByRybh
(
String
rybh
)
{
//定义查询条件condition
String
condition
=
"XYRBH='"
+
rybh
+
"'"
;
//定义接口对应方法
String
interfaceMethod
=
"QueryService"
;
String
dataObjectCode
=
"R-BZCJ-XYRXX-001"
;
//定义接口查询参数xml
String
paraXml
=
ServiceUtil
.
createXmlQureyPerson
(
condition
,
dataObjectCode
);
String
result
=
callService
(
paraXml
,
interfaceMethod
);
return
result
;
}
public
String
createKey
(
String
unitCode
)
{
//定义接口对应方法
String
interfaceMethod
=
"CreateGiapPrimaryKey"
;
//定义接口查询参数xml
String
paraXml
=
ServiceUtil
.
createKeyXml
(
unitCode
);
String
result
=
callService
(
paraXml
,
interfaceMethod
);
return
result
;
}
public
String
ReportSrevice
(
Jzryxx
ryxx
){
String
returnxml
=
""
;
if
(
""
.
equals
(
ryxx
.
getXyrbh
())||
ryxx
.
getXyrbh
()==
null
){
return
""
;
}
//returnxml =ZipUtils.compress(ServiceUtil.createXmlReport(ryxx));
returnxml
=
ServiceUtil
.
createXmlReport
(
ryxx
);
returnxml
=
callService
(
returnxml
,
"ReportService"
);
return
""
;
}
public
static
void
main
(
String
ss
[]){
QueryService
qs
=
new
QueryService
();
qs
.
QueryPersonByRybh
(
"50515050202201204000002"
);
//CommonFunc comm=new CommonFunc();
//System.out.println(comm.getMainSeq());
}
}
src/main/resources/application.properties
View file @
f5c702d6
...
...
@@ -17,3 +17,5 @@ zwbzurl4602=http://172.18.117.11:8081/szxc/result/ltHit
zwccurl
=
http://172.18.117.11:8081/szxc/result/ttHit
qganurl
=
http://zhyy.xzxt.nm/getGabZyInfoByJyaqMatj.action
#qgzturl=http://localhost:7001/getZtryDetailByZjhm.action?zjhm=
#内蒙古新警综WebService接口地址
nmjz_interfaceurl
=
http://26.169.99.50:9086/tcwebservice/services/ServiceImpl?wsdl
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