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
7f3f2707
Commit
7f3f2707
authored
Jul 19, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.定时任务后端处理生成二维码
parent
179baeee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+12
-17
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/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
7f3f2707
...
...
@@ -50,6 +50,8 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
...
...
@@ -82,6 +84,7 @@ import java.util.stream.Stream;
* @date 2022-08-09
*/
@Service
@EnableScheduling
public
class
RegUnitInfoServiceImpl
extends
BaseService
<
RegUnitInfoDto
,
RegUnitInfo
,
RegUnitInfoMapper
>
implements
IRegUnitInfoService
{
...
...
@@ -209,14 +212,6 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if
(
log
.
isDebugEnabled
()){
log
.
debug
(
"注册总耗时:==》"
+
watch
.
getTotalTimeSeconds
());
}
//9.事务提交后,异步创建企业的二维码
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
(){
RegUnitInfoServiceImpl
proxy
=
applicationContext
.
getBean
(
RegUnitInfoServiceImpl
.
class
);
proxy
.
asyncSetQrCode
(
model
);
}
});
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
// 失败后回滚:删除已经创建的企业信息
...
...
@@ -240,15 +235,15 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
return
model
;
}
@
Async
public
void
asyncSetQrCode
(
RegUnitInfoDto
regUnitInfoDto
){
TzBaseEnterpriseInfo
useCodeResult
=
tzBaseEnterpriseInfoMapper
.
selectOne
(
new
QueryWrapper
<
TzBaseEnterpriseInfo
>().
eq
(
"use_code"
,
regUnitInfoDto
.
getUnitCode
()));
if
(
ObjectUtils
.
isEmpty
(
useCodeResult
))
{
useCodeResult
.
setQrCode
(
createQRCode
(
regUnitInfoDto
.
getUnitCode
())
);
}
else
{
useCodeResult
.
setQrCode
(
ObjectUtils
.
isEmpty
(
useCodeResult
.
getQrCode
())
?
createQRCode
(
regUnitInfoDto
.
getUnitCode
())
:
useCodeResult
.
getQrCode
()
);
}
tzBaseEnterpriseInfoService
.
saveOrUpdate
(
useCodeResul
t
);
@
Scheduled
(
cron
=
"* 0/1 * * * ?"
)
public
void
asyncSetQrCode
(){
//给所有新注册的企业创建二维码,每次处理100个,不排序
LambdaQueryWrapper
<
TzBaseEnterpriseInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
notLike
(
TzBaseEnterpriseInfo:
:
getQrCode
,
"upload"
);
wrapper
.
last
(
"limit 100"
);
List
<
TzBaseEnterpriseInfo
>
noQrCodeList
=
tzBaseEnterpriseInfoMapper
.
selectList
(
wrapper
);
noQrCodeList
.
forEach
(
e
->
e
.
setQrCode
(
createQRCode
(
e
.
getUseCode
())));
tzBaseEnterpriseInfoService
.
saveOrUpdate
Batch
(
noQrCodeLis
t
);
}
private
FutureTask
<
ResponseModel
<
Boolean
>>
getResponseModelFutureTask
(
RegUnitInfoDto
model
)
{
...
...
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