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
fc7325e9
Commit
fc7325e9
authored
Sep 13, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.6.10' into MVP1.6.10
parents
58a1d38c
5e5719ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
11 deletions
+43
-11
TSalaryStandardOriginalServiceImpl.java
...lary/service/impl/TSalaryStandardOriginalServiceImpl.java
+43
-11
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardOriginalServiceImpl.java
View file @
fc7325e9
...
@@ -176,7 +176,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -176,7 +176,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
**/
private
R
<
ExcelSheetVo
>
readXls
(
InputStream
inputStream
,
List
<
String
>
specialIdCardList
,
boolean
titleFlag
private
R
<
ExcelSheetVo
>
readXls
(
InputStream
inputStream
,
List
<
String
>
specialIdCardList
,
boolean
titleFlag
,
String
sheetName
,
int
idCardNum
,
Integer
maxColumn
)
throws
IOException
{
,
String
sheetName
,
Integer
idCardNum
,
Integer
maxColumn
)
throws
IOException
{
HSSFWorkbook
sheets
=
null
;
HSSFWorkbook
sheets
=
null
;
ExcelSheetVo
sheetVo
=
new
ExcelSheetVo
();
ExcelSheetVo
sheetVo
=
new
ExcelSheetVo
();
try
{
try
{
...
@@ -200,7 +200,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -200,7 +200,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
// 内容行
int
dataRow
;
int
dataRow
;
// 身份证所在列
// 身份证所在列
int
idCardColumn
=
idCardNum
;
int
idCardColumn
=
-
1
;
if
(
Common
.
isNotNull
(
idCardNum
))
{
idCardColumn
=
idCardNum
;
}
// 空白列起始号
// 空白列起始号
int
nullColumn
=
-
1
;
int
nullColumn
=
-
1
;
// 上一个空白行
// 上一个空白行
...
@@ -449,7 +452,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -449,7 +452,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
**/
private
R
<
ExcelSheetVo
>
readXlsx
(
InputStream
inputStream
,
List
<
String
>
specialIdCardList
,
boolean
titleFlag
private
R
<
ExcelSheetVo
>
readXlsx
(
InputStream
inputStream
,
List
<
String
>
specialIdCardList
,
boolean
titleFlag
,
String
sheetName
,
int
idCardNum
,
Integer
maxColumn
)
throws
IOException
{
,
String
sheetName
,
Integer
idCardNum
,
Integer
maxColumn
)
throws
IOException
{
ExcelSheetVo
sheetVo
=
new
ExcelSheetVo
();
ExcelSheetVo
sheetVo
=
new
ExcelSheetVo
();
Workbook
sheets
=
null
;
Workbook
sheets
=
null
;
try
{
try
{
...
@@ -478,7 +481,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -478,7 +481,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
// 内容行
int
dataRow
;
int
dataRow
;
// 身份证所在列
// 身份证所在列
int
idCardColumn
=
idCardNum
;
int
idCardColumn
=
-
1
;
if
(
Common
.
isNotNull
(
idCardNum
))
{
idCardColumn
=
idCardNum
;
}
// 空白列起始号
// 空白列起始号
int
nullColumn
=
-
1
;
int
nullColumn
=
-
1
;
// 上一个空白行
// 上一个空白行
...
@@ -806,8 +812,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -806,8 +812,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
List
<
TSalaryStandardOriginalDetail
>
detailList
=
tSalaryStandardOriginalDetailService
.
getTSalaryStandardOriginalDetailByOrgId
(
originalId
);
List
<
TSalaryStandardOriginalDetail
>
detailList
=
tSalaryStandardOriginalDetailService
.
getTSalaryStandardOriginalDetailByOrgId
(
originalId
);
Map
<
String
,
TSalaryStandardOriginalDetail
>
detailMap
=
new
HashMap
<>();
Map
<
String
,
TSalaryStandardOriginalDetail
>
detailMap
=
new
HashMap
<>();
int
idCardNum
=
-
1
;
Integer
idCardNum
=
-
1
;
if
(
detailList
==
null
||
detailList
.
isEmpty
()
||
detailList
.
size
()
<
4
)
{
if
(
detailList
==
null
||
detailList
.
isEmpty
()
||
detailList
.
size
()
<
3
)
{
return
R
.
failed
(
"请检查表头配置!!"
);
return
R
.
failed
(
"请检查表头配置!!"
);
}
}
// 忽略配置的表头,额外的表头
// 忽略配置的表头,额外的表头
...
@@ -832,6 +838,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -832,6 +838,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
// 不固定表头配置
// 不固定表头配置
Map
<
String
,
TSalaryStandardOriginalDetail
>
notFixedTitleMap
=
new
HashMap
<>();
Map
<
String
,
TSalaryStandardOriginalDetail
>
notFixedTitleMap
=
new
HashMap
<>();
// 用来检测 不固定表头配置的表头,有没有都在
Map
<
String
,
Integer
>
notFixedKeyMap
=
new
HashMap
<>();
// 判断是否已重复存在
// 判断是否已重复存在
Map
<
String
,
Integer
>
curMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
curMap
=
new
HashMap
<>();
...
@@ -841,6 +849,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -841,6 +849,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
detail
.
setModelName
(
detail
.
getExcelName
());
detail
.
setModelName
(
detail
.
getExcelName
());
}
else
if
(
SalaryConstants
.
ID_NUMBER
.
equals
(
detail
.
getModelName
()))
{
}
else
if
(
SalaryConstants
.
ID_NUMBER
.
equals
(
detail
.
getModelName
()))
{
idCardNum
=
detail
.
getColumnNo
();
idCardNum
=
detail
.
getColumnNo
();
if
(!
isFixedColumn
)
{
idCardNum
=
null
;
}
}
}
if
(
isFixedColumn
)
{
if
(
isFixedColumn
)
{
detailMap
.
put
(
String
.
valueOf
(
detail
.
getColumnNo
()),
detail
);
detailMap
.
put
(
String
.
valueOf
(
detail
.
getColumnNo
()),
detail
);
...
@@ -848,8 +859,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -848,8 +859,10 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if
(
Common
.
isNotNull
(
detail
.
getModelName
())
||
ignoreMap
.
get
(
detail
.
getExcelName
())
!=
null
)
{
if
(
Common
.
isNotNull
(
detail
.
getModelName
())
||
ignoreMap
.
get
(
detail
.
getExcelName
())
!=
null
)
{
if
(
Common
.
isNotNull
(
detail
.
getExcelKey
()))
{
if
(
Common
.
isNotNull
(
detail
.
getExcelKey
()))
{
notFixedTitleMap
.
put
(
detail
.
getExcelKey
(),
detail
);
notFixedTitleMap
.
put
(
detail
.
getExcelKey
(),
detail
);
notFixedKeyMap
.
put
(
detail
.
getExcelKey
(),
CommonConstants
.
ONE_INT
);
}
else
{
}
else
{
notFixedTitleMap
.
put
(
detail
.
getExcelName
(),
detail
);
notFixedTitleMap
.
put
(
detail
.
getExcelName
(),
detail
);
notFixedKeyMap
.
put
(
detail
.
getExcelName
(),
CommonConstants
.
ONE_INT
);
}
}
}
}
}
}
...
@@ -902,8 +915,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -902,8 +915,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
boolean
isOther
;
boolean
isOther
;
// 重复存在的表头值
// 重复存在的表头值
Integer
curValue
;
Integer
curValue
;
StringBuilder
repetitiveKey
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
vo
.
getTitleList
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
vo
.
getTitleList
().
size
();
i
++)
{
isError
=
true
;
rule
=
"等于"
;
rule
=
"等于"
;
title
=
vo
.
getTitleList
().
get
(
i
);
title
=
vo
.
getTitleList
().
get
(
i
);
titleStr
=
title
.
getContent
();
titleStr
=
title
.
getContent
();
...
@@ -931,6 +944,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -931,6 +944,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if
(
Common
.
isNotNull
(
detailSet
.
getExcelRule
()))
{
if
(
Common
.
isNotNull
(
detailSet
.
getExcelRule
()))
{
rule
=
detailSet
.
getExcelRule
();
rule
=
detailSet
.
getExcelRule
();
}
}
if
(
Common
.
isEmpty
(
rule
))
{
rule
=
"等于"
;
}
switch
(
rule
)
{
switch
(
rule
)
{
case
"等于"
:
isError
=
!
titleStr
.
equals
(
key
);
break
;
case
"等于"
:
isError
=
!
titleStr
.
equals
(
key
);
break
;
case
"包含"
:
isError
=
!
titleStr
.
contains
(
key
);
break
;
case
"包含"
:
isError
=
!
titleStr
.
contains
(
key
);
break
;
...
@@ -946,6 +962,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -946,6 +962,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
for
(
Map
.
Entry
<
String
,
TSalaryStandardOriginalDetail
>
entry
:
notFixedTitleMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
TSalaryStandardOriginalDetail
>
entry
:
notFixedTitleMap
.
entrySet
())
{
key
=
entry
.
getKey
();
key
=
entry
.
getKey
();
rule
=
entry
.
getValue
().
getExcelRule
();
rule
=
entry
.
getValue
().
getExcelRule
();
if
(
Common
.
isEmpty
(
rule
))
{
rule
=
"等于"
;
}
switch
(
rule
)
{
switch
(
rule
)
{
case
"等于"
:
isFixError
=
!
titleStr
.
equals
(
key
);
break
;
case
"等于"
:
isFixError
=
!
titleStr
.
equals
(
key
);
break
;
case
"包含"
:
isFixError
=
!
titleStr
.
contains
(
key
);
break
;
case
"包含"
:
isFixError
=
!
titleStr
.
contains
(
key
);
break
;
...
@@ -953,20 +972,23 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -953,20 +972,23 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
// 表示匹配到了
// 表示匹配到了
if
(!
isFixError
)
{
if
(!
isFixError
)
{
isError
=
false
;
curValue
=
curMap
.
get
(
key
);
curValue
=
curMap
.
get
(
key
);
if
(
Common
.
isNotNull
(
curValue
))
{
if
(
Common
.
isNotNull
(
curValue
))
{
re
turn
R
.
failed
(
"监测到多个“关键字"
+
key
+
"”,请检查调整后再次提交
"
);
re
petitiveKey
.
append
(
key
).
append
(
";
"
);
}
else
{
}
else
{
curMap
.
put
(
key
,
1
);
curMap
.
put
(
key
,
1
);
}
}
// 存储适配map,以做识别内容
// 存储适配map,以做识别内容
detailMap
.
put
(
String
.
valueOf
(
title
.
getLineNum
()),
entry
.
getValue
());
detailMap
.
put
(
String
.
valueOf
(
title
.
getLineNum
()),
entry
.
getValue
());
notFixedKeyMap
.
remove
(
key
);
break
;
break
;
}
}
}
}
if
(
isError
&&
isOther
)
{
detailSet
=
detailMap
.
get
(
String
.
valueOf
(
title
.
getLineNum
()));
return
R
.
failed
(
"未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!"
);
if
(
detailSet
==
null
&&
!
isOther
)
{
detail
=
new
TSalaryStandardOriginalDetail
();
detail
.
setModelName
(
titleStr
);
detailMap
.
put
(
String
.
valueOf
(
title
.
getLineNum
()),
detail
);
}
}
}
}
}
else
if
(
isFixedColumn
&&
detailMap
.
get
(
String
.
valueOf
(
title
.
getLineNum
()))
!=
null
&&
Common
.
isNotNull
(
detailMap
.
get
(
String
.
valueOf
(
title
.
getLineNum
())).
getExcelName
()))
{
}
else
if
(
isFixedColumn
&&
detailMap
.
get
(
String
.
valueOf
(
title
.
getLineNum
()))
!=
null
&&
Common
.
isNotNull
(
detailMap
.
get
(
String
.
valueOf
(
title
.
getLineNum
())).
getExcelName
()))
{
...
@@ -974,6 +996,16 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
...
@@ -974,6 +996,16 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!")
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!")
}
}
}
}
if
(
repetitiveKey
.
length
()
>
0
)
{
return
R
.
failed
(
"检测到关键字重复:"
+
repetitiveKey
+
" 请检查调整后再次提交"
);
}
if
(
notFixedKeyMap
.
size
()
>
0
)
{
StringBuilder
titles
=
new
StringBuilder
();
for
(
String
keyStr
:
notFixedTitleMap
.
keySet
())
{
titles
.
append
(
keyStr
).
append
(
";"
);
}
return
R
.
failed
(
"配置的表头未找到:"
+
titles
);
}
}
else
{
}
else
{
return
R
.
failed
(
"表格没有表头,请检查表格数据!"
);
return
R
.
failed
(
"表格没有表头,请检查表格数据!"
);
}
}
...
...
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