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
a5b58c15
Commit
a5b58c15
authored
Mar 12, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
56687824
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
189 additions
and
42 deletions
+189
-42
DataStatisticsController.java
.../cement/business/controller/DataStatisticsController.java
+11
-0
SampleMapper.java
.../java/cn/wise/sc/cement/business/mapper/SampleMapper.java
+1
-1
DataStatisticsMapper.xml
...se/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
+8
-16
IDataStatisticsService.java
...se/sc/cement/business/service/IDataStatisticsService.java
+3
-0
DataStatisticsServiceImpl.java
...ment/business/service/impl/DataStatisticsServiceImpl.java
+140
-18
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+0
-3
ExcelUtil.java
.../main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
+26
-4
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/DataStatisticsController.java
View file @
a5b58c15
...
...
@@ -118,6 +118,17 @@ public class DataStatisticsController {
}
}
@ApiOperation
(
"委托单进展统计-列表导出(新)"
)
@PostMapping
(
"/exportEntrustIngList"
)
public
void
exportEntrustIngList
(
Integer
cycle
,
String
startDate
,
String
endDate
,
Integer
clientId
,
String
clientName
,
String
fileName
,
HttpServletResponse
response
)
{
try
{
dataStatisticsService
.
exportEntrustIngList
(
cycle
,
startDate
,
endDate
,
clientId
,
clientName
,
fileName
,
response
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"委托单进展统计-列表导出(新){}"
,
e
);
}
}
@ApiOperation
(
value
=
"统计概览-进行中任务数量统计"
)
@GetMapping
(
"/countTaskIng"
)
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SampleMapper.java
View file @
a5b58c15
...
...
@@ -48,7 +48,7 @@ public interface SampleMapper extends BaseMapper<Sample> {
//校核详情样品列表(不展示平行样副样)
@Select
(
"select * from sample where cement_code = parallel_code and entrust_id = #{entrustId} "
+
"and is_handle = 1
and is_distribution = 1
order by id asc"
)
"and is_handle = 1 order by id asc"
)
List
<
Sample
>
getCheckSampleList
(
Integer
entrustId
);
@Select
(
"select * from sample where entrust_id = #{entrustId} and is_check != 1 order by id asc"
)
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
View file @
a5b58c15
...
...
@@ -187,28 +187,20 @@
(@i:=@i+1) as 序号,
IF(ISNULL(e.id),'',e.id) as entrustId,
IF(ISNULL(e.entrust_code),'',e.entrust_code) as 委托单号,
IF(ISNULL(
p.name),'',p.name) as 项目名称
,
IF(ISNULL(
c.name),'',c.name) as 委托单位
,
IF(ISNULL(p.name),'',p.name) as 项目编号,
IF(ISNULL(
e.project_type),'',e.project_type) as 项目类型
,
IF(ISNULL(
p.name),'',p.name) as 项目名称
,
IF(ISNULL(su.name),'',su.name) as 委托人,
IF(ISNULL(c.name),'',c.name) as 委托单位,
IF(ISNULL(e.entrust_date),'',e.entrust_date) as 委托日期,
IF(ISNULL(e.sample_num),'',e.sample_num) as 样品数量,
IF(ISNULL(e.entrust_date),'',e.entrust_date) as 委托日期,
IF(ISNULL(e.is_urgent),'',e.is_urgent) as isUrgent,
(
CASE e.status
WHEN 0 THEN '未评审'
WHEN 1 THEN '已通过'
WHEN 2 THEN '未通过'
WHEN 3 THEN '样品处理中'
WHEN 4 THEN '样品处理完成'
WHEN 5 THEN '样品检测中'
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
CASE e.is_urgent
WHEN 0 THEN '不加急'
WHEN 1 THEN '加急'
ELSE ''
END
) as
状态
) as
是否加急
from entrust e
left join project p on p.id = e.project_id
left join client c on c.id = e.client_id
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/IDataStatisticsService.java
View file @
a5b58c15
...
...
@@ -39,6 +39,9 @@ public interface IDataStatisticsService {
void
exportEntrustList
(
Integer
cycle
,
String
startDate
,
String
endDate
,
Integer
clientId
,
String
clientName
,
String
fileName
,
HttpServletResponse
response
);
void
exportEntrustIngList
(
Integer
cycle
,
String
startDate
,
String
endDate
,
Integer
clientId
,
String
clientName
,
String
fileName
,
HttpServletResponse
response
);
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
,
String
startDate
,
String
endDate
);
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamIng
(
String
startDate
,
String
endDate
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/DataStatisticsServiceImpl.java
View file @
a5b58c15
...
...
@@ -367,10 +367,132 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
public
void
exportEntrustIngList
(
Integer
cycle
,
String
startDate
,
String
endDate
,
Integer
clientId
,
String
clientName
,
String
fileName
,
HttpServletResponse
response
){
//1.获取委托可见的所有检测项list
List
<
Team
>
teams
=
null
;
//2. 获取委托列表
//3. 样品列表
//4. 检测项列表
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"cycle"
,
cycle
);
params
.
put
(
"startDate"
,
startDate
);
params
.
put
(
"endDate"
,
endDate
);
params
.
put
(
"clientId"
,
clientId
);
params
.
put
(
"clientName"
,
clientName
);
List
<
Map
<
String
,
Object
>>
list
=
dataStatisticsMapper
.
exportEntrustList
(
params
);
List
<
String
>
teamNameList
=
teamMapper
.
getNameList
();
if
(
teamNameList
==
null
||
teamNameList
.
size
()<=
0
){
return
;
}
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
String
[]
headers
=
new
String
[
10
+
teamNameList
.
size
()*
3
];
headers
[
0
]
=
"序号"
;
headers
[
1
]
=
"委托单号"
;
headers
[
2
]
=
"委托单位"
;
headers
[
3
]
=
"项目编号"
;
headers
[
4
]
=
"项目名称"
;
headers
[
5
]
=
"委托人"
;
headers
[
6
]
=
"样品数量"
;
headers
[
7
]
=
"委托日期"
;
headers
[
8
]
=
"是否加急"
;
headers
[
9
]
=
"实际产值"
;
Integer
cloumNo
=
9
;
for
(
int
i
=
0
;
i
<
teamNameList
.
size
();
i
++){
headers
[
10
+
i
]
=
teamNameList
.
get
(
i
)+
"(产值)"
;
cloumNo
=
cloumNo
+
1
;
}
for
(
int
i
=
0
;
i
<
teamNameList
.
size
();
i
++){
headers
[
cloumNo
+
1
]
=
teamNameList
.
get
(
i
)+
"(单价)"
;
headers
[
cloumNo
+
2
]
=
teamNameList
.
get
(
i
)+
"(数量)"
;
cloumNo
=
cloumNo
+
2
;
}
List
<
Object
[]>
datas
=
new
ArrayList
<>(
list
.
size
());
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Object
[]
objects
=
new
Object
[
headers
.
length
];
String
objj
=
m
.
get
(
"entrustId"
).
toString
();
String
isUrgent
=
m
.
get
(
"isUrgent"
).
toString
();
Integer
entrustId
=
Integer
.
valueOf
(
objj
);
//只统计主样的信息
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleList
(
entrustId
);
//检测项目名称
List
<
Integer
>
teamIdList
=
new
ArrayList
<>();
Map
<
Integer
,
Integer
>
teamMap
=
new
HashMap
<>();
//所有样品主样的产值
BigDecimal
outputValue
=
new
BigDecimal
(
"0.00"
);
if
(
sampleList
!=
null
&&
sampleList
.
size
()
>
0
)
{
//样品名称 列表中的拼接
for
(
Sample
sample
:
sampleList
)
{
if
(
sample
.
getOutputValue
()
!=
null
){
outputValue
=
outputValue
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
sample
.
getOutputValue
()
:
(
outputValue
.
add
(
sample
.
getOutputValue
()));
}
String
teamIds
=
sample
.
getTeamIds
();
if
(
teamIds
!=
null
)
{
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
for
(
String
teamId
:
teamIdS
)
{
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
)
{
if
(!
teamIdList
.
contains
(
team
.
getId
())){
teamMap
.
put
(
team
.
getId
(),
1
);
teamIdList
.
add
(
team
.
getId
());
}
else
{
teamMap
.
put
(
team
.
getId
(),
teamMap
.
get
(
team
.
getId
())+
1
);
}
}
}
}
}
}
//遍历检测项的数量 求得检测项的单价 和 计算的产值,如果是加急状态产值需要 ✖3倍计算
JSONArray
jsonArray
=
new
JSONArray
();
for
(
Map
.
Entry
<
Integer
,
Integer
>
entry
:
teamMap
.
entrySet
()){
Team
team
=
teamMapper
.
selectById
(
entry
.
getKey
());
if
(
team
!=
null
){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
team
.
getName
()+
"(单价)"
,
team
.
getCharge
());
jsonObject
.
put
(
team
.
getName
()+
"(数量)"
,
entry
.
getValue
());
BigDecimal
outPutValue
=
team
.
getCharge
().
multiply
(
new
BigDecimal
(
entry
.
getValue
()));
if
(
isUrgent
.
equals
(
"1"
)){
outPutValue
.
multiply
(
new
BigDecimal
(
3
));
}
jsonObject
.
put
(
team
.
getName
()+
"(产值)"
,
outPutValue
.
toString
());
jsonArray
.
add
(
jsonObject
);
}
}
// JSONArray checkElementArray = mapToJSONArray(teamMap);
// String teamString = JSON.toJSON(checkElementArray).toString();
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
String
obj
=
""
;
if
(
j
>
9
){
for
(
int
k
=
0
;
k
<
jsonArray
.
size
();
k
++){
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
k
);
if
(
jsonObject
.
containsKey
(
headers
[
j
])){
String
value
=
jsonObject
.
getString
(
headers
[
j
]).
toString
();
objects
[
j
]
=
value
;
}
}
}
else
if
(
j
==
9
){
objects
[
9
]
=
outputValue
;
}
else
{
obj
=
m
.
get
(
headers
[
j
]).
toString
();
if
(
j
==
0
)
{
obj
=
obj
.
split
(
"\\."
)[
0
];
}
objects
[
j
]
=
obj
;
}
}
datas
.
add
(
objects
);
}
ExcelUtil
.
excelExport
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"委托单进展统计-列表导出"
:
fileName
,
headers
,
datas
,
response
);
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
a5b58c15
...
...
@@ -2112,9 +2112,6 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
if
(
sampleHandle
.
getStatus
()
!=
1
&&
sampleHandle
.
getStatus
()
!=
2
)
{
return
BaseResponse
.
errorMsg
(
"状态错误"
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
View file @
a5b58c15
...
...
@@ -167,7 +167,6 @@ public class ExcelUtil {
public
static
Workbook
getWorkbook
(
String
[]
headers
,
List
<
Object
[]>
datas
)
{
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFSheet
sheet
=
workbook
.
createSheet
();
Row
row
=
null
;
Cell
cell
=
null
;
XSSFFont
font
=
workbook
.
createFont
();
...
...
@@ -175,7 +174,6 @@ public class ExcelUtil {
if
(
headers
!=
null
&&
headers
.
length
>
0
)
{
// 设置列头
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setAlignment
(
HorizontalAlignment
.
CENTER_SELECTION
);
row
=
sheet
.
createRow
(
line
++);
row
.
setHeightInPoints
(
23
);
font
.
setBold
(
true
);
...
...
@@ -185,8 +183,32 @@ public class ExcelUtil {
maxColumn
=
headers
.
length
;
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
headers
[
i
]);
sheet
.
setColumnWidth
(
i
,
Math
.
min
(
255
*
256
,
sheet
.
getColumnWidth
(
i
)
*
12
/
10
));
XSSFFont
xxsfFont
=
workbook
.
createFont
();
//表头处理上下标
if
(
headers
[
i
]
!=
null
)
{
//处理下标
if
(
headers
[
i
].
contains
(
"<sup>"
)
||
headers
[
i
].
contains
(
"</sup>"
))
{
headers
[
i
]
=
headers
[
i
].
replaceAll
(
"<sup>-</sup>"
,
"⁻"
);
}
if
(
headers
[
i
].
contains
(
"<sub>"
)
||
headers
[
i
].
contains
(
"</sub>"
))
{
xxsfFont
.
setTypeOffset
(
FontFormatting
.
SS_SUB
);
cell
.
setCellStyle
(
style
);
XSSFRichTextString
richString
=
new
XSSFRichTextString
(
headers
[
i
].
replaceAll
(
"</sub>"
,
"<sub>"
).
replaceAll
(
"<sub>"
,
""
));
//提取下标位置
applyRichStringFontsub
(
headers
[
i
],
richString
,
xxsfFont
);
cell
.
setCellValue
(
richString
);
// value = cell.getStringCellValue();
}
else
{
cell
.
setCellStyle
(
style
);
cell
.
setCellValue
(
headers
[
i
]);
}
}
// cell.setCellValue(headers[i]);
// cell.setCellStyle(style);
}
}
...
...
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