Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
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
竹天卫
tianjin-cement
Commits
2fcd9912
Commit
2fcd9912
authored
Mar 25, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出优化
parent
04ee0430
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
62 deletions
+25
-62
DataStatisticsServiceImpl.java
...ment/business/service/impl/DataStatisticsServiceImpl.java
+1
-1
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+4
-4
NormProductionServiceImpl.java
...ment/business/service/impl/NormProductionServiceImpl.java
+7
-6
PrecipriceServiceImpl.java
...c/cement/business/service/impl/PrecipriceServiceImpl.java
+7
-5
ExcelUtil.java
.../main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
+6
-46
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/DataStatisticsServiceImpl.java
View file @
2fcd9912
...
...
@@ -480,7 +480,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
}
}
}
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
列表
"
:
fileName
,
wb
,
response
);
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
单进展统计
"
:
fileName
,
wb
,
response
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
2fcd9912
...
...
@@ -5723,7 +5723,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
String
[]
headers
=
new
String
[
map
.
size
()
+
1
];
headers
[
0
]
=
"序号"
;
headers
[
1
]
=
"委托
编
号"
;
headers
[
1
]
=
"委托
单
号"
;
headers
[
2
]
=
"是否加急"
;
headers
[
3
]
=
"项目名称"
;
headers
[
4
]
=
"项目编号"
;
...
...
@@ -5934,7 +5934,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
}
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
列表
"
:
fileName
,
wb
,
response
);
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
单进展
"
:
fileName
,
wb
,
response
);
}
...
...
@@ -6130,7 +6130,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
coloum
=
coloum
+
1
;
}
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"
委托列表
"
:
fileName
,
wb
,
response
);
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"
样品标签
"
:
fileName
,
wb
,
response
);
}
...
...
@@ -6254,7 +6254,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
列表
"
:
fileName
,
wb
,
response
);
ExcelUtil
.
excelExportNew
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托
单校核
"
:
fileName
,
wb
,
response
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/NormProductionServiceImpl.java
View file @
2fcd9912
...
...
@@ -123,9 +123,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
if
(
normProduction
.
getType
()
==
null
){
return
BaseResponse
.
errorMsg
(
"类型不允许为空!"
);
}
if
(
normProduction
.
getAssessId
()
==
null
){
return
BaseResponse
.
errorMsg
(
"对象id不允许为空!"
);
}
//如果是处理项 只能添加一次
if
(
normProduction
.
getType
()
==
0
){
normProduction
.
setAssessId
(
null
);
...
...
@@ -137,6 +135,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
return
BaseResponse
.
errorMsg
(
"当前处理项标准产值已存在!"
);
}
}
else
{
if
(
normProduction
.
getAssessId
()
==
null
){
return
BaseResponse
.
errorMsg
(
"对象id不允许为空!"
);
}
//判断配置项目是否已存在
QueryWrapper
<
NormProduction
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"type"
,
normProduction
.
getType
());
...
...
@@ -216,9 +217,6 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
if
(
normProduction
.
getType
()
==
null
){
return
BaseResponse
.
errorMsg
(
"类型不允许为空!"
);
}
if
(
normProduction
.
getAssessId
()
==
null
){
return
BaseResponse
.
errorMsg
(
"对象id不允许为空!"
);
}
NormProduction
normProductionOld
=
this
.
getById
(
normProduction
.
getId
());
if
(
normProductionOld
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误!"
);
...
...
@@ -236,6 +234,9 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
return
BaseResponse
.
errorMsg
(
"当前处理项标准产值已存在!"
);
}
}
else
{
if
(
normProduction
.
getAssessId
()
==
null
){
return
BaseResponse
.
errorMsg
(
"对象id不允许为空!"
);
}
//判断配置项目是否已存在
QueryWrapper
<
NormProduction
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"assess_id"
,
normProduction
.
getAssessId
());
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/PrecipriceServiceImpl.java
View file @
2fcd9912
...
...
@@ -472,7 +472,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
headers
[
3
]
=
"数量"
;
headers
[
4
]
=
"合计"
;
headers
[
5
]
=
"产值设置:"
;
headers
[
5
]
=
"产值设置
参数
:"
;
headers
[
6
]
=
"额定工日"
;
headers
[
7
]
=
"报出对应分析结果"
;
...
...
@@ -497,13 +497,15 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
NormProductionVo
vo
=
null
;
if
(
target
.
getType
()
==
0
){
vo
=
normProductions
.
stream
()
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"处理项"
)
&&
arg
.
getAssessId
()==
null
)).
findFirst
().
get
(
);
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"处理项"
)
&&
arg
.
getAssessId
()==
null
)).
findFirst
().
orElse
(
null
);
}
else
if
(
target
.
getType
()
==
1
){
vo
=
normProductions
.
stream
()
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"检测组"
)
&&
arg
.
getAssessId
().
equals
(
target
.
getObjId
()))).
findFirst
().
get
();
vo
=
normProductions
.
stream
()
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"检测组"
)
&&
arg
.
getAssessId
().
equals
(
target
.
getObjId
())))
.
findFirst
().
orElse
(
null
);
}
else
if
(
target
.
getType
()
==
2
){
vo
=
normProductions
.
stream
()
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"检测项"
)
&&
arg
.
getAssessId
().
equals
(
target
.
getObjId
()))).
findFirst
().
get
(
);
.
filter
(
arg
->
(
arg
.
getType
().
equals
(
"检测项"
)
&&
arg
.
getAssessId
().
equals
(
target
.
getObjId
()))).
findFirst
().
orElse
(
null
);
}
if
(
vo
!=
null
){
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
View file @
2fcd9912
...
...
@@ -34,51 +34,6 @@ import java.util.List;
* @author zhutianwei
*/
public
class
ExcelUtil
{
public
static
void
excelLocal
(
String
path
,
String
fileName
,
String
[]
headers
,
List
<
Object
[]>
datas
)
{
Workbook
workbook
=
getWorkbook
(
headers
,
datas
);
if
(
workbook
!=
null
)
{
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
FileOutputStream
fileOutputStream
=
null
;
try
{
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
workbook
.
write
(
byteArrayOutputStream
);
String
suffix
=
".xls"
;
File
file
=
new
File
(
path
+
File
.
separator
+
fileName
+
suffix
);
if
(!
file
.
getParentFile
().
exists
())
{
file
.
getParentFile
().
mkdirs
();
}
fileOutputStream
=
new
FileOutputStream
(
file
);
fileOutputStream
.
write
(
byteArrayOutputStream
.
toByteArray
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
fileOutputStream
!=
null
)
{
fileOutputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
byteArrayOutputStream
!=
null
)
{
byteArrayOutputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
workbook
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
/**
* 导出excel
*
...
...
@@ -217,11 +172,11 @@ public class ExcelUtil {
font
.
setBold
(
true
);
font
.
setFontHeightInPoints
((
short
)
13
);
style
.
setFont
(
font
);
style
.
setWrapText
(
true
);
maxColumn
=
headers
.
length
;
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
cell
=
row
.
createCell
(
i
);
sheet
.
setColumnWidth
(
i
,
Math
.
min
(
255
*
256
,
sheet
.
getColumnWidth
(
i
)
*
12
/
10
));
XSSFFont
xxsfFont
=
workbook
.
createFont
();
//表头处理上下标
...
...
@@ -252,6 +207,7 @@ public class ExcelUtil {
if
(
datas
!=
null
&&
datas
.
size
()
>
0
)
{
// 渲染数据
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setWrapText
(
true
);
XSSFFont
xxsfFont
=
workbook
.
createFont
();
for
(
int
index
=
0
,
size
=
datas
.
size
();
index
<
size
;
index
++)
{
...
...
@@ -305,6 +261,8 @@ public class ExcelUtil {
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
sheet
.
autoSizeColumn
(
i
);
//单元格自适应宽度
sheet
.
setColumnWidth
(
i
,
Math
.
max
(
15
*
256
,
Math
.
min
(
255
*
256
,
sheet
.
getColumnWidth
(
i
)
*
12
/
10
)));
}
return
workbook
;
...
...
@@ -411,6 +369,8 @@ public class ExcelUtil {
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
sheet
.
autoSizeColumn
(
i
);
//单元格自适应宽度
sheet
.
setColumnWidth
(
i
,
Math
.
max
(
15
*
256
,
Math
.
min
(
255
*
256
,
sheet
.
getColumnWidth
(
i
)
*
12
/
10
)));
}
return
workbook
;
...
...
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