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
ba9ddf51
Commit
ba9ddf51
authored
Jan 14, 2022
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
f9fe86b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
27 deletions
+81
-27
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+59
-26
EquipmentCategoryController.java
...n/equipmanage/controller/EquipmentCategoryController.java
+3
-0
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+14
-1
ApplicationRunnerImpl.java
...ejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
+5
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java
View file @
ba9ddf51
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.equipmanage.common.dto.CarInfoDto
;
import
com.yeejoin.equipmanage.common.dto.CarStatusInfoDto
;
...
...
@@ -20,6 +21,7 @@ import com.yeejoin.equipmanage.mapper.*;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.impl.EquipmentSpecificSerivceImpl
;
import
com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
...
...
@@ -111,7 +113,11 @@ public class CarController extends AbstractBaseController {
@Autowired
private
ISyncDataService
syncDataService
;
@Value
(
"${redis_equip_type_count}"
)
private
String
equipTypeAndCount
;
@Value
(
"${redis_car_type_count}"
)
private
String
carTypeAndCount
;
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${security.productApp}"
)
...
...
@@ -132,8 +138,12 @@ public class CarController extends AbstractBaseController {
@Value
(
"${auth-key-fire-iot-equip:fire_iot-equip_info}"
)
private
String
iotAuthKey
;
@Autowired
ISourceStatistics
iSourceStatistics
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
JcsFeign
jcsFeign
;
@Autowired
FireFightingSystemServiceImpl
fireFightingSystemServiceImpl
;
...
...
@@ -179,37 +189,57 @@ public class CarController extends AbstractBaseController {
}
Car
car2
=
iCarService
.
saveOne
(
car
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refresh
Count
(
car
.
getBizOrgCode
()
);
controllerProxy
.
refresh
AllCount
(
);
return
car2
;
}
@Async
public
void
refreshCount
(
String
...
bizOrgCodes
)
{
try
{
// 刷新分类数量缓存
iCarService
.
refreshStaData
();
// 去重逻辑,目的时资源调整归属单位后 新单元和就单位都刷新单位分类数量统计
Set
<
String
>
repeatBizOrgCodes
=
new
HashSet
<>(
Arrays
.
asList
(
bizOrgCodes
));
repeatBizOrgCodes
.
forEach
(
bizOrgCode
->
{
fireFightingSystemServiceImpl
.
refreshCarTypeAndCount
(
bizOrgCode
);
});
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新车辆分类树缓存失败"
+
e
.
getMessage
());
}
}
// @Async
// public void refreshCount(String... bizOrgCodes) {
// try {
// // 刷新分类数量缓存
// iCarService.refreshStaData();
// // 去重逻辑,目的时资源调整归属单位后 新单元和就单位都刷新单位分类数量统计
// Set<String> repeatBizOrgCodes = new HashSet<>(Arrays.asList(bizOrgCodes));
// repeatBizOrgCodes.forEach(bizOrgCode -> {
// fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
// });
// } catch (Exception e) {
// log.error("刷新车辆分类树缓存失败" + e.getMessage());
// }
// }
// @Async
// public void refreshCount(List<Car> list) {
// list.forEach(i -> {
// iCarService.refreshStaData();
// try {
// fireFightingSystemServiceImpl.refreshCarTypeAndCount(i.getBizOrgCode());
// } catch (Exception e) {
// log.error("刷新车辆分类树缓存失败" + e.getMessage());
// }
// });
// }
@Async
public
void
refreshCount
(
List
<
Car
>
list
)
{
list
.
forEach
(
i
->
{
iCarService
.
refreshStaData
();
try
{
fireFightingSystemServiceImpl
.
refreshCarTypeAndCount
(
i
.
getBizOrgCode
());
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新车辆分类树缓存失败"
+
e
.
getMessage
());
}
});
public
void
refreshAllCount
()
{
// 清空单位装备分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
// 清空车辆分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
equipTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
"iotTypeAndCount"
+
"*"
);
// 清空单位分类数量统计缓存
redisUtils
.
getAndDeletePatternKeys
(
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
"*"
);
// 刷新装备单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
// 刷新车辆单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
}
/**
* 根据iotCode查询
*
...
...
@@ -271,7 +301,7 @@ public class CarController extends AbstractBaseController {
Car
oldCar
=
iCarService
.
getById
(
car
.
getId
());
Car
car1
=
iCarService
.
updateOneById
(
car
);
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refresh
Count
(
car
.
getBizOrgCode
(),
oldCar
.
getBizOrgCode
()
);
controllerProxy
.
refresh
AllCount
(
);
return
car1
;
}
...
...
@@ -323,6 +353,9 @@ public class CarController extends AbstractBaseController {
}
}
}
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refreshAllCount
();
return
new
CommonResponse
(
SUCCESS
);
}
}
...
...
@@ -1051,7 +1084,7 @@ public class CarController extends AbstractBaseController {
boolean
flag
=
iCarService
.
removeOneByIds
(
idList
);
if
(
flag
)
{
CarController
controllerProxy
=
SpringUtils
.
getBean
(
CarController
.
class
);
controllerProxy
.
refresh
Count
(
cars
);
controllerProxy
.
refresh
AllCount
(
);
}
return
flag
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentCategoryController.java
View file @
ba9ddf51
...
...
@@ -115,12 +115,15 @@ public class EquipmentCategoryController extends AbstractBaseController {
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
// 清空车辆分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
equipTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
"iotTypeAndCount"
+
"*"
);
// 清空单位分类数量统计缓存
redisUtils
.
getAndDeletePatternKeys
(
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
"*"
);
// 刷新装备单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
// 刷新车辆单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
}
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
ba9ddf51
...
...
@@ -22,6 +22,7 @@ import com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper;
import
com.yeejoin.equipmanage.mapper.StockDetailMapper
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl
;
import
com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl
;
import
com.yeejoin.equipmanage.utils.ExcelUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -79,6 +80,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value
(
"${redis_equip_type_count}"
)
private
String
equipTypeAndCount
;
@Value
(
"${redis_car_type_count}"
)
private
String
carTypeAndCount
;
@Autowired
private
IExcelService
excelService
;
...
...
@@ -585,10 +589,19 @@ public class EquipmentDetailController extends AbstractBaseController {
@Async
public
void
refreshAllCount
()
{
// 清空装备分类树缓存
// 清空单位装备分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
// 清空车辆分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
equipTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
"iotTypeAndCount"
+
"*"
);
// 清空单位分类数量统计缓存
redisUtils
.
getAndDeletePatternKeys
(
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
"*"
);
// 刷新装备单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
// 刷新车辆单位分类数量缓存
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
}
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
View file @
ba9ddf51
...
...
@@ -51,11 +51,16 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
// 清空车辆分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
equipTypeAndCount
+
"*"
);
redisUtils
.
getAndDeletePatternKeys
(
"iotTypeAndCount"
+
"*"
);
// 清空单位分类数量统计缓存
redisUtils
.
getAndDeletePatternKeys
(
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
"*"
);
// 刷新单位分类数量统计
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
IOT
);
maintenanceResourceDataService
.
subscribeTopic
();
emqKeeper
.
getMqttClient
().
subscribe
(
ConfigPageTopicEnum
.
INTEGRATE
.
getTopic
(),
2
,
integratePageDataListener
);
}
...
...
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