Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
4541e249
Commit
4541e249
authored
Apr 16, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.6.2-工资原表识别-优化
parent
df62f963
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
14 deletions
+27
-14
TSalaryStandardOriginalServiceImpl.java
...lary/service/impl/TSalaryStandardOriginalServiceImpl.java
+27
-14
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardOriginalServiceImpl.java
View file @
4541e249
...
...
@@ -132,7 +132,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
//数据保存
if
(
Common
.
isNotNull
(
vo
.
getErrorInfo
()))
{
return
R
.
failed
(
vo
);
return
R
.
failed
(
vo
.
getErrorInfo
()
);
}
return
R
.
ok
(
vo
);
}
catch
(
IOException
e
)
{
...
...
@@ -198,7 +198,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
columnVo
=
new
ExcelColumnVo
();
try
{
cell
=
row
.
getCell
(
cellNum
);
if
(
CellType
.
STRING
==
cell
.
getCellType
())
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
cell
.
setCellType
(
CellType
.
STRING
);
cellValue
=
cell
.
getStringCellValue
();
}
else
if
(
CellType
.
STRING
==
cell
.
getCellType
())
{
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
}
else
if
(
CellType
.
NUMERIC
==
cell
.
getCellType
())
{
try
{
...
...
@@ -290,6 +293,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
List
<
Map
<
String
,
String
>>
contentList
;
// 每一行的内容map
Map
<
String
,
String
>
contentMap
;
// 存储每一列有值的表头
Map
<
String
,
String
>
titleMap
=
new
HashMap
<>();
sheets
=
new
XSSFWorkbook
(
inputStream
);
// sheet
XSSFSheet
sheetAt
;
...
...
@@ -325,7 +330,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
columnVo
=
new
ExcelColumnVo
();
try
{
cell
=
row
.
getCell
(
cellNum
);
if
(
CellType
.
STRING
==
cell
.
getCellType
())
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
cell
.
setCellType
(
CellType
.
STRING
);
cellValue
=
cell
.
getStringCellValue
();
}
else
if
(
CellType
.
STRING
==
cell
.
getCellType
())
{
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
}
else
if
(
CellType
.
NUMERIC
==
cell
.
getCellType
())
{
try
{
...
...
@@ -334,7 +342,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue
=
String
.
valueOf
(
new
DecimalFormat
(
"#"
).
format
(
row
.
getCell
(
cellNum
).
getNumericCellValue
()));
}
}
catch
(
NumberFormatException
e
)
{
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getNumericCellValue
());
cell
.
setCellType
(
CellType
.
STRING
);
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getStringCellValue
());
}
}
else
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getDateCellValue
());
...
...
@@ -347,20 +356,24 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
sheetVo
.
setErrorInfo
(
"请注意单元格格式,第"
+
(
i
+
1
)
+
"个sheet,第"
+
(
rowNum
+
1
)
+
"行第"
+
(
cellNum
+
1
)
+
"列。"
+
e
.
getMessage
());
return
sheetVo
;
}
if
(
Common
.
isNotNull
(
cellValue
))
{
if
(
dataRowFlag
if
(
Common
.
isNotNull
(
cellValue
)
&&
dataRowFlag
&&
(((
cellValue
.
length
()
==
15
||
cellValue
.
length
()
==
18
)
&&
regIdCard
(
cellValue
))
// 特殊身份证允许识别
||
regSpecialIdCard
(
cellValue
,
specialIdCardList
)))
{
dataRow
=
rowNum
;
dataRowFlag
=
false
;
}
columnVo
.
setLineNum
(
cellNum
);
columnVo
.
setContent
(
cellValue
);
contentMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
if
(
dataRowFlag
)
{
columnList
.
add
(
columnVo
);
dataRow
=
rowNum
;
dataRowFlag
=
false
;
}
columnVo
.
setLineNum
(
cellNum
);
columnVo
.
setContent
(
cellValue
);
if
(
Common
.
isNotNull
(
cellValue
))
{
titleMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
}
contentMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
if
(
dataRowFlag
)
{
if
(
Common
.
isEmpty
(
cellValue
)
&&
titleMap
.
get
(
String
.
valueOf
(
cellNum
))
!=
null
)
{
columnVo
.
setContent
(
titleMap
.
get
(
String
.
valueOf
(
cellNum
)));
}
columnList
.
add
(
columnVo
);
}
}
if
(!
dataRowFlag
)
{
...
...
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