Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dxzpService
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
曹崟
dxzpService
Commits
e386940b
Commit
e386940b
authored
Jul 31, 2019
by
吴善钰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网侦预警,添加接收时间查询条件,调整导出功能
parent
19738905
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
255 additions
and
16 deletions
+255
-16
src/main/java/com/founder/model/TbStDxzp.java
+20
-0
src/main/java/com/founder/util/ExportExcelUtil.java
+144
-0
src/main/java/com/founder/wzyj/controller/WzyjController.java
+5
-5
src/main/java/com/founder/wzyj/dao/WzyjDao.java
+2
-0
src/main/java/com/founder/wzyj/service/IWzyjService.java
+3
-0
src/main/java/com/founder/wzyj/service/impl/WzyjServiceImpl.java
+11
-0
src/main/resources/mapper/WzyjMapper.xml
+35
-1
src/main/resources/static/js/wzyj.js
+17
-9
src/main/webapp/WEB-INF/jsp/wzyj/wzyjList.jsp
+18
-1
No files found.
src/main/java/com/founder/model/TbStDxzp.java
View file @
e386940b
...
...
@@ -61,6 +61,10 @@ public class TbStDxzp extends BaseModel {
private
String
sfxyzcyj
;
//是否需要再次预警
private
String
jssjStart
;
//接收时间开始时间(查询条件)
private
String
jssjEnd
;
//接收时间结束时间(查询条件)
//分页查询用
//查询分页开始结束
protected
Integer
begin
=
null
;
...
...
@@ -301,4 +305,20 @@ public class TbStDxzp extends BaseModel {
public
void
setSfxyzcyj
(
String
sfxyzcyj
)
{
this
.
sfxyzcyj
=
sfxyzcyj
;
}
public
String
getJssjStart
()
{
return
jssjStart
;
}
public
void
setJssjStart
(
String
jssjStart
)
{
this
.
jssjStart
=
jssjStart
;
}
public
String
getJssjEnd
()
{
return
jssjEnd
;
}
public
void
setJssjEnd
(
String
jssjEnd
)
{
this
.
jssjEnd
=
jssjEnd
;
}
}
src/main/java/com/founder/util/ExportExcelUtil.java
0 → 100644
View file @
e386940b
package
com
.
founder
.
util
;
import
org.apache.poi.hssf.usermodel.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 导出Excel工具类 luoqihao 2018/10/11
* title 表名
* headersName 使用数组封装excel列名
* headersId 使用数组封装对应列名需要展示的列的属性名 (二者需要一一对应,顺序不能打乱)
* dtoList 对象结果集
* */
public
class
ExportExcelUtil
<
T
>
{
@SuppressWarnings
(
"deprecation"
)
public
void
exportExcel
(
String
title
,
String
[]
headersName
,
String
[]
headersId
,
List
<
T
>
dtoList
,
HttpServletResponse
response
)
throws
Exception
{
Map
<
Integer
,
String
>
headersNameMap
=
new
HashMap
<>();
int
key
=
0
;
for
(
int
i
=
0
;
i
<
headersName
.
length
;
i
++)
{
if
(!
headersName
[
i
].
equals
(
null
))
{
headersNameMap
.
put
(
key
,
headersName
[
i
]);
key
++;
}
}
Map
<
Integer
,
String
>
titleFieldMap
=
new
HashMap
<>();
int
value
=
0
;
for
(
int
i
=
0
;
i
<
headersId
.
length
;
i
++)
{
if
(!
headersId
[
i
].
equals
(
null
))
{
titleFieldMap
.
put
(
value
,
headersId
[
i
]);
value
++;
}
}
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
HSSFSheet
sheet
=
wb
.
createSheet
(
title
);
sheet
.
setDefaultColumnWidth
((
short
)
15
);
// 生成一个样式
HSSFCellStyle
style
=
wb
.
createCellStyle
();
HSSFRow
row
=
sheet
.
createRow
(
0
);
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
HSSFCell
cell
;
Collection
<
String
>
c
=
headersNameMap
.
values
();
// 拿到表格所有标题的value的集合
Iterator
<
String
>
it
=
c
.
iterator
();
// 表格标题的迭代器
// 根据选择的字段生成表头
short
size
=
0
;
while
(
it
.
hasNext
())
{
cell
=
row
.
createCell
(
size
);
cell
.
setCellValue
(
it
.
next
().
toString
());
cell
.
setCellStyle
(
style
);
size
++;
}
Collection
<
String
>
zdC
=
titleFieldMap
.
values
();
Iterator
<
T
>
labIt
=
new
ArrayList
<
T
>().
iterator
();
if
(
dtoList
!=
null
)
{
labIt
=
dtoList
.
iterator
();
}
int
zdRow
=
0
;
while
(
labIt
.
hasNext
())
{
// 记录的迭代器,遍历总记录
int
zdCell
=
0
;
zdRow
++;
row
=
sheet
.
createRow
(
zdRow
);
T
l
=
(
T
)
labIt
.
next
();
List
<
Field
>
fields
=
new
ArrayList
<>();
Class
<?>
tempClass
=
l
.
getClass
();
while
(
tempClass
!=
null
)
{
fields
.
addAll
(
Arrays
.
asList
(
tempClass
.
getDeclaredFields
()));
tempClass
=
tempClass
.
getSuperclass
();
}
Iterator
<
String
>
zdIt
=
zdC
.
iterator
();
while
(
zdIt
.
hasNext
())
{
// 遍历要导出的字段集合
String
next
=
zdIt
.
next
();
for
(
short
i
=
0
;
i
<
fields
.
size
();
i
++)
{
// 遍历属性,比对
Field
field
=
fields
.
get
(
i
);
String
fieldName
=
field
.
getName
();
// 属性名
if
(
next
.
equals
(
fieldName
))
{
String
getMethodName
=
"get"
+
fieldName
.
substring
(
0
,
1
).
toUpperCase
()
+
fieldName
.
substring
(
1
);
// 拿到属性的get方法
try
{
Class
<?>
cls
=
l
.
getClass
();
Method
getMethod
=
cls
.
getMethod
(
getMethodName
,
new
Class
[]
{});
Object
val
=
getMethod
.
invoke
(
l
,
new
Object
[]
{});
String
textVal
=
null
;
if
(
val
!=
null
)
{
// 如果是double类型则只保留两位小说
if
(
field
.
getGenericType
().
toString
()
.
equals
(
"double"
)
||
field
.
getGenericType
().
toString
()
.
equals
(
"Double"
))
{
DecimalFormat
df
=
new
DecimalFormat
(
"#0.00"
);
String
format
=
df
.
format
(
val
);
textVal
=
String
.
valueOf
(
format
);
}
else
{
textVal
=
String
.
valueOf
(
val
);
// 转化成String
}
}
else
{
textVal
=
null
;
}
row
.
createCell
((
short
)
zdCell
)
.
setCellValue
(
textVal
);
zdCell
++;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
OutputStream
out
=
response
.
getOutputStream
();
try
{
response
.
setContentType
(
"application/x-download"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;fileName="
+
new
String
(
title
.
getBytes
(
"gbk"
),
"iso8859-1"
)
+
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
())
+
".xls"
);
wb
.
write
(
out
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
out
!=
null
)
{
try
{
out
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
src/main/java/com/founder/wzyj/controller/WzyjController.java
View file @
e386940b
...
...
@@ -101,7 +101,7 @@ public class WzyjController {
//获取操作人信息
User
user
=
(
User
)
request
.
getSession
().
getAttribute
(
"user"
);
if
(
null
!=
user
){
tbStDxzp
.
setXxczr
y
Xm
(
user
.
getTrueName
());
tbStDxzp
.
setXxczrXm
(
user
.
getTrueName
());
tbStDxzp
.
setXxczrDw
(
user
.
getUnitcode
());
tbStDxzp
.
setXxczrJh
(
user
.
getPolicemanid
());
}
...
...
@@ -127,15 +127,15 @@ public class WzyjController {
*/
@RequestMapping
(
"/exportWzyjExcel"
)
@ResponseBody
public
void
exportWzyjExcel
(
HttpServletResponse
response
,
TbStDxzp
tbStDxzp
)
throws
Exception
{
public
void
exportWzyjExcel
(
TbStDxzp
tbStDxzp
,
HttpServletResponse
response
)
throws
Exception
{
//查询网综预警数据
List
<
TbStDxzp
>
list
=
wzyjService
.
toQueryWzyj
List
(
tbStDxzp
);
List
<
TbStDxzp
>
list
=
wzyjService
.
exportWzyjExcel
List
(
tbStDxzp
);
//创建对象
ExportExcelUtil
<
TbStDxzp
>
exportExcelUtil
=
new
ExportExcelUtil
<>();
//设置表格表头
String
[]
headersName
=
{
"
标识号"
,
"标识号类型"
,
"类型"
,
"号码"
,
"姓名"
,
"性别"
,
"出生日期
"
};
String
[]
headersName
=
{
"
接收时间"
,
"诈骗方微信账号"
,
"被骗方微信账号"
,
"被骗方qq"
,
"被骗方手机号码"
,
"预警强度"
,
"付款金额"
,
"诈骗类型"
,
"已预警次数"
,
"最后活动地
"
};
//添加对应的属性
String
[]
headersField
=
{
"
objectValue"
,
"objectTypeName"
,
"zjlx"
,
"zjhm"
,
"name"
,
"sex"
,
"birthday
"
};
String
[]
headersField
=
{
"
jssj"
,
"zpfWxid"
,
"bpfWxid"
,
"bpfQq"
,
"bpfSjhm"
,
"yjqd"
,
"fkje"
,
"zplx"
,
"yyjcs"
,
"zhhdd
"
};
//获取并下载相应的表格
exportExcelUtil
.
exportExcel
(
"网综预警统计表"
,
headersName
,
headersField
,
list
,
response
);
}
...
...
src/main/java/com/founder/wzyj/dao/WzyjDao.java
View file @
e386940b
...
...
@@ -22,4 +22,6 @@ public interface WzyjDao {
Integer
savewzyj
(
TbStDxzp
tbStDxzp
);
Integer
updateCzzt
(
String
id
);
List
<
TbStDxzp
>
exportWzyjExcelList
(
TbStDxzp
tbStDxzp
);
}
src/main/java/com/founder/wzyj/service/IWzyjService.java
View file @
e386940b
...
...
@@ -23,4 +23,7 @@ public interface IWzyjService {
//修改处置状态
boolean
updateCzzt
(
String
id
);
//导出excel数据
List
<
TbStDxzp
>
exportWzyjExcelList
(
TbStDxzp
tbStDxzp
);
}
src/main/java/com/founder/wzyj/service/impl/WzyjServiceImpl.java
View file @
e386940b
...
...
@@ -79,4 +79,15 @@ public class WzyjServiceImpl implements IWzyjService {
return
result
;
}
@Override
public
List
<
TbStDxzp
>
exportWzyjExcelList
(
TbStDxzp
tbStDxzp
)
{
List
<
TbStDxzp
>
tbStDxzps
=
null
;
try
{
tbStDxzps
=
wzyjDao
.
exportWzyjExcelList
(
tbStDxzp
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
"查询网综预警信息详情失败"
+
e
);
}
return
tbStDxzps
;
}
}
src/main/resources/mapper/WzyjMapper.xml
View file @
e386940b
...
...
@@ -28,7 +28,7 @@
to_char(JSSJ, 'yyyy-MM-dd') as jssj
from TB_ST_DXZP where XXSC_PDBZ = '0'
<include
refid=
"wzyj-public-where"
/>
ORDER BY
gxsj desc nulls last,JSSJ DESC,YJQD DESC,RKSJ
DESC) t
ORDER BY
JSSJ DESC,id,YJQD
DESC) t
WHERE ROWNUM
<![CDATA[<=]]>
#{end}
) WHERE RN > #{begin}
</select>
...
...
@@ -142,5 +142,38 @@
<if
test=
"zplx!=null and zplx!=''"
>
and ZPLX like '%' || #{zplx} || '%'
</if>
<if
test=
"fkje!=null and fkje!=''"
>
and FKJE=#{fkje}
</if>
<if
test=
"zhhdd!=null and zhhdd!=''"
>
and zhhdd like '%' || #{zhhdd} || '%'
</if>
<if
test=
"jssjStart!=null and jssjStart!=''"
>
and jssj
<![CDATA[>=]]>
to_date(#{jssjStart},'yyyy-mm-dd')
</if>
<if
test=
"jssjEnd!=null and jssjEnd!=''"
>
and jssj
<![CDATA[<]]>
(to_date(#{jssjEnd},'yyyy-mm-dd') +1)
</if>
</sql>
<!-- 导出excel预警数据list-->
<select
id=
"exportWzyjExcelList"
parameterType=
"com.founder.model.TbStDxzp"
resultType=
"com.founder.model.TbStDxzp"
>
select ID AS id,
CZZT czzt,
ZPF_WXID zpfWxid,
ZPF_QQ zpfQq,
ZPF_SJHM zpfSjhm,
BPF_WXID bpfWxid,
BPF_SJHM bpfSjhm,
BPF_QQ bpfQq,
YJQD yjqd,
ZPLX zplx,
FKJE fkje,
YYJCS yyjcs,
ZHHDD zhhdd,
SPR_SFCR sprSfcr,
SPR_SFFK sprSffk,
SPR_SFBA sprSfba,
SFGZRHJCPJ sfgzrhjcpj,
SFXYZCYJ sfxyzcyj,
to_char(JSSJ, 'yyyy-MM-dd') as jssj
from TB_ST_DXZP where XXSC_PDBZ = '0'
<include
refid=
"wzyj-public-where"
/>
ORDER BY JSSJ DESC,id,YJQD DESC
</select>
</mapper>
\ No newline at end of file
src/main/resources/static/js/wzyj.js
View file @
e386940b
...
...
@@ -114,13 +114,21 @@ function serializeObject(form) {
//清空
function
doClear
()
{
//清空textbox中所有值
$
(
"#zpfWxid"
).
textbox
(
'setValue'
,
""
)
$
(
"#zpfQq"
).
textbox
(
'setValue'
,
""
)
$
(
"#zpfSjhm"
).
textbox
(
'setValue'
,
""
)
$
(
"#bpfWxid"
).
textbox
(
'setValue'
,
""
)
$
(
"#bpfQq"
).
textbox
(
'setValue'
,
""
)
$
(
"#bpfSjhm"
).
textbox
(
'setValue'
,
""
)
$
(
"#zplx"
).
textbox
(
'setValue'
,
""
)
$
(
"#fkje"
).
textbox
(
'setValue'
,
""
)
$
(
"#zhhdd"
).
textbox
(
'setValue'
,
""
)
$
(
"form input[type=text]:visible,form input[class='textbox-value']"
).
val
(
""
);
}
/**
* 按搜多条件导出
*/
function
exportWzyjExcel
(){
// jAlert("您可以输入相应的查询条件,将会按照查询条件进行导出;条件为空时则全部导出!","友情提示");
var
params
=
serializeObject
(
$
(
"form[name='wzyjForm']"
));
console
.
log
(
serializeObject
(
$
(
"form[name='wzyjForm']"
)));
$
.
messager
.
confirm
(
'确认'
,
"确定导出excel附件吗?"
,
function
(
r
)
{
if
(
r
)
{
window
.
open
(
"/exportWzyjExcel?zpfWxid="
+
params
.
zpfWxid
+
"&zpfQq="
+
params
.
zpfQq
+
"&zpfSjhm="
+
params
.
zpfSjhm
+
"&bpfWxid="
+
params
.
bpfWxid
+
"&bpfQq="
+
params
.
bpfQq
+
"&bpfSjhm="
+
params
.
bpfSjhm
+
"&fkje="
+
params
.
fkje
+
"&zplx="
+
params
.
zplx
+
"&zhhdd="
+
params
.
zhhdd
+
"&jssjStart="
+
params
.
jssjStart
+
"&jssjEnd="
+
params
.
jssjEnd
+
"&czzt="
+
params
.
czzt
);
}
});
}
src/main/webapp/WEB-INF/jsp/wzyj/wzyjList.jsp
View file @
e386940b
...
...
@@ -107,6 +107,22 @@
<input
class=
"easyui-textbox"
type=
"text"
style=
"height:26px;width:184px;"
name=
"zhhdd"
id=
"zhhdd"
>
</tr>
<tr>
<td
class=
"ar"
width=
"13.3%"
>
接收时间:
</td>
<td
width=
"20%"
>
<input
type=
"text"
name=
"jssjStart"
id=
"jssjStart"
class=
"form-control Wdate"
style=
"width:184px; height:26px;"
onfocus=
"WdatePicker({dateFmt:'yyyy-MM-dd'})"
>
</td>
<td
class=
"ar"
width=
"13.3%"
>
至:
</td>
<td
width=
"20%"
>
<input
type=
"text"
name=
"jssjEnd"
id=
"jssjEnd"
class=
"form-control Wdate"
style=
"width:184px; height:26px;"
onfocus=
"WdatePicker({dateFmt:'yyyy-MM-dd'})"
>
</td>
</tr>
<tr>
<td
class=
"ar"
width=
"13.3%"
>
处置状态:
</td>
<td
width=
"20%"
>
<input
type=
"radio"
style=
"margin: 0px;"
name=
"czzt"
id=
"jqyx_y"
value=
"0"
checked=
"checked"
onclick=
"doQuery()"
><label
for=
"jqyx_y"
style=
'cursor:pointer;background:none;padding-top: 4px;'
>
未处置
</label></input>
...
...
@@ -117,7 +133,8 @@
<td
style=
"text-align:center;line-height:18px;"
colspan=
"6"
>
<a
class=
"btn_cx"
onclick=
"doQuery()"
>
查询
</a>
<a
class=
"btn_qk"
onclick=
"doClear()"
>
清空
</a>
<a
href=
"javascript:;"
class=
"btn_export"
onclick=
"$('#wzyjtable').datagrid('toExcel','wzyj.xls')"
>
导出Excel
</a>
<a
href=
"javascript:;"
class=
"btn_export"
onclick=
"exportWzyjExcel()"
>
导出Excel
</a>
<
%
--
<
a
href=
"javascript:;"
class=
"btn_export"
onclick=
"$('#wzyjtable').datagrid('toExcel','wzyj.xls')"
>
导出Excel
</a>
--%>
</td>
</tr>
</tbody>
...
...
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