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
a9dd0c82
Commit
a9dd0c82
authored
Apr 29, 2022
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加线程池
parent
f9b381f8
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
69 additions
and
18 deletions
+69
-18
EquipExecutorConfig.java
...a/com/yeejoin/equipmanage/config/EquipExecutorConfig.java
+40
-0
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+1
-1
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+16
-5
EquipmentTreeListListener.java
...ejoin/equipmanage/listener/EquipmentTreeListListener.java
+1
-1
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+2
-2
EquipmentSpecificSerivceImpl.java
...quipmanage/service/impl/EquipmentSpecificSerivceImpl.java
+3
-3
MainIotMonitorServiceImpl.java
...n/equipmanage/service/impl/MainIotMonitorServiceImpl.java
+1
-1
MaintenanceResourceDataServiceImpl.java
...nage/service/impl/MaintenanceResourceDataServiceImpl.java
+1
-1
StockServiceImpl.java
...om/yeejoin/equipmanage/service/impl/StockServiceImpl.java
+1
-1
SyncDataServiceImpl.java
...yeejoin/equipmanage/service/impl/SyncDataServiceImpl.java
+2
-2
RelationRedisUtil.java
...java/com/yeejoin/equipmanage/utils/RelationRedisUtil.java
+1
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/config/EquipExecutorConfig.java
0 → 100644
View file @
a9dd0c82
package
com
.
yeejoin
.
equipmanage
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
@Slf4j
@Configuration
@EnableAsync
public
class
EquipExecutorConfig
{
@Bean
(
name
=
"equipAsyncExecutor"
)
public
Executor
asyncServiceExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
//配置核心线程数
executor
.
setCorePoolSize
(
10
);
//配置最大线程数
executor
.
setMaxPoolSize
(
100
);
//配置队列大小
executor
.
setQueueCapacity
(
1000
);
//配置线程池中的线程的名称前缀
executor
.
setThreadNamePrefix
(
"namePrefix"
);
//线程池维护线程所允许的空闲时间
executor
.
setKeepAliveSeconds
(
30
);
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
// CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行--拒绝策略
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
//执行初始化
executor
.
initialize
();
//等待所有任务结束后再关闭线程池
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
return
executor
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
a9dd0c82
...
@@ -236,7 +236,7 @@ public class CarController extends AbstractBaseController {
...
@@ -236,7 +236,7 @@ public class CarController extends AbstractBaseController {
@Async
@Async
(
"equipAsyncExecutor"
)
public
void
refreshAllCount
()
{
public
void
refreshAllCount
()
{
// 清空单位装备分类树缓存
// 清空单位装备分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
a9dd0c82
...
@@ -127,7 +127,7 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -127,7 +127,7 @@ public class EquipmentDetailController extends AbstractBaseController {
return
detail
;
return
detail
;
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
public
void
refreshCount
(
String
...
bizOrgCodes
)
{
public
void
refreshCount
(
String
...
bizOrgCodes
)
{
try
{
try
{
equipmentSpecificSerivce
.
refreshStaData
();
equipmentSpecificSerivce
.
refreshStaData
();
...
@@ -604,12 +604,23 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -604,12 +604,23 @@ public class EquipmentDetailController extends AbstractBaseController {
@Async
@Async
(
"equipAsyncExecutor"
)
public
void
commonUpload
(
MultipartFile
file
,
ExcelDto
excelDto
,
String
key
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
public
void
commonUpload
(
MultipartFile
file
,
ExcelDto
excelDto
,
String
key
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
synchronized
(
this
.
getClass
()){
Object
date
=
""
;
Object
date
=
""
;
Map
<
String
,
Object
>
map
=
new
HashMap
();
try
{
synchronized
(
this
.
getClass
()){
date
=
excelService
.
commonUpload
(
file
,
excelDto
,
reginParams
,
user
);
date
=
excelService
.
commonUpload
(
file
,
excelDto
,
reginParams
,
user
);
redisUtils
.
set
(
key
,
date
);
map
.
put
(
"flag"
,
"0"
);
map
.
put
(
"date"
,
date
);
redisUtils
.
set
(
key
,
map
);
}
}
catch
(
Exception
e
)
{
map
.
put
(
"flag"
,
"1"
);
map
.
put
(
"date"
,
e
.
getMessage
());
redisUtils
.
set
(
key
,
map
);
e
.
printStackTrace
();
}
}
}
}
...
@@ -628,7 +639,7 @@ public class EquipmentDetailController extends AbstractBaseController {
...
@@ -628,7 +639,7 @@ public class EquipmentDetailController extends AbstractBaseController {
return
ResponseHelper
.
buildResponse
(
null
);
return
ResponseHelper
.
buildResponse
(
null
);
}
}
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
public
void
refreshAllCount
()
{
public
void
refreshAllCount
()
{
// 清空单位装备分类树缓存
// 清空单位装备分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/listener/EquipmentTreeListListener.java
View file @
a9dd0c82
...
@@ -29,7 +29,7 @@ public class EquipmentTreeListListener implements ApplicationListener<EquipmentT
...
@@ -29,7 +29,7 @@ public class EquipmentTreeListListener implements ApplicationListener<EquipmentT
@Autowired
@Autowired
IEquipmentCategoryService
iEquipmentCategoryService
;
IEquipmentCategoryService
iEquipmentCategoryService
;
@Async
@Async
(
"equipAsyncExecutor"
)
@Override
@Override
public
void
onApplicationEvent
(
EquipmentTreeListEvent
event
)
{
public
void
onApplicationEvent
(
EquipmentTreeListEvent
event
)
{
// 更新redis全量装备树
// 更新redis全量装备树
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
a9dd0c82
...
@@ -1116,7 +1116,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1116,7 +1116,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
@Override
@Override
@Async
@Async
(
"equipAsyncExecutor"
)
public
FireVehicle
getFireVehicleDetailById
(
Long
id
)
{
public
FireVehicle
getFireVehicleDetailById
(
Long
id
)
{
return
carMapper
.
getFireVehicleDetailById
(
id
);
return
carMapper
.
getFireVehicleDetailById
(
id
);
}
}
...
@@ -1187,7 +1187,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
...
@@ -1187,7 +1187,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return
""
;
return
""
;
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
void
dataSyncSaveOrUpdate
(
Car
car
)
{
void
dataSyncSaveOrUpdate
(
Car
car
)
{
CarIndexVo
carIndexVo
=
new
CarIndexVo
();
CarIndexVo
carIndexVo
=
new
CarIndexVo
();
carIndexVo
.
setId
(
car
.
getId
());
carIndexVo
.
setId
(
car
.
getId
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java
View file @
a9dd0c82
...
@@ -1157,7 +1157,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1157,7 +1157,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
}
@Override
@Override
@Async
@Async
(
"equipAsyncExecutor"
)
public
void
equipSpecificDataSync
(
Long
equipmentId
)
{
public
void
equipSpecificDataSync
(
Long
equipmentId
)
{
// TODO 放大范围,根据equipment_id同步
// TODO 放大范围,根据equipment_id同步
List
<
FireEquipment
>
specificDetails
=
getEquipSpecificDetailsByEquipmentId
(
equipmentId
);
List
<
FireEquipment
>
specificDetails
=
getEquipSpecificDetailsByEquipmentId
(
equipmentId
);
...
@@ -1548,7 +1548,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1548,7 +1548,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndexSerivce
.
saveBatch
(
equipmentSpecificIndices
);
equipmentSpecificIndexSerivce
.
saveBatch
(
equipmentSpecificIndices
);
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
void
initEquipmentSystemSourceStatistics
(
List
<
EquipmentSpecific
>
equipmentSpecifics
)
{
void
initEquipmentSystemSourceStatistics
(
List
<
EquipmentSpecific
>
equipmentSpecifics
)
{
List
<
EquipmentSystemSourceStatistics
>
list
=
new
ArrayList
<>();
List
<
EquipmentSystemSourceStatistics
>
list
=
new
ArrayList
<>();
equipmentSpecifics
.
parallelStream
().
forEach
(
x
->
{
equipmentSpecifics
.
parallelStream
().
forEach
(
x
->
{
...
@@ -1600,7 +1600,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
...
@@ -1600,7 +1600,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
*
*
* @param systemTypeCode
* @param systemTypeCode
*/
*/
@Async
@Async
(
"equipAsyncExecutor"
)
@Override
@Override
public
void
integrationPageSysDataRefresh
(
String
systemTypeCode
)
{
public
void
integrationPageSysDataRefresh
(
String
systemTypeCode
)
{
if
(
ObjectUtils
.
isEmpty
(
systemTypeCode
))
{
if
(
ObjectUtils
.
isEmpty
(
systemTypeCode
))
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MainIotMonitorServiceImpl.java
View file @
a9dd0c82
...
@@ -288,7 +288,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
...
@@ -288,7 +288,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
}
}
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
void
updateEquipmentSystemSourceStatistics
(
EquipmentSpecific
equipmentSpecific
,
int
status
){
void
updateEquipmentSystemSourceStatistics
(
EquipmentSpecific
equipmentSpecific
,
int
status
){
QueryWrapper
<
EquipmentSystemSourceStatistics
>
wrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
EquipmentSystemSourceStatistics
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"equipment_specific_id"
,
equipmentSpecific
.
getId
());
wrapper
.
eq
(
"equipment_specific_id"
,
equipmentSpecific
.
getId
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MaintenanceResourceDataServiceImpl.java
View file @
a9dd0c82
...
@@ -133,7 +133,7 @@ public class MaintenanceResourceDataServiceImpl extends ServiceImpl<MaintenanceR
...
@@ -133,7 +133,7 @@ public class MaintenanceResourceDataServiceImpl extends ServiceImpl<MaintenanceR
return
0
;
return
0
;
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
void
deleteRelationMainResData
(
List
<
Long
>
ids
)
{
void
deleteRelationMainResData
(
List
<
Long
>
ids
)
{
try
{
try
{
maintenanceFeign
.
pointDelete
(
Joiner
.
on
(
","
).
join
(
ids
));
maintenanceFeign
.
pointDelete
(
Joiner
.
on
(
","
).
join
(
ids
));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/StockServiceImpl.java
View file @
a9dd0c82
...
@@ -266,7 +266,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
...
@@ -266,7 +266,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
return
stockBill
;
return
stockBill
;
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
void
initEquipmentSystemSourceStatistics
(
List
<
EquipmentSpecific
>
equipmentSpecifics
)
{
void
initEquipmentSystemSourceStatistics
(
List
<
EquipmentSpecific
>
equipmentSpecifics
)
{
List
<
EquipmentSystemSourceStatistics
>
list
=
new
ArrayList
<>();
List
<
EquipmentSystemSourceStatistics
>
list
=
new
ArrayList
<>();
equipmentSpecifics
.
parallelStream
().
forEach
(
x
->
{
equipmentSpecifics
.
parallelStream
().
forEach
(
x
->
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SyncDataServiceImpl.java
View file @
a9dd0c82
...
@@ -59,7 +59,7 @@ import com.yeejoin.equipmanage.utils.SyncDataUtil;
...
@@ -59,7 +59,7 @@ import com.yeejoin.equipmanage.utils.SyncDataUtil;
* @Date 2021-04-01 14:28
* @Date 2021-04-01 14:28
*/
*/
@Service
(
"syncDataService"
)
@Service
(
"syncDataService"
)
@Async
@Async
(
"equipAsyncExecutor"
)
public
class
SyncDataServiceImpl
implements
ISyncDataService
{
public
class
SyncDataServiceImpl
implements
ISyncDataService
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SyncDataServiceImpl
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SyncDataServiceImpl
.
class
);
...
@@ -511,7 +511,7 @@ public class SyncDataServiceImpl implements ISyncDataService {
...
@@ -511,7 +511,7 @@ public class SyncDataServiceImpl implements ISyncDataService {
}
}
}
}
@Async
@Async
(
"equipAsyncExecutor"
)
@Override
@Override
public
void
saveOrUpdateEquipIotCodeRedisData
(
List
<
EquipmentSpecificVo
>
data
)
{
public
void
saveOrUpdateEquipIotCodeRedisData
(
List
<
EquipmentSpecificVo
>
data
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/utils/RelationRedisUtil.java
View file @
a9dd0c82
...
@@ -34,7 +34,7 @@ public class RelationRedisUtil {
...
@@ -34,7 +34,7 @@ public class RelationRedisUtil {
@Autowired
@Autowired
private
FireFightingSystemMapper
fireFightingSystemMapper
;
private
FireFightingSystemMapper
fireFightingSystemMapper
;
@Async
@Async
(
"equipAsyncExecutor"
)
public
Boolean
delSysRedisKey
(
String
systemId
)
{
public
Boolean
delSysRedisKey
(
String
systemId
)
{
if
(
StringUtils
.
isNotBlank
(
systemId
))
{
if
(
StringUtils
.
isNotBlank
(
systemId
))
{
QueryWrapper
<
FireFightingSystemEntity
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
FireFightingSystemEntity
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
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