Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YX_IDENT_beijing_auxiliary_YD
Project
Project
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
zhangyusheng
YX_IDENT_beijing_auxiliary_YD
Commits
7fd4b2db
Commit
7fd4b2db
authored
Mar 13, 2019
by
suichenguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
e7da1068
7c87b287
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
4 deletions
+95
-4
ExportExcelApi.java
src/main/java/com/yxproject/start/api/ExportExcelApi.java
+5
-3
ReceiptMapper.java
src/main/java/com/yxproject/start/mapper/ReceiptMapper.java
+10
-1
ReceiptService.java
...main/java/com/yxproject/start/service/ReceiptService.java
+2
-0
ReceiptServiceImpl.java
.../com/yxproject/start/service/impl/ReceiptServiceImpl.java
+13
-0
ExportExcel.java
src/main/java/com/yxproject/start/utils/ExportExcel.java
+65
-0
No files found.
src/main/java/com/yxproject/start/api/ExportExcelApi.java
View file @
7fd4b2db
...
@@ -63,9 +63,11 @@ public class ExportExcelApi {
...
@@ -63,9 +63,11 @@ public class ExportExcelApi {
@RequestMapping
(
"printReceiptExcelData"
)
@RequestMapping
(
"printReceiptExcelData"
)
public
byte
[]
printReceiptExcelData
(
@RequestBody
String
list
,
HttpServletResponse
response
){
public
byte
[]
printReceiptExcelData
(
@RequestBody
String
list
,
HttpServletResponse
response
){
JSONObject
jsonObject
=
JSONObject
.
fromObject
(
list
);
JSONObject
jsonObject
=
JSONObject
.
fromObject
(
list
);
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
jsonObject
);
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
jsonObject
.
get
(
"list"
));
// List<Map<String, Object>> mapList = receiptService.;
String
date
=
jsonObject
.
get
(
"date"
).
toString
();
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
String
type
=
jsonObject
.
get
(
"type"
).
toString
();
List
<
Map
<
String
,
Object
>>
mapList
=
receiptService
.
selectReceiptList
(
jsonArray
,
replaceDate
(
date
),
Long
.
valueOf
(
type
));
// List<Map<String, Object>> mapList = new ArrayList<>();
response
.
setContentType
(
"application/x-download"
);
response
.
setContentType
(
"application/x-download"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
String
dateTime
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
String
dateTime
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
...
...
src/main/java/com/yxproject/start/mapper/ReceiptMapper.java
View file @
7fd4b2db
...
@@ -131,12 +131,21 @@ public interface ReceiptMapper {
...
@@ -131,12 +131,21 @@ public interface ReceiptMapper {
@Select
(
"select RECEIPT_LIST.id,RECEIPT_LIST.QR_CODE,RECEIPT_LIST.RECEIPT_DATE,RECEIPT_LIST.POLICE_CODE,decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID) CARD_TYPE_ID,\n"
+
@Select
(
"select RECEIPT_LIST.id,RECEIPT_LIST.QR_CODE,RECEIPT_LIST.RECEIPT_DATE,RECEIPT_LIST.POLICE_CODE,decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID) CARD_TYPE_ID,\n"
+
"RECEIPT_LIST.FINISH_COUNT,GAJG_DM.GAJG_DM,GAJG_DM.GAJG_MC,RECEIPT_LIST.CHECK_DATE,RECEIPT_LIST.CHECK_NAME\n"
+
"RECEIPT_LIST.FINISH_COUNT,GAJG_DM.GAJG_DM,GAJG_DM.GAJG_MC,RECEIPT_LIST.CHECK_DATE,RECEIPT_LIST.CHECK_NAME\n"
+
",CARD_TYPE_DIC.CARD_TYPE,COUNTY_DIC.COUNTY_CODE ,COUNTY_DIC.COUNTYNAME from RECEIPT_LIST \n"
+
",CARD_TYPE_DIC.CARD_TYPE,COUNTY_DIC.COUNTY_CODE ,COUNTY_DIC.COUNTYNAME from RECEIPT_LIST \n"
+
"left join CARD_TYPE_DIC
on CARD_TYPE_DIC.CARD_TYPE_ID = decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID)\n"
+
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID)\n"
+
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n"
+
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n"
+
"left join COUNTY_DIC on substr(RECEIPT_LIST.POLICE_CODE,0,6) = COUNTY_DIC.COUNTY_CODE"
+
"left join COUNTY_DIC on substr(RECEIPT_LIST.POLICE_CODE,0,6) = COUNTY_DIC.COUNTY_CODE"
+
" where to_char(CHECK_DATE,'yyyyMMdd') = #{date}"
)
" where to_char(CHECK_DATE,'yyyyMMdd') = #{date}"
)
public
List
<
Map
<
String
,
Object
>>
selectReceiptDateByCheckDate
(
@Param
(
"date"
)
String
date
);
public
List
<
Map
<
String
,
Object
>>
selectReceiptDateByCheckDate
(
@Param
(
"date"
)
String
date
);
@Select
(
"select RECEIPT_LIST.id,RECEIPT_LIST.QR_CODE,RECEIPT_LIST.RECEIPT_DATE,RECEIPT_LIST.POLICE_CODE,decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID) CARD_TYPE_ID,\n"
+
"RECEIPT_LIST.FINISH_COUNT,GAJG_DM.GAJG_DM,GAJG_DM.GAJG_MC,RECEIPT_LIST.CHECK_DATE,RECEIPT_LIST.CHECK_NAME\n"
+
",CARD_TYPE_DIC.CARD_TYPE,COUNTY_DIC.COUNTY_CODE ,COUNTY_DIC.COUNTYNAME from RECEIPT_LIST \n"
+
"left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = decode(RECEIPT_LIST.Old_CARD_TYPE_ID,null,RECEIPT_LIST.CARD_TYPE_ID,RECEIPT_LIST.Old_CARD_TYPE_ID)\n"
+
"left join GAJG_DM on GAJG_DM.GAJG_DM = RECEIPT_LIST.POLICE_CODE\n"
+
"left join COUNTY_DIC on substr(RECEIPT_LIST.POLICE_CODE,0,6) = COUNTY_DIC.COUNTY_CODE"
+
" where to_char(CHECK_DATE,'yyyyMMdd') = #{date} and RECEIPT_LIST.id in (string) and CARD_TYPE_DIC.CARD_TYPE_ID=#{type} "
)
public
List
<
Map
<
String
,
Object
>>
selectReceiptDate
(
@Param
(
"date"
)
String
date
,
@Param
(
"string"
)
String
string
,
@Param
(
"type"
)
long
type
);
@Select
(
"select * from DETAIL_RECEIPT_LIST where ACCEPT_NO=#{acceptNo} or card_id=#{acceptNo}"
)
@Select
(
"select * from DETAIL_RECEIPT_LIST where ACCEPT_NO=#{acceptNo} or card_id=#{acceptNo}"
)
public
DetailReceiptListEntity
selectDetailByAcceptNo
(
@Param
(
"acceptNo"
)
String
acceptNo
);
public
DetailReceiptListEntity
selectDetailByAcceptNo
(
@Param
(
"acceptNo"
)
String
acceptNo
);
...
...
src/main/java/com/yxproject/start/service/ReceiptService.java
View file @
7fd4b2db
...
@@ -62,4 +62,6 @@ public interface ReceiptService {
...
@@ -62,4 +62,6 @@ public interface ReceiptService {
public
boolean
updateDetail
(
@Param
(
"acceptNo"
)
String
accept
,
@Param
(
"note"
)
String
note
);
public
boolean
updateDetail
(
@Param
(
"acceptNo"
)
String
accept
,
@Param
(
"note"
)
String
note
);
public
List
<
Map
<
String
,
Object
>>
selectReceiptList
(
List
<
String
>
stringList
,
String
date
,
long
typeCode
);
}
}
src/main/java/com/yxproject/start/service/impl/ReceiptServiceImpl.java
View file @
7fd4b2db
...
@@ -153,6 +153,19 @@ public class ReceiptServiceImpl implements ReceiptService {
...
@@ -153,6 +153,19 @@ public class ReceiptServiceImpl implements ReceiptService {
return
mapList1
;
return
mapList1
;
}
}
@Override
public
List
<
Map
<
String
,
Object
>>
selectReceiptList
(
List
<
String
>
stringList
,
String
date
,
long
typeCode
)
{
String
str
=
null
;
for
(
int
i
=
0
;
i
<
stringList
.
size
();
i
++){
if
(
i
!=
stringList
.
size
()-
1
){
str
+=
stringList
.
get
(
i
);
}
else
{
str
+=
stringList
.
get
(
i
)+
","
;
}
}
return
receiptMapper
.
selectReceiptDate
(
date
,
str
,
typeCode
);
}
private
List
<
Map
<
String
,
Object
>>
formateMap
(
List
<
Map
<
String
,
Object
>>
maplist
)
{
private
List
<
Map
<
String
,
Object
>>
formateMap
(
List
<
Map
<
String
,
Object
>>
maplist
)
{
Map
<
String
,
Object
>
typeMap
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
typeMap
=
new
LinkedHashMap
<>();
...
...
src/main/java/com/yxproject/start/utils/ExportExcel.java
View file @
7fd4b2db
...
@@ -120,4 +120,69 @@ public class ExportExcel {
...
@@ -120,4 +120,69 @@ public class ExportExcel {
}
}
/**
* 导出交接单信息
* @param mapList 交接单信息
* @return
*/
public
static
String
exportReceiptExcelDate
(
List
<
Map
<
String
,
Object
>>
mapList
){
//第一步创建workbook
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
HSSFSheet
sheet
=
wb
.
createSheet
(
"交接单信息表"
);
sheet
.
setColumnWidth
(
0
,
30
*
110
);
sheet
.
setColumnWidth
(
1
,
30
*
110
);
sheet
.
setColumnWidth
(
2
,
30
*
110
);
sheet
.
setColumnWidth
(
3
,
30
*
110
);
sheet
.
setColumnWidth
(
4
,
30
*
110
);
//第三步创建行row:添加表头0行
HSSFRow
row
=
sheet
.
createRow
(
0
);
HSSFCellStyle
style
=
wb
.
createCellStyle
();
//样式
style
.
setWrapText
(
true
);
//设置自动换行
HSSFFont
font
=
wb
.
createFont
();
font
.
setFontHeightInPoints
((
short
)
12
);
style
.
setFont
(
font
);
row
=
sheet
.
createRow
(
0
);
//创建下标为0的单元格
row
.
setHeightInPoints
(
Short
.
parseShort
(
"20"
));
//设置行高
HSSFCell
cell
=
row
.
createCell
(
0
);
//设定值
cell
.
setCellValue
(
"序号"
);
cell
=
row
.
createCell
(
1
);
//设定值
cell
.
setCellValue
(
"身份证受理组号"
);
cell
=
row
.
createCell
(
2
);
//设定值
cell
.
setCellValue
(
"身份证所属派出所"
);
cell
=
row
.
createCell
(
3
);
//设定值
cell
.
setCellValue
(
"数量"
);
cell
=
row
.
createCell
(
4
);
//设定值
cell
.
setCellValue
(
"备注"
);
for
(
int
i
=
0
;
i
<
mapList
.
size
();
i
++){
row
=
sheet
.
createRow
(
i
+
1
);
cell
=
row
.
createCell
(
0
);
//设定值
cell
.
setCellValue
((
i
+
1
)+
""
);
cell
=
row
.
createCell
(
1
);
//设定值
cell
.
setCellValue
(
"null"
.
equals
(
mapList
.
get
(
i
).
get
(
"QR_CODE"
)+
""
)?
""
:
mapList
.
get
(
i
).
get
(
"QR_CODE"
)+
""
);
cell
=
row
.
createCell
(
2
);
//设定值
cell
.
setCellValue
(
"null"
.
equals
(
mapList
.
get
(
i
).
get
(
"GAJG_MC"
)+
""
)?
""
:
mapList
.
get
(
i
).
get
(
"GAJG_MC"
)+
""
);
cell
=
row
.
createCell
(
3
);
//设定值
cell
.
setCellValue
(
"null"
.
equals
(
mapList
.
get
(
i
).
get
(
"FINISH_COUNT"
)+
""
)?
""
:
mapList
.
get
(
i
).
get
(
"FINISH_COUNT"
)+
""
);
cell
=
row
.
createCell
(
4
);
//设定值
cell
.
setCellValue
(
""
);
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream
fout
=
null
;
try
{
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout
=
new
FileOutputStream
(
"D:\\Excel\\"
+
simpleDateFormat
.
format
(
new
Date
())+
"公安网信息表"
+
".xls"
);
wb
.
write
(
fout
);
fout
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
"Excel文件生成成功..."
+
new
Date
());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return
"D:\\Excel\\"
+
simpleDateFormat
.
format
(
new
Date
())
+
"交接单"
+
".xls"
;
}
}
}
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