切换导航条
此项目
正在载入...
登录
wlxxpt
/
Message-parsing
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
朱兆平
5 years ago
提交
0c96fa59709daf27deff4ab3bfac0b6ac049d62b
1 个父辈
5a854550
后端导出excel
显示空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
263 行增加
和
8 行删除
config/application.yml
pom.xml
src/main/java/com/tianbo/imfClient/controller/AgentController.java
src/main/java/com/tianbo/imfClient/controller/NmmsAnalysisController.java
src/main/resources/mapping/AGENTSTATISTICS.xml
src/main/resources/mapping/ORIGINMANIFESTMASTERMapper.xml
config/application.yml
查看文件 @
0c96fa5
...
...
@@ -16,7 +16,7 @@ spring:
static-locations
:
classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path}
application
:
name
:
analysis-
nmms
name
:
analysis-
agent
jackson
:
serialization
:
...
...
@@ -44,8 +44,8 @@ spring:
#oracle
driver-class-name
:
oracle.jdbc.OracleDriver
url
:
jdbc:oracle:thin:@10.50.3.69:1521:CGODB
username
:
CGONMS
password
:
1q2w3e4r
username
:
CGOASM
password
:
vmvnv1v2
#spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码
# url: jdbc:mysql://127.0.0.1:3307/statistics?useUnicode=true&characterEncoding=utf8
# username: root
...
...
@@ -88,6 +88,7 @@ eureka:
service-url
:
# defaultZone: http://10.50.3.82:19527/eureka/
defaultZone
:
http://192.168.1.53:12345/eureka/
# defaultZone: http://127.0.0.1:12345/eureka/
registry-fetch-interval-seconds
:
30
lease-renewal-interval-in-seconds
:
15
lease-expiration-duration-in-seconds
:
45
...
...
pom.xml
查看文件 @
0c96fa5
...
...
@@ -88,6 +88,12 @@
<artifactId>
util
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- excel导出-->
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
4.1.0
</version>
</dependency>
<!--util依赖-->
<!--<!–IMF需要的包–>-->
<!--<!– https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans –>-->
...
...
src/main/java/com/tianbo/imfClient/controller/AgentController.java
查看文件 @
0c96fa5
...
...
@@ -4,9 +4,19 @@ import com.tianbo.imfClient.dao.AGENTSTATISTICSMapper;
import
com.tianbo.imfClient.dao.ARRIVEDSECONDARYMapper
;
import
com.tianbo.imfClient.model.ORIGINMANIFESTMASTER
;
import
com.tianbo.imfClient.model.ResultJson
;
import
com.tianbo.util.POI.ExportExcelUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
oracle.sql.DATE
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -14,6 +24,7 @@ import java.util.Map;
/**
* 出港运抵服务接口
*/
@Slf4j
@RestController
@RequestMapping
(
"/agent"
)
public
class
AgentController
{
...
...
@@ -24,14 +35,245 @@ public class AgentController {
* 查询统计出港业务数据接口
*/
@GetMapping
(
"/analysis"
)
public
ResultJson
analysis
(
@RequestParam
(
value
=
"startdate"
,
required
=
true
)
String
startdate
,
@RequestParam
(
value
=
"enddate"
,
required
=
true
)
String
enddate
){
public
void
analysis
(
@RequestParam
(
value
=
"startdate"
,
required
=
true
)
String
startdate
,
@RequestParam
(
value
=
"enddate"
,
required
=
true
)
String
enddate
,
HttpServletResponse
httpServletResponse
){
Map
map
=
new
HashMap
();
map
.
put
(
"startdate"
,
startdate
);
map
.
put
(
"enddate"
,
enddate
);
List
<
ORIGINMANIFESTMASTER
>
list
=
agentstatisticsMapper
.
statistics
(
map
);
exportExcel
(
list
,
httpServletResponse
);
}
public
void
exportExcel
(
List
<
ORIGINMANIFESTMASTER
>
list
,
HttpServletResponse
response
){
// 创建工作簿
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
// 创建表
HSSFSheet
sheet
=
workbook
.
createSheet
(
"export"
);
// 创建行
HSSFRow
row
=
sheet
.
createRow
(
0
);
// 创建单元格样式
HSSFCellStyle
cellStyle
=
workbook
.
createCellStyle
();
// 表头
String
[]
head
=
{
"运单号"
,
"航空托运人名称"
,
"航空销售代理人名称"
,
"航协编号"
,
"航空公司运输证明"
,
"运输条件鉴定书"
,
"承运人"
,
"航班号"
,
"航班日期"
,
"航班起始站"
,
"航班目的站"
,
"运单件数"
,
"运单重量"
,
"操作时间"
,
"关区"
,
"预配品名"
,
"收货人公司"
,
"收货人地址"
,
"收货人城市"
,
"收货人电话"
,
"收货人国家"
,
"收货人名称"
,
"发货人名称"
,
"发货人地址"
,
"发货人城市"
,
"发货人国家"
,
"发货人电话"
,
"发货人名称"
,
"海关回执状态"
,
"海关回执信息"
,
"发货人编码"
,
"收货人编码"
,
"货物品名"
,
"二级类名称"
,
"一级类名称"
,
"代理人三字码"
,
"代理人全称"
,
"代理人类别"
,
"代理联系人"
,
"代理联系人电话"
};
HSSFCell
cell
;
// 设置表头
for
(
int
i
=
0
;
i
<
head
.
length
;
i
++)
{
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
head
[
i
]);
cell
.
setCellStyle
(
cellStyle
);
// 设置单元格宽度
sheet
.
setColumnWidth
(
i
,
4000
);
}
// 设置表格内容
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
row
=
sheet
.
createRow
(
i
+
1
);
ORIGINMANIFESTMASTER
originmanifestmaster
=
list
.
get
(
i
);
// 这里是内容设置,替换则自己的数据即可
String
[]
excelTitle
=
new
String
[
40
];
excelTitle
[
0
]
=
originmanifestmaster
.
getAutoid
();
excelTitle
[
1
]
=
originmanifestmaster
.
getWaybillnomaster
();
excelTitle
[
2
]
=
originmanifestmaster
.
getSegment
();
excelTitle
[
3
]
=
originmanifestmaster
.
getOriginatingstation
();
excelTitle
[
4
]
=
originmanifestmaster
.
getDestinationstation
();
excelTitle
[
5
]
=
originmanifestmaster
.
getTotalweight
();
excelTitle
[
6
]
=
originmanifestmaster
.
getTotalpiece
();
excelTitle
[
7
]
=
originmanifestmaster
.
getManifesttotalpiece
();
excelTitle
[
8
]
=
originmanifestmaster
.
getManifesttotalweight
();
excelTitle
[
9
]
=
originmanifestmaster
.
getFlightno
();
excelTitle
[
10
]
=
originmanifestmaster
.
getProductname
();
excelTitle
[
11
]
=
originmanifestmaster
.
getCustomsstatus
();
excelTitle
[
12
]
=
originmanifestmaster
.
getCarrier1
();
excelTitle
[
13
]
=
originmanifestmaster
.
getArrivalstation1
();
excelTitle
[
14
]
=
originmanifestmaster
.
getCarrier2
();
excelTitle
[
15
]
=
originmanifestmaster
.
getArrivalstation2
();
excelTitle
[
16
]
=
originmanifestmaster
.
getCarrier3
();
excelTitle
[
17
]
=
originmanifestmaster
.
getArrivalstation3
();
excelTitle
[
18
]
=
originmanifestmaster
.
getPaymode
();
excelTitle
[
19
]
=
originmanifestmaster
.
getCustomscode
();
excelTitle
[
20
]
=
originmanifestmaster
.
getSpecialgoodscode
();
excelTitle
[
21
]
=
originmanifestmaster
.
getShippername
();
excelTitle
[
22
]
=
originmanifestmaster
.
getShipperaddress
();
excelTitle
[
23
]
=
originmanifestmaster
.
getConsigneename
();
excelTitle
[
24
]
=
originmanifestmaster
.
getConsigneeaddress
();
excelTitle
[
25
]
=
originmanifestmaster
.
getReceiptinformation
();
excelTitle
[
26
]
=
originmanifestmaster
.
getSpecificConsigneePhone
();
excelTitle
[
27
]
=
originmanifestmaster
.
getConsigneePhone
();
excelTitle
[
28
]
=
originmanifestmaster
.
getStatus
();
excelTitle
[
29
]
=
originmanifestmaster
.
getIsbatch
();
excelTitle
[
30
]
=
originmanifestmaster
.
getOriginatingstationBill
();
excelTitle
[
31
]
=
originmanifestmaster
.
getDestinationstationBill
();
excelTitle
[
32
]
=
originmanifestmaster
.
getReportorder
();
excelTitle
[
33
]
=
originmanifestmaster
.
getIslast
();
excelTitle
[
34
]
=
originmanifestmaster
.
getShipperCode
();
excelTitle
[
35
]
=
originmanifestmaster
.
getShipperCountrycode
();
excelTitle
[
36
]
=
originmanifestmaster
.
getShipperPhone
();
excelTitle
[
37
]
=
originmanifestmaster
.
getShipperFax
();
excelTitle
[
38
]
=
originmanifestmaster
.
getConsigneeCode
();
excelTitle
[
39
]
=
originmanifestmaster
.
getConsigneeCountrycode
();
for
(
int
j
=
0
;
j
<
excelTitle
.
length
;
j
++){
row
.
createCell
(
j
).
setCellValue
(
excelTitle
[
j
]);
}
}
return
new
ResultJson
(
"200"
,
"success"
,
list
);
// 设置文件名
String
title
=
"export.xls"
;
try
{
String
fileName
=
new
String
(
title
.
getBytes
(
StandardCharsets
.
UTF_8
),
"ISO-8859-1"
);
fileName
=
URLEncoder
.
encode
(
fileName
,
"utf-8"
);
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
//默认Excel名称
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
fileName
+
";"
+
"filename*=utf-8''"
+
fileName
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
try
{
OutputStream
os
=
response
.
getOutputStream
();
workbook
.
write
(
os
);
os
.
flush
();
os
.
close
();
log
.
info
(
"导出完毕"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
void
export
(
List
<
ORIGINMANIFESTMASTER
>
list
,
HttpServletResponse
response
){
String
[]
header
=
{
"运单号"
,
"航空托运人名称"
,
"航空销售代理人名称"
,
"航协编号"
,
"航空公司运输证明"
,
"运输条件鉴定书"
,
"承运人"
,
"航班号"
,
"航班日期"
,
"航班起始站"
,
"航班目的站"
,
"运单件数"
,
"运单重量"
,
"操作时间"
,
"关区"
,
"预配品名"
,
"收货人公司"
,
"收货人地址"
,
"收货人城市"
,
"收货人电话"
,
"收货人国家"
,
"收货人名称"
,
"发货人名称"
,
"发货人地址"
,
"发货人城市"
,
"发货人国家"
,
"发货人电话"
,
"发货人名称"
,
"海关回执状态"
,
"海关回执信息"
,
"发货人编码"
,
"收货人编码"
,
"货物品名"
,
"二级类名称"
,
"一级类名称"
,
"代理人三字码"
,
"代理人全称"
,
"代理人类别"
,
"代理联系人"
,
"代理联系人电话"
};
String
[]
columns
=
{
"autoid"
,
"waybillnomaster"
,
"segment"
,
"originatingstation"
,
"destinationstation"
,
"totalweight"
,
"totalpiece"
,
"manifesttotalpiece"
,
"manifesttotalweight"
,
"flightno"
,
"productname"
,
"customsstatus"
,
"carrier1"
,
"arrivalstation1"
,
"carrier2"
,
"arrivalstation2"
,
"carrier3"
,
"arrivalstation3"
,
"paymode"
,
"customscode"
,
"specialgoodscode"
,
"shippername"
,
"shipperaddress"
,
"consigneename"
,
"consigneeaddress"
,
"receiptinformation"
,
"specificConsigneePhone"
,
"consigneePhone"
,
"status"
,
"isbatch"
,
"originatingstationBill"
,
"destinationstationBill"
,
"reportorder"
,
"islast"
,
"shipperCode"
,
"shipperCountrycode"
,
"shipperPhone"
,
"shipperFax"
,
"consigneeCode"
,
"consigneeCountrycode"
};
ExportExcelUtil
exportExcelUtil
=
new
ExportExcelUtil
();
try
{
exportExcelUtil
.
export
(
"export.xls"
,
"export"
,
header
,
columns
,
list
,
response
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
...
...
src/main/java/com/tianbo/imfClient/controller/NmmsAnalysisController.java
查看文件 @
0c96fa5
...
...
@@ -27,11 +27,14 @@ public class NmmsAnalysisController {
*/
@GetMapping
(
"/analysis"
)
public
ResultJson
analysis
(
@RequestParam
(
value
=
"startdate"
,
required
=
true
)
String
startdate
,
@RequestParam
(
value
=
"enddate"
,
required
=
true
)
String
enddate
){
@RequestParam
(
value
=
"enddate"
,
required
=
true
)
String
enddate
,
@RequestParam
(
value
=
"flightno"
,
required
=
false
)
String
flightno
){
Map
map
=
new
HashMap
();
map
.
put
(
"startdate"
,
startdate
);
map
.
put
(
"enddate"
,
enddate
);
map
.
put
(
"flightno"
,
flightno
);
List
<
ORIGINMANIFESTMASTER
>
list
=
mapper
.
analysis
(
map
);
return
new
ResultJson
(
"200"
,
"success"
,
list
);
...
...
src/main/resources/mapping/AGENTSTATISTICS.xml
查看文件 @
0c96fa5
...
...
@@ -50,7 +50,7 @@ SELECT
SD.SD_WAYBILL "运单号",
SD.SD_CARGO_SHIPPER_NAME "航空托运人名称" ,
SD.SD_CARGO_AGENT_NAME "航空销售代理人名称",
SD.SD_IATA_NUMBER "航协编号
",
SD.SD_IATA_NUMBER "航协编号",
SD.SD_TRANSPORT_CERTIFICATE "航空公司运输证明",
SD.SD_TRANSPORTATION_PROVE "运输条件鉴定书",
MF.CARRIER "承运人",
...
...
src/main/resources/mapping/ORIGINMANIFESTMASTERMapper.xml
查看文件 @
0c96fa5
...
...
@@ -144,6 +144,9 @@ LEFT JOIN
WHERE
trunc( T.FLIGHT_DATE ) BETWEEN to_date( #{startdate,jdbcType=VARCHAR}, 'yyyy-mm-dd' )
AND to_date(#{enddate,jdbcType=VARCHAR},'yyyy-mm-dd')
<if
test=
"flightno != null"
>
AND T.FLIGHTNO = #{flightno,jdbcType=VARCHAR}
</if>
ORDER BY T.FLIGHT_DATE,T.FLIGHTNO,WAYBILLNOMASTER,WAYBILLNOSECONDARY DESC
</select>
...
...
请
注册
或
登录
后发表评论