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
95982635
Commit
95982635
authored
Jun 09, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'MVP1.5.4' into develop
parents
0e575e63
2bd2a9b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
121 deletions
+133
-121
TMinSalaryServiceImpl.java
...us/v1/yifu/salary/service/impl/TMinSalaryServiceImpl.java
+133
-121
No files found.
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TMinSalaryServiceImpl.java
View file @
95982635
...
...
@@ -159,128 +159,10 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
StringBuilder
errorMessage
=
new
StringBuilder
(
""
);
if
(
Common
.
isEmpty
(
data
.
getId
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"ID为空;"
);
}
else
{
if
(
Common
.
isEmpty
(
baseMapper
.
selectById
(
data
.
getId
())))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"ID不存在无法更新,请核实后再操作!;"
);
}
if
(
Common
.
isEmpty
(
data
.
getLocation
())
&&
Common
.
isEmpty
(
data
.
getSalaryBase
())
&&
Common
.
isEmpty
(
data
.
getStatus
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地、最低工资(元)、状态为空;"
);
}
if
(
null
!=
data
.
getLocation
())
{
if
(
data
.
getLocation
().
contains
(
"-"
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地格式与列表保持一致;"
);
}
}
else
{
if
(
null
!=
data
.
getLocation
())
{
String
location
[]
=
data
.
getLocation
().
split
(
"/"
);
if
(!
data
.
getLocation
().
isEmpty
())
{
if
(
location
.
length
==
1
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地”请精确到市或县/区;"
);
}
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisProvinceName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
}
}
if
(
location
.
length
==
2
)
{
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisProvinceName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
}
String
redisCityName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ONE_INT
]
+
"_"
+
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisCityName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
}
else
{
TMinSalary
entity
=
baseMapper
.
selectById
(
data
.
getId
());
if
(
Common
.
isNotNull
(
entity
))
{
LambdaQueryWrapper
<
TMinSalary
>
query
=
new
LambdaQueryWrapper
<>();
if
(
Common
.
isNotNull
(
redisProvinceName
))
{
query
.
eq
(
TMinSalary:
:
getProvince
,
redisProvinceName
);
}
if
(
Common
.
isNotNull
(
redisCityName
))
{
query
.
eq
(
TMinSalary:
:
getCity
,
redisCityName
);
}
query
.
isNull
(
TMinSalary:
:
getTown
);
query
.
ne
(
TMinSalary:
:
getId
,
data
.
getId
());
long
res
=
baseMapper
.
selectCount
(
query
);
if
(
res
>
CommonConstants
.
ZERO_INT
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"已存在对应区域在用的配置信息;"
);
}
}
}
}
if
(
location
.
length
>
2
)
{
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
String
redisCityName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ONE_INT
]
+
"_"
+
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisCityName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
}
String
redisTownName
=
getRedisAreaValue
(
location
[
CommonConstants
.
TWO_INT
]
+
"_"
+
location
[
CommonConstants
.
ONE_INT
]);
if
(
Common
.
isEmpty
(
redisTownName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
}
else
{
TMinSalary
entity
=
baseMapper
.
selectById
(
data
.
getId
());
if
(
Common
.
isNotNull
(
entity
))
{
LambdaQueryWrapper
<
TMinSalary
>
query
=
new
LambdaQueryWrapper
<>();
if
(
Common
.
isNotNull
(
redisProvinceName
))
{
query
.
eq
(
TMinSalary:
:
getProvince
,
redisProvinceName
);
}
if
(
Common
.
isNotNull
(
redisCityName
))
{
query
.
eq
(
TMinSalary:
:
getCity
,
redisCityName
);
}
if
(
Common
.
isNotNull
(
redisTownName
))
{
query
.
eq
(
TMinSalary:
:
getTown
,
redisTownName
);
}
query
.
ne
(
TMinSalary:
:
getId
,
data
.
getId
());
long
res
=
baseMapper
.
selectCount
(
query
);
if
(
res
>
CommonConstants
.
ZERO_INT
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"已存在对应区域在用的配置信息;"
);
}
}
}
}
}
}
}
if
(
null
!=
data
.
getSalaryBase
())
{
if
(!
ValidityUtil
.
validateStandard
(
data
.
getSalaryBase
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"最低工资,请填写>0的两位小数;"
);
}
}
if
(
null
!=
data
.
getStatus
())
{
if
(!(
CommonConstants
.
START
.
equals
(
data
.
getStatus
())
||
CommonConstants
.
STOP
.
equals
(
data
.
getStatus
())))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"填写的状态不是启用或停用"
);
}
extracted
(
data
,
errorMessage
);
if
(
data
.
isErrorFlag
()){
data
.
setErrorMessage
(
errorMessage
.
toString
());
}
if
(
data
.
isErrorFlag
())
{
data
.
setErrorMessage
(
errorMessage
.
toString
());
}
tMinSalaryImportVoList
.
add
(
data
);
}
...
...
@@ -359,6 +241,136 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
}
private
void
extracted
(
TMinSalaryImportVo
data
,
StringBuilder
errorMessage
)
{
if
(
Common
.
isEmpty
(
data
.
getId
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"ID为空;"
);
return
;
}
else
{
if
(
Common
.
isEmpty
(
baseMapper
.
selectById
(
data
.
getId
())))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"ID不存在无法更新,请核实后再操作!;"
);
return
;
}
if
(
Common
.
isEmpty
(
data
.
getLocation
())
&&
Common
.
isEmpty
(
data
.
getSalaryBase
())
&&
Common
.
isEmpty
(
data
.
getStatus
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地、最低工资(元)、状态为空;"
);
return
;
}
if
(
null
!=
data
.
getLocation
())
{
if
(
data
.
getLocation
().
contains
(
"-"
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地格式与列表保持一致;"
);
return
;
}
}
if
(
null
!=
data
.
getLocation
())
{
String
location
[]
=
data
.
getLocation
().
split
(
"/"
);
if
(!
data
.
getLocation
().
isEmpty
())
{
if
(
location
.
length
==
1
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"所在地”请精确到市或县/区;"
);
return
;
}
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisProvinceName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
return
;
}
}
if
(
location
.
length
==
2
)
{
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisProvinceName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
return
;
}
String
redisCityName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ONE_INT
]
+
"_"
+
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisCityName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
return
;
}
else
{
TMinSalary
entity
=
baseMapper
.
selectById
(
data
.
getId
());
if
(
Common
.
isNotNull
(
entity
))
{
LambdaQueryWrapper
<
TMinSalary
>
query
=
new
LambdaQueryWrapper
<>();
if
(
Common
.
isNotNull
(
redisProvinceName
))
{
query
.
eq
(
TMinSalary:
:
getProvince
,
redisProvinceName
);
}
if
(
Common
.
isNotNull
(
redisCityName
))
{
query
.
eq
(
TMinSalary:
:
getCity
,
redisCityName
);
}
query
.
isNull
(
TMinSalary:
:
getTown
);
query
.
ne
(
TMinSalary:
:
getId
,
data
.
getId
());
long
res
=
baseMapper
.
selectCount
(
query
);
if
(
res
>
CommonConstants
.
ZERO_INT
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"已存在对应区域在用的配置信息;"
);
return
;
}
}
}
}
if
(
location
.
length
>
2
)
{
String
redisProvinceName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ZERO_INT
]);
String
redisCityName
=
getRedisAreaValue
(
location
[
CommonConstants
.
ONE_INT
]
+
"_"
+
location
[
CommonConstants
.
ZERO_INT
]);
if
(
Common
.
isEmpty
(
redisCityName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
return
;
}
String
redisTownName
=
getRedisAreaValue
(
location
[
CommonConstants
.
TWO_INT
]
+
"_"
+
location
[
CommonConstants
.
ONE_INT
]);
if
(
Common
.
isEmpty
(
redisTownName
))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"对应区域不存在;"
);
return
;
}
else
{
TMinSalary
entity
=
baseMapper
.
selectById
(
data
.
getId
());
if
(
Common
.
isNotNull
(
entity
))
{
LambdaQueryWrapper
<
TMinSalary
>
query
=
new
LambdaQueryWrapper
<>();
if
(
Common
.
isNotNull
(
redisProvinceName
))
{
query
.
eq
(
TMinSalary:
:
getProvince
,
redisProvinceName
);
}
if
(
Common
.
isNotNull
(
redisCityName
))
{
query
.
eq
(
TMinSalary:
:
getCity
,
redisCityName
);
}
if
(
Common
.
isNotNull
(
redisTownName
))
{
query
.
eq
(
TMinSalary:
:
getTown
,
redisTownName
);
}
query
.
ne
(
TMinSalary:
:
getId
,
data
.
getId
());
long
res
=
baseMapper
.
selectCount
(
query
);
if
(
res
>
CommonConstants
.
ZERO_INT
)
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"已存在对应区域在用的配置信息;"
);
return
;
}
}
}
}
}
}
if
(
Common
.
isNotNull
(
data
)){
if
(
null
!=
data
.
getSalaryBase
())
{
if
(!
ValidityUtil
.
validateStandard
(
data
.
getSalaryBase
()))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"最低工资,请填写>0的两位小数;"
);
}
}
if
(
null
!=
data
.
getStatus
())
{
if
(!(
CommonConstants
.
START
.
equals
(
data
.
getStatus
())
||
CommonConstants
.
STOP
.
equals
(
data
.
getStatus
())))
{
data
.
setErrorFlag
(
true
);
errorMessage
.
append
(
"填写的状态不是启用或停用"
);
}
}
}
}
private
String
getRedisAreaValue
(
String
areaString
)
{
return
String
.
valueOf
(
RedisUtil
.
redis
.
opsForValue
().
get
(
CacheConstants
.
AREA_VALUE
+
areaString
));
...
...
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