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
1376b0af
Commit
1376b0af
authored
Jul 01, 2025
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot-module-tcm): 重构企业信息更新逻辑- 异步处理公司信息更新,提高系统稳定性
- 优化错误处理和日志记录,增强系统可追踪性 - 采用CompletableFuture实现异步更新公司信息 - 保留当前请求上下文,确保异步任务执行环境一致
parent
c4dc9c94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
+30
-12
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+30
-12
No files found.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
1376b0af
...
@@ -63,6 +63,7 @@ import org.typroject.tyboot.core.restful.exception.instance.TooManyRequests;
...
@@ -63,6 +63,7 @@ import org.typroject.tyboot.core.restful.exception.instance.TooManyRequests;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -1134,19 +1135,13 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1134,19 +1135,13 @@ public class TzBaseEnterpriseInfoServiceImpl
boolean
b
=
tzBaseEnterpriseInfoService
.
updateById
(
tzBaseEnterpriseInfo
);
boolean
b
=
tzBaseEnterpriseInfoService
.
updateById
(
tzBaseEnterpriseInfo
);
if
(
b
)
{
if
(
b
)
{
log
.
info
(
"更新企业信息, 单位类型 => {}"
,
tzBaseEnterpriseInfo
.
getUseUnitCode
());
CompanyModel
updateModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
String
.
valueOf
(
map
.
get
(
"useCode"
))).
getResult
();
CompanyModel
updateModel
=
Privilege
.
companyClient
.
queryByCompanyCode
(
String
.
valueOf
(
map
.
get
(
"useCode"
))).
getResult
();
HashMap
<
String
,
Object
>
parentMessage
=
(
HashMap
<
String
,
Object
>)
Privilege
.
companyClient
.
queryByOrgcode
(
String
.
valueOf
(
map
.
get
(
"superviseOrgCode"
))).
getResult
();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel
parentModel
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
parentMessage
.
get
(
"compnay"
)),
CompanyModel
.
class
);
updateModel
.
setParentId
(
parentModel
.
getSequenceNbr
());
updateModel
.
setCompanyType
(
regUnitInfo
.
getUnitType
());
// 更新单位类型
updateModel
.
setCompanyType
(
regUnitInfo
.
getUnitType
());
// 更新单位类型
updateCompanyInfo
(
map
,
updateModel
);
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
update
(
updateModel
,
updateModel
.
getSequenceNbr
());
log
.
info
(
"更新企业信息, 单位 => {}"
,
tzBaseEnterpriseInfo
.
getUseUnitCode
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
log
.
error
(
"更新单位错误: {}"
,
companyResult
);
throw
new
BadRequest
(
"更新单位失败!"
);
}
updateUnit
(
map
,
regUnitInfo
,
agencyUserModel
,
updateModel
);
updateUnit
(
map
,
regUnitInfo
,
agencyUserModel
,
updateModel
);
log
.
info
(
"更新企业信息, 注册用户 => {}"
,
tzBaseEnterpriseInfo
.
getUseUnitCode
());
updateUserInfo
(
newData
,
String
.
valueOf
(
map
.
get
(
"useCode"
)));
updateUserInfo
(
newData
,
String
.
valueOf
(
map
.
get
(
"useCode"
)));
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
BeanUtils
.
copyProperties
(
tzBaseEnterpriseInfo
,
tzBaseEnterpriseInfoDto
);
BeanUtils
.
copyProperties
(
tzBaseEnterpriseInfo
,
tzBaseEnterpriseInfoDto
);
...
@@ -1156,8 +1151,8 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1156,8 +1151,8 @@ public class TzBaseEnterpriseInfoServiceImpl
return
null
;
return
null
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"更新失败: "
,
e
);
log
.
error
(
"更新
企业信息
失败: "
,
e
);
throw
new
BadRequest
(
"更新失败!"
);
throw
new
BadRequest
(
"更新
企业信息
失败!"
);
}
}
}
}
...
@@ -1167,6 +1162,29 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -1167,6 +1162,29 @@ public class TzBaseEnterpriseInfoServiceImpl
return
userInfoService
.
personalInfoUpdateById
((
Map
<
String
,
Object
>)
map
.
get
(
"raw"
));
return
userInfoService
.
personalInfoUpdateById
((
Map
<
String
,
Object
>)
map
.
get
(
"raw"
));
}
}
private
void
updateCompanyInfo
(
Map
<
String
,
Object
>
map
,
CompanyModel
updateModel
)
{
String
token
=
RequestContext
.
getToken
();
String
appKey
=
RequestContext
.
getAppKey
();
String
product
=
RequestContext
.
getProduct
();
CompletableFuture
.
runAsync
(()
->
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
);
HashMap
<
String
,
Object
>
parentMessage
=
(
HashMap
<
String
,
Object
>)
Privilege
.
companyClient
.
queryByOrgcode
(
String
.
valueOf
(
map
.
get
(
"superviseOrgCode"
))).
getResult
();
// 目前平台返回key为compnay(存在拼写错误)
CompanyModel
parentModel
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
parentMessage
.
get
(
"compnay"
)),
CompanyModel
.
class
);
updateModel
.
setParentId
(
parentModel
.
getSequenceNbr
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
update
(
updateModel
,
updateModel
.
getSequenceNbr
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
log
.
error
(
"更新单位错误: {}"
,
companyResult
);
throw
new
BadRequest
(
"更新单位失败!"
);
}
});
}
private
void
handleUnitType
(
Map
<
String
,
Object
>
map
,
RegUnitInfo
regUnitInfo
,
AgencyUserModel
agencyUserModel
)
{
private
void
handleUnitType
(
Map
<
String
,
Object
>
map
,
RegUnitInfo
regUnitInfo
,
AgencyUserModel
agencyUserModel
)
{
Object
unitTypeCodesObj
=
map
.
get
(
"unitTypeCodes"
);
Object
unitTypeCodesObj
=
map
.
get
(
"unitTypeCodes"
);
if
(!(
unitTypeCodesObj
instanceof
List
<?>))
{
if
(!(
unitTypeCodesObj
instanceof
List
<?>))
{
...
...
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