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
ba3488c5
Commit
ba3488c5
authored
Jan 14, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下标问题处理
parent
0ae88aa1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
17 deletions
+102
-17
pom.xml
cement-business/pom.xml
+9
-0
DataStatisticsController.java
.../cement/business/controller/DataStatisticsController.java
+47
-0
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+2
-2
ExcelUtil.java
.../main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
+42
-15
cement-business-1.0-SNAPSHOT.jar.original
...business/target/cement-business-1.0-SNAPSHOT.jar.original
+0
-0
createdFiles.lst
...-compiler-plugin/compile/default-compile/createdFiles.lst
+1
-0
inputFiles.lst
...en-compiler-plugin/compile/default-compile/inputFiles.lst
+1
-0
No files found.
cement-business/pom.xml
View file @
ba3488c5
...
...
@@ -114,7 +114,16 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.17
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.17
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.oschina.zcx7878/fastdfs-client-java -->
<dependency>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/DataStatisticsController.java
0 → 100644
View file @
ba3488c5
package
cn
.
wise
.
sc
.
cement
.
business
.
controller
;
import
cn.wise.sc.cement.business.enumation.FileExt
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.query.*
;
import
cn.wise.sc.cement.business.model.vo.EntrustVo
;
import
cn.wise.sc.cement.business.model.vo.SampleDistributionTeamVo
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
cn.wise.sc.cement.business.service.IEntrustService
;
import
cn.wise.sc.cement.business.util.WordUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 前端控制器
* </p>
*
* @author ztw
* @since 2021-01-12
*/
@Api
(
tags
=
"数据统计"
)
@RestController
@RequestMapping
(
"/business/dataStatistics"
)
public
class
DataStatisticsController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
"DataStatisticsController"
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
ba3488c5
...
...
@@ -3071,10 +3071,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
&&
team
.
getQualifications
()
==
1
)
{
String
teamName
=
team
.
getName
();
if
(
team
.
getName
().
contains
(
"<sub>"
)
||
team
.
getName
().
contains
(
"</sub>"
)
){
/*
if(team.getName().contains("<sub>") || team.getName().contains("</sub>") ){
teamName = team.getName().replaceAll("<sub>","")
.replaceAll("</sub>","");
}
}
*/
checkTeam
=
checkTeam
.
equals
(
""
)
?
teamName
:
(
checkTeam
+
"、"
+
teamName
);
Method
method
=
methodMapper
.
selectById
(
team
.
getMethodId
());
if
(
method
!=
null
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
View file @
ba3488c5
...
...
@@ -9,15 +9,17 @@ import java.util.List;
import
javax.servlet.http.HttpServletResponse
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
org.apache.poi.hssf.usermodel.HSSFCellStyle
;
import
org.apache.poi.hssf.usermodel.HSSFFont
;
import
org.apache.poi.hssf.usermodel.HSSFRichTextString
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Font
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.wp.usermodel.Paragraph
;
import
org.apache.poi.xssf.usermodel.XSSFFont
;
import
org.apache.poi.xssf.usermodel.XSSFRichTextString
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
/**
* excel工具类
...
...
@@ -156,14 +158,12 @@ public class ExcelUtil {
* @return
*/
public
static
Workbook
getWorkbook
(
String
[]
headers
,
List
<
Object
[]>
datas
)
{
Workbook
workbook
=
new
HSSFWorkbook
();
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFSheet
sheet
=
workbook
.
createSheet
();
Sheet
sheet
=
workbook
.
createSheet
();
Row
row
=
null
;
Cell
cell
=
null
;
Font
font
=
workbook
.
createFont
();
XSSFFont
font
=
workbook
.
createFont
();
int
line
=
0
,
maxColumn
=
0
;
if
(
headers
!=
null
&&
headers
.
length
>
0
)
{
// 设置列头
CellStyle
style
=
workbook
.
createCellStyle
();
...
...
@@ -185,6 +185,8 @@ public class ExcelUtil {
if
(
datas
!=
null
&&
datas
.
size
()
>
0
)
{
// 渲染数据
CellStyle
style
=
workbook
.
createCellStyle
();
XSSFFont
xxsfFont
=
workbook
.
createFont
();
xxsfFont
.
setTypeOffset
(
FontFormatting
.
SS_SUB
);
for
(
int
index
=
0
,
size
=
datas
.
size
();
index
<
size
;
index
++)
{
Object
[]
data
=
datas
.
get
(
index
);
if
(
data
!=
null
&&
data
.
length
>
0
)
{
...
...
@@ -197,11 +199,21 @@ public class ExcelUtil {
}
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
style
.
setWrapText
(
true
);
//关键
//
style.setWrapText(true); //关键
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
data
[
i
]
==
null
?
null
:
data
[
i
].
toString
());
//处理下标
if
(
cell
.
getStringCellValue
().
contains
(
"<sub>"
)
||
cell
.
getStringCellValue
().
contains
(
"</sub>"
)
){
cell
.
setCellStyle
(
style
);
XSSFRichTextString
richString
=
new
XSSFRichTextString
(
cell
.
getStringCellValue
().
replaceAll
(
"</sub>"
,
"<sub>"
).
replaceAll
(
"<sub>"
,
""
));
//提取下标位置
applyRichStringFont
(
cell
.
getStringCellValue
(),
richString
,
xxsfFont
);
cell
.
setCellValue
(
richString
);
}
else
{
cell
.
setCellStyle
(
style
);
}
}
}
}
}
...
...
@@ -213,6 +225,21 @@ public class ExcelUtil {
return
workbook
;
}
private
static
void
applyRichStringFont
(
String
sub
,
XSSFRichTextString
richString
,
XSSFFont
xxsfFont
)
{
String
[]
split
=
sub
.
replaceAll
(
"</sub>"
,
"<sub>"
).
split
(
"<sub>"
);
String
it_str
=
""
;
for
(
int
i
=
1
;
i
<
split
.
length
+
1
;
i
++)
{
if
(
i
%
2
!=
0
)
{
it_str
=
it_str
+
split
[
i
-
1
];
}
else
{
richString
.
applyFont
(
it_str
.
length
(),(
it_str
+
split
[
i
-
1
]).
length
()-
1
,
xxsfFont
);
it_str
=
it_str
+
split
[
i
-
1
];
}
}
}
public
static
Workbook
getWorkbookNew
(
String
[]
headers
,
List
<
Object
[]>
datas
)
{
Workbook
workbook
=
new
HSSFWorkbook
();
Sheet
sheet
=
workbook
.
createSheet
();
...
...
cement-business/target/cement-business-1.0-SNAPSHOT.jar.original
View file @
ba3488c5
No preview for this file type
cement-business/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
View file @
ba3488c5
...
...
@@ -393,6 +393,7 @@ cn\wise\sc\cement\business\controller\NonStandardApprovalController.class
cn\wise\sc\cement\business\model\vo\ProductionVo.class
cn\wise\sc\cement\business\service\impl\SysPostServiceImpl.class
cn\wise\sc\cement\business\entity\Entrust.class
cn\wise\sc\cement\business\controller\DataStatisticsController.class
cn\wise\sc\cement\business\controller\SysGroupController.class
cn\wise\sc\cement\business\controller\QualityController.class
cn\wise\sc\cement\business\model\query\ClientQuery.class
...
...
cement-business/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
View file @
ba3488c5
...
...
@@ -261,6 +261,7 @@ D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cemen
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\util\weixin\message\send\NewsMessage.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\model\vo\PlanPeopleVo.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\controller\SysPermissionController.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\controller\DataStatisticsController.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\service\INonStandardApprovalService.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\service\IProjectService.java
D:\idea_workspases\tianjin-cement\cement-business\src\main\java\cn\wise\sc\cement\business\entity\Chinastd.java
...
...
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