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
aecf5217
Commit
aecf5217
authored
Apr 16, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.6.2-工资原表识别-优化
parent
4541e249
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
56 deletions
+69
-56
TSalaryStandardOriginalServiceImpl.java
...lary/service/impl/TSalaryStandardOriginalServiceImpl.java
+69
-56
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardOriginalServiceImpl.java
View file @
aecf5217
...
@@ -163,6 +163,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -163,6 +163,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
List
<
Map
<
String
,
String
>>
contentList
;
List
<
Map
<
String
,
String
>>
contentList
;
// 每一行的内容map
// 每一行的内容map
Map
<
String
,
String
>
contentMap
;
Map
<
String
,
String
>
contentMap
;
// 存储每一列有值的表头
Map
<
String
,
String
>
titleMap
=
new
HashMap
<>();
sheets
=
new
HSSFWorkbook
(
inputStream
);
sheets
=
new
HSSFWorkbook
(
inputStream
);
// sheet
// sheet
HSSFSheet
sheetAt
;
HSSFSheet
sheetAt
;
...
@@ -198,6 +200,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -198,6 +200,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
columnVo
=
new
ExcelColumnVo
();
columnVo
=
new
ExcelColumnVo
();
try
{
try
{
cell
=
row
.
getCell
(
cellNum
);
cell
=
row
.
getCell
(
cellNum
);
if
(
cell
==
null
)
{
cellValue
=
""
;
}
else
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
cell
.
setCellType
(
CellType
.
STRING
);
cell
.
setCellType
(
CellType
.
STRING
);
cellValue
=
cell
.
getStringCellValue
();
cellValue
=
cell
.
getStringCellValue
();
...
@@ -210,25 +215,23 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -210,25 +215,23 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue
=
String
.
valueOf
(
new
DecimalFormat
(
"#"
).
format
(
row
.
getCell
(
cellNum
).
getNumericCellValue
()));
cellValue
=
String
.
valueOf
(
new
DecimalFormat
(
"#"
).
format
(
row
.
getCell
(
cellNum
).
getNumericCellValue
()));
}
}
}
catch
(
NumberFormatException
e
)
{
}
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
))
{
}
else
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getDateCellValue
());
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getDateCellValue
());
}
else
if
(
CellType
.
BOOLEAN
==
cell
.
getCellType
())
{
}
else
if
(
CellType
.
BOOLEAN
==
cell
.
getCellType
())
{
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getBooleanCellValue
());
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getBooleanCellValue
());
}
else
{
}
else
{
try
{
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
}
catch
(
Exception
e
)
{
cellValue
=
String
.
valueOf
(
row
.
getCell
(
cellNum
).
getNumericCellValue
());
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
sheetVo
.
setErrorInfo
(
"请注意单元格格式,第"
+
(
i
+
1
)
+
"个sheet,第"
+
(
rowNum
+
1
)
+
"行第"
+
(
cellNum
+
1
)
+
"列。"
+
e
.
getMessage
());
cellValue
=
""
;
return
sheetVo
;
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage());
//return sheetVo;
}
}
if
(
Common
.
isNotNull
(
cellValue
))
{
if
(
Common
.
isNotNull
(
cellValue
)
&&
dataRowFlag
if
(
dataRowFlag
&&
(((
cellValue
.
length
()
==
15
||
cellValue
.
length
()
==
18
)
&&
regIdCard
(
cellValue
))
&&
(((
cellValue
.
length
()
==
15
||
cellValue
.
length
()
==
18
)
&&
regIdCard
(
cellValue
))
// 特殊身份证允许识别
// 特殊身份证允许识别
||
regSpecialIdCard
(
cellValue
,
specialIdCardList
)))
{
||
regSpecialIdCard
(
cellValue
,
specialIdCardList
)))
{
...
@@ -237,10 +240,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -237,10 +240,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
columnVo
.
setLineNum
(
cellNum
);
columnVo
.
setLineNum
(
cellNum
);
columnVo
.
setContent
(
cellValue
);
columnVo
.
setContent
(
cellValue
);
if
(
Common
.
isNotNull
(
cellValue
))
{
titleMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
}
contentMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
contentMap
.
put
(
String
.
valueOf
(
cellNum
),
cellValue
);
if
(
dataRowFlag
)
{
if
(
dataRowFlag
)
{
columnList
.
add
(
columnVo
);
if
(
Common
.
isEmpty
(
cellValue
)
&&
titleMap
.
get
(
String
.
valueOf
(
cellNum
))
!=
null
)
{
columnVo
.
setContent
(
titleMap
.
get
(
String
.
valueOf
(
cellNum
)));
}
}
columnList
.
add
(
columnVo
);
}
}
}
}
if
(!
dataRowFlag
)
{
if
(!
dataRowFlag
)
{
...
@@ -330,6 +338,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -330,6 +338,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
columnVo
=
new
ExcelColumnVo
();
columnVo
=
new
ExcelColumnVo
();
try
{
try
{
cell
=
row
.
getCell
(
cellNum
);
cell
=
row
.
getCell
(
cellNum
);
if
(
cell
==
null
)
{
cellValue
=
""
;
}
else
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
if
(
cell
.
getCellType
()
==
CellType
.
FORMULA
)
{
cell
.
setCellType
(
CellType
.
STRING
);
cell
.
setCellType
(
CellType
.
STRING
);
cellValue
=
cell
.
getStringCellValue
();
cellValue
=
cell
.
getStringCellValue
();
...
@@ -352,9 +363,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -352,9 +363,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
else
{
}
else
{
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
cellValue
=
row
.
getCell
(
cellNum
).
getStringCellValue
();
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
sheetVo
.
setErrorInfo
(
"请注意单元格格式,第"
+
(
i
+
1
)
+
"个sheet,第"
+
(
rowNum
+
1
)
+
"行第"
+
(
cellNum
+
1
)
+
"列。"
+
e
.
getMessage
());
cellValue
=
""
;
return
sheetVo
;
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage());
//return sheetVo;
}
}
if
(
Common
.
isNotNull
(
cellValue
)
&&
dataRowFlag
if
(
Common
.
isNotNull
(
cellValue
)
&&
dataRowFlag
&&
(((
cellValue
.
length
()
==
15
||
cellValue
.
length
()
==
18
)
&&
regIdCard
(
cellValue
))
&&
(((
cellValue
.
length
()
==
15
||
cellValue
.
length
()
==
18
)
&&
regIdCard
(
cellValue
))
...
...
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