Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YX_IDENT_REFACTORING
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_REFACTORING
Commits
28db2beb
Commit
28db2beb
authored
Dec 21, 2018
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了插入出入库数并更新出入库时间,
添加了下载回执单的接口
parent
b4f788e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
13 deletions
+134
-13
UserApi.java
src/main/java/com/yxproject/start/api/UserApi.java
+122
-1
CountyListMapper.xml
src/main/resources/mapper/CountyListMapper.xml
+12
-12
No files found.
src/main/java/com/yxproject/start/api/UserApi.java
View file @
28db2beb
...
...
@@ -19,6 +19,7 @@ import org.dom4j.Attribute;
import
org.dom4j.Document
;
import
org.dom4j.Element
;
import
org.dom4j.io.*
;
import
org.hibernate.loader.plan.spi.Return
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -582,13 +583,133 @@ public class UserApi {
return
yxjsonResponse
.
toJSONString
();
}
/**
* 下载回执单
*/
@RequestMapping
(
"printOfficialReceipt"
)
// @RequiresPermissions("userInfo.add")//权限管理;
public
byte
[]
printOfficialReceipt
(
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
,
HttpServletResponse
response
)
{
// cyclesheetID ="20180802032";
response
.
setContentType
(
"application/x-download"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
String
dateTime
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMddHH"
);
// //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
String
fout
=
null
;
List
<
ReceiptListEntity
>
receiptListEntity
=
receiptListService
.
getReceiptList
(
startDate
,
endDate
);
fout
=
officialReceiptExcel
(
receiptListEntity
,
receiptListEntity
.
get
(
0
).
getXiaoJi
()
+
""
,
6000
,
receiptListEntity
.
get
(
0
).
getBoxCount
(),
receiptListEntity
.
get
(
0
).
getCountyName
(),
dateTime
,
startDate
,
endDate
);
String
outFile
=
dateTime
+
"身份证专递回执单"
;
try
{
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
fout
));
byte
[]
b
=
new
byte
[
fis
.
available
()];
fis
.
read
(
b
);
fis
.
close
();
response
.
addHeader
(
"Content-Disposition"
,
"attachment;filename="
+
outFile
+
".xls"
);
return
b
;
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
String
officialReceiptExcel
(
List
<
ReceiptListEntity
>
receiptListEntity
,
String
typeName
,
int
sum
,
long
boxCount
,
String
countyName
,
String
dateTime
,
String
startDate
,
String
endDate
)
{
if
(
typeName
.
contains
(
"null"
)){
typeName
=
typeName
.
replace
(
"null"
,
""
);
}
//第一步创建workbook
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
// HSSFSheet sheet=wb.createSheet("身份证专递回执单");
// sheet.setColumnWidth(0, 100 * 255);
for
(
ReceiptListEntity
receiptList
:
receiptListEntity
){
HSSFSheet
sheet
=
wb
.
createSheet
(
"回执单"
+
receiptList
.
getCountyName
());
HSSFPrintSetup
ps
=
sheet
.
getPrintSetup
();
ps
.
setLandscape
(
true
);
// 打印方向,true:横向,false:纵向
ps
.
setPaperSize
(
HSSFPrintSetup
.
B5_PAPERSIZE
);
//纸张
sheet
.
setColumnWidth
(
0
,
(
int
)
100
*
255
);
//第三步创建行row:添加表头0行
HSSFRow
row
=
sheet
.
createRow
(
0
);
// HSSFCellStyle style=wb.createCellStyle();//样式
// style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
// style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
// style.setWrapText(true);//设置自动换行
//
// style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
// style.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
// style.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
// style.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
// HSSFFont font=wb.createFont();
// font.setFontHeightInPoints((short) 32);
// style.setFont(font);
HSSFCellStyle
style2
=
wb
.
createCellStyle
();
//表头样式
style2
.
setVerticalAlignment
(
HSSFCellStyle
.
VERTICAL_CENTER
);
//设置垂直居中
style2
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
HSSFFont
font2
=
wb
.
createFont
();
font2
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
//粗体显示
font2
.
setFontHeightInPoints
((
short
)
36
);
style2
.
setFont
(
font2
);
HSSFCellStyle
style3
=
wb
.
createCellStyle
();
//表头样式
style3
.
setVerticalAlignment
(
HSSFCellStyle
.
ALIGN_RIGHT
);
//设置垂直靠右
style3
.
setAlignment
(
HSSFCellStyle
.
ALIGN_RIGHT
);
HSSFFont
font3
=
wb
.
createFont
();
font3
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_NORMAL
);
font3
.
setFontHeightInPoints
((
short
)
24
);
style3
.
setFont
(
font3
);
HSSFCellStyle
style4
=
wb
.
createCellStyle
();
//表头样式
style4
.
setVerticalAlignment
(
HSSFCellStyle
.
VERTICAL_CENTER
);
//设置垂直居中
style4
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
HSSFFont
font4
=
wb
.
createFont
();
font4
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_NORMAL
);
//粗体显示
font4
.
setFontHeightInPoints
((
short
)
18
);
style4
.
setFont
(
font4
);
// ReceiptListEntity receiptListEntity1=receiptListEntity.get(i);
row
=
sheet
.
createRow
(
0
);
//创建下标为0的单元格
row
.
setHeightInPoints
(
Short
.
parseShort
(
"67"
));
//设置行高
HSSFCell
cell
=
row
.
createCell
(
0
);
//设定值
cell
.
setCellValue
(
"身份证专递回执单"
);
cell
.
setCellStyle
(
style2
);
row
=
sheet
.
createRow
(
1
);
row
.
setHeightInPoints
(
Short
.
parseShort
(
"192"
));
//设置行高
cell
=
row
.
createCell
(
0
);
cell
.
setCellValue
(
" "
+
receiptList
.
getCountyName
()
+
"\\县于"
+
simpleDateFormat
.
format
(
new
Date
())
+
"出库身份证\r\n普通证"
+
receiptList
.
getPTZ
()+
"人,快证"
+
receiptList
.
getKZ
()
+
"人,省内异地快速通\r\n道邮"
+
receiptList
.
getYDKSY
()
+
"人,省内异地快速通道普"
+
receiptList
.
getYDKSP
()
+
"人,省内\r\n异地邮"
+
receiptList
.
getYDY
()
+
"人,省内异地普"
+
receiptList
.
getYDP
()
+
"人,军人证"
+
receiptList
.
getJRZ
()
+
"人,\r\n快速通道普"
+
receiptList
.
getKSP
()
+
"人,快速通道邮"
+
receiptList
.
getKSY
()
+
"人,邮寄证\r\n"
+
receiptList
.
getYJZ
()
+
"人,国内异地证____人,共"
+
receiptList
.
getBoxCount
()
+
"盒。(请核\r\n对签字后,使用传真发至0371-69179397;或交\r\n至本地速递局身份证项目经理寄回。)"
);
//设定值
cell
.
setCellStyle
(
style4
);
//内容居中
row
=
sheet
.
createRow
(
2
);
//i+2行之后开始创建
row
.
setHeightInPoints
(
Short
.
parseShort
(
"50"
));
//设置行高
//创建单元格并且添加数据
cell
=
row
.
createCell
(
0
);
cell
.
setCellValue
(
"收件人签字:__________"
);
cell
.
setCellStyle
(
style3
);
}
FileOutputStream
fout
=
null
;
try
{
fout
=
new
FileOutputStream
(
"E:\\Excel\\"
+
simpleDateFormat
.
format
(
new
Date
())+
"身份证专递回执单"
+
".xls"
);
// fout = new FileOutputStream("D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls");
wb
.
write
(
fout
);
fout
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
"Excel文件生成成功..."
+
new
Date
());
return
"E:\\Excel\\"
+
simpleDateFormat
.
format
(
new
Date
())
+
"身份证专递回执单"
+
".xls"
;
// return "D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls";
}
/**
* 下载交接单
*/
@RequestMapping
(
"printReceiptList"
)
// @RequiresPermissions("userInfo.add")//权限管理;
public
byte
[]
print
Connec
tList
(
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
,
HttpServletResponse
response
)
{
public
byte
[]
print
Receip
tList
(
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
,
HttpServletResponse
response
)
{
// cyclesheetID ="20180802032";
response
.
setContentType
(
"application/x-download"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
...
...
src/main/resources/mapper/CountyListMapper.xml
View file @
28db2beb
...
...
@@ -42,18 +42,18 @@
SELECT COUNTYNAME,SUM(TYPE_COUNT) AS XIAOJI FROM t_county GROUP BY COUNTYNAME
)
SELECT DECODE(GROUPING(t_total_count.COUNTYNAME),1,'总计',t_total_count.COUNTYNAME)COUNTYNAME,
SUM(PTZ)PTZ
,
SUM(KZ)
KZ,
SUM(YDKSY)
YDKSY,
SUM(YDKSP)
YDKSP,
SUM(YDY)
YDY,
SUM(YDP)
YDP,
SUM(JRZ)
JRZ,
SUM(KSP)
KSP,
SUM(KSY)
KSY,
SUM(YJZ)
YJZ,
SUM(XIAOJI)XIAOJI,
SUM(boxCount)boxCount
nvl(SUM(PTZ),0)AS PTZ
,
nvl(SUM(KZ),0)AS
KZ,
nvl(SUM(YDKSY),0) AS
YDKSY,
nvl(SUM(YDKSP),0)AS
YDKSP,
nvl(SUM(YDY),0)AS
YDY,
nvl(SUM(YDP),0)AS
YDP,
nvl(SUM(JRZ),0)AS
JRZ,
nvl(SUM(KSP),0)AS
KSP,
nvl(SUM(KSY),0)AS
KSY,
nvl(SUM(YJZ),0)AS
YJZ,
SUM(XIAOJI)XIAOJI,
SUM(boxCount)boxCount
FROM t_total_count,county_xiaoji WHERE t_total_count.COUNTYNAME=county_xiaoji.COUNTYNAME AND substr(TO_CHAR(SAVE_DATE,'yyyyMMdd'),0,8) >= #{startDate} AND #{endDate} >= substr(TO_CHAR(SAVE_DATE,'yyyyMMdd'),0,8)
GROUP BY ROLLUP(t_total_count.COUNTYNAME)
</select>
...
...
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