Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
8300c84a
Commit
8300c84a
authored
Jul 10, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 简化单位类型更新逻辑
parent
64d86fd7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
27 deletions
+26
-27
BaseEnterpriseUpdate.java
...common/biz/refresh/commonUpdate/BaseEnterpriseUpdate.java
+24
-17
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+1
-5
EnterpriseRefreshHandler.java
...ule/tcm/biz/refresh/handler/EnterpriseRefreshHandler.java
+1
-5
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/refresh/commonUpdate/BaseEnterpriseUpdate.java
View file @
8300c84a
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.EsBaseEnterpriseInfo;
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.EsBaseEnterpriseInfo;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.thymeleaf.util.ListUtils
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,24 +20,30 @@ public class BaseEnterpriseUpdate {
...
@@ -19,24 +20,30 @@ public class BaseEnterpriseUpdate {
public
final
String
jcjgCode
=
"1233-2"
;
public
final
String
jcjgCode
=
"1233-2"
;
public
String
updateJyjcUnitType
(
String
oldUnitType
,
List
<
EsBaseEnterpriseInfo
.
License
>
unitLicences
)
{
public
String
updateJyjcUnitType
(
String
oldUnitType
,
List
<
EsBaseEnterpriseInfo
.
License
>
unitLicences
)
{
long
jyjgCount
=
unitLicences
.
stream
().
filter
(
e
->
e
.
getCertTypeCode
().
equals
(
jyjgCode
)).
count
();
long
jcjgCount
=
unitLicences
.
stream
().
filter
(
e
->
e
.
getCertTypeCode
().
equals
(
jcjgCode
)).
count
();
// 如果单位类型中包含检验检测机构、检测单位、检验单位,且有资质信息,则更新单位类型
StringBuilder
afterType
=
new
StringBuilder
();
if
((
oldUnitType
.
contains
(
jyjcjg
)
||
oldUnitType
.
contains
(
jydw
)
||
oldUnitType
.
contains
(
jcdw
))
&&
!
ListUtils
.
isEmpty
(
unitLicences
))
{
// 如果资质中不含有检验和检测资质,则不更新单位类型
long
jyjgCount
=
unitLicences
.
stream
().
filter
(
e
->
e
.
getCertTypeCode
().
equals
(
jyjgCode
)).
count
();
if
(
jcjgCount
==
0
&&
jyjgCount
==
0
)
{
long
jcjgCount
=
unitLicences
.
stream
().
filter
(
e
->
e
.
getCertTypeCode
().
equals
(
jcjgCode
)).
count
();
StringBuilder
afterType
=
new
StringBuilder
();
// 如果资质中不含有检验和检测资质,则不更新单位类型
if
(
jcjgCount
==
0
&&
jyjgCount
==
0
)
{
return
oldUnitType
;
}
// 处理旧的单位类型
oldUnitType
=
oldUnitType
.
replace
(
jyjcjg
,
""
).
replace
(
jcdw
,
""
).
replace
(
jydw
,
""
);
oldUnitType
=
oldUnitType
.
replace
(
"##"
,
"#"
);
oldUnitType
=
oldUnitType
.
startsWith
(
"#"
)
?
oldUnitType
.
substring
(
1
)
:
oldUnitType
;
oldUnitType
=
oldUnitType
.
endsWith
(
"#"
)
?
oldUnitType
.
substring
(
0
,
oldUnitType
.
length
()
-
1
)
:
oldUnitType
;
if
(
jcjgCount
>
0
)
{
afterType
.
append
(
"#"
).
append
(
jcdw
);
}
if
(
jyjgCount
>
0
)
{
afterType
.
append
(
"#"
).
append
(
jydw
);
}
return
oldUnitType
+
afterType
;
}
else
{
return
oldUnitType
;
return
oldUnitType
;
}
}
// 处理旧的单位类型
oldUnitType
=
oldUnitType
.
replace
(
jyjcjg
,
""
).
replace
(
jcdw
,
""
).
replace
(
jydw
,
""
);
oldUnitType
=
oldUnitType
.
replace
(
"##"
,
"#"
);
oldUnitType
=
oldUnitType
.
startsWith
(
"#"
)
?
oldUnitType
.
substring
(
1
)
:
oldUnitType
;
oldUnitType
=
oldUnitType
.
endsWith
(
"#"
)
?
oldUnitType
.
substring
(
0
,
oldUnitType
.
length
()
-
1
)
:
oldUnitType
;
if
(
jcjgCount
>
0
)
{
afterType
.
append
(
"#"
).
append
(
jcdw
);
}
if
(
jyjgCount
>
0
)
{
afterType
.
append
(
"#"
).
append
(
jydw
);
}
return
oldUnitType
+
afterType
;
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
View file @
8300c84a
...
@@ -57,7 +57,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -57,7 +57,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StopWatch
;
import
org.thymeleaf.util.ListUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
@@ -1441,10 +1440,7 @@ public class DataHandlerServiceImpl {
...
@@ -1441,10 +1440,7 @@ public class DataHandlerServiceImpl {
return
esLicense
;
return
esLicense
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
esBaseEnterpriseInfo
.
setLicenses
(
licenses
);
esBaseEnterpriseInfo
.
setLicenses
(
licenses
);
if
((
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jyjcjg
)
||
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jydw
)
||
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jcdw
))
&&
!
ListUtils
.
isEmpty
(
licenses
))
{
esBaseEnterpriseInfo
.
setUnitType
(
baseEnterpriseUpdate
.
updateJyjcUnitType
(
enterpriseInfo
.
getUnitType
(),
licenses
));
String
newUnitType
=
baseEnterpriseUpdate
.
updateJyjcUnitType
(
enterpriseInfo
.
getUnitType
(),
licenses
);
esBaseEnterpriseInfo
.
setUnitType
(
newUnitType
);
}
return
esBaseEnterpriseInfo
;
return
esBaseEnterpriseInfo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
enterpriseInfoDao
.
saveAll
(
esBaseEnterpriseInfos
);
enterpriseInfoDao
.
saveAll
(
esBaseEnterpriseInfos
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/refresh/handler/EnterpriseRefreshHandler.java
View file @
8300c84a
...
@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
...
@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.thymeleaf.util.ListUtils
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -78,10 +77,7 @@ public class EnterpriseRefreshHandler implements IDataRefreshHandler {
...
@@ -78,10 +77,7 @@ public class EnterpriseRefreshHandler implements IDataRefreshHandler {
return
esLicense
;
return
esLicense
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
esBaseEnterpriseInfo
.
setLicenses
(
licenses
);
esBaseEnterpriseInfo
.
setLicenses
(
licenses
);
if
((
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jyjcjg
)
||
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jydw
)
||
enterpriseInfo
.
getUnitType
().
contains
(
baseEnterpriseUpdate
.
jcdw
))
&&
!
ListUtils
.
isEmpty
(
licenses
))
{
esBaseEnterpriseInfo
.
setUnitType
(
baseEnterpriseUpdate
.
updateJyjcUnitType
(
enterpriseInfo
.
getUnitType
(),
licenses
));
String
newUnitType
=
baseEnterpriseUpdate
.
updateJyjcUnitType
(
enterpriseInfo
.
getUnitType
(),
licenses
);
esBaseEnterpriseInfo
.
setUnitType
(
newUnitType
);
}
enterpriseInfoDao
.
save
(
esBaseEnterpriseInfo
);
enterpriseInfoDao
.
save
(
esBaseEnterpriseInfo
);
// 人员更新冗余的单位信息
// 人员更新冗余的单位信息
List
<
TzsUserInfo
>
userOfOneUnit
=
userInfoMapper
.
selectList
(
new
LambdaQueryWrapper
<
TzsUserInfo
>().
eq
(
TzsUserInfo:
:
getUnitCode
,
enterpriseInfo
.
getUseUnitCode
()).
eq
(
BaseEntity:
:
getIsDelete
,
false
).
select
(
BaseEntity:
:
getSequenceNbr
));
List
<
TzsUserInfo
>
userOfOneUnit
=
userInfoMapper
.
selectList
(
new
LambdaQueryWrapper
<
TzsUserInfo
>().
eq
(
TzsUserInfo:
:
getUnitCode
,
enterpriseInfo
.
getUseUnitCode
()).
eq
(
BaseEntity:
:
getIsDelete
,
false
).
select
(
BaseEntity:
:
getSequenceNbr
));
...
...
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