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
97fb9777
Commit
97fb9777
authored
Jan 12, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.装备车辆缓存修改
parent
a2bbd1eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
125 additions
and
52 deletions
+125
-52
CarController.java
...ava/com/yeejoin/equipmanage/controller/CarController.java
+0
-0
EquipmentCategoryController.java
...n/equipmanage/controller/EquipmentCategoryController.java
+19
-0
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+22
-13
EquipmentSpecificController.java
...n/equipmanage/controller/EquipmentSpecificController.java
+20
-1
FireFightingSystemController.java
.../equipmanage/controller/FireFightingSystemController.java
+18
-7
IndustryController.java
...om/yeejoin/equipmanage/controller/IndustryController.java
+7
-6
IFireFightingSystemService.java
...ejoin/equipmanage/service/IFireFightingSystemService.java
+4
-2
ISourceStatistics.java
...va/com/yeejoin/equipmanage/service/ISourceStatistics.java
+7
-0
ApplicationRunnerImpl.java
...ejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
+9
-1
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+0
-0
SourcesStatisticsImpl.java
...ejoin/equipmanage/service/impl/SourcesStatisticsImpl.java
+19
-22
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 @
97fb9777
This source diff could not be displayed because it is too large. You can
view the blob
instead.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentCategoryController.java
View file @
97fb9777
...
...
@@ -10,10 +10,14 @@ import java.util.Set;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.equipmanage.common.enums.SourceTypeEnum
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
import
com.yeejoin.equipmanage.service.ISourceStatistics
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.MediaType
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -73,6 +77,9 @@ public class EquipmentCategoryController extends AbstractBaseController {
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
ISourceStatistics
iSourceStatistics
;
private
static
final
String
equipmentTreeListAll
=
"equipmentTreeListAll"
;
private
static
final
String
equipmentTreeListIndustry
=
"equipmentTreeListIndustry"
;
// 装备redis缓存key前缀
...
...
@@ -90,9 +97,17 @@ public class EquipmentCategoryController extends AbstractBaseController {
@RequestBody
EquipmentCategory
equipmentCategory
)
{
EquipmentCategory
equipmentCategoryInstance
=
iEquipmentCategoryService
.
saveEquipmentCategory
(
equipmentCategory
);
EquipmentCategoryController
controllerProxy
=
SpringUtils
.
getBean
(
EquipmentCategoryController
.
class
);
controllerProxy
.
refreshAllCount
();
return
equipmentCategoryInstance
;
}
@Async
public
void
refreshAllCount
()
{
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
}
/**
* 根据id删除
*
...
...
@@ -138,6 +153,8 @@ public class EquipmentCategoryController extends AbstractBaseController {
if
(
removeFlag
)
{
// 更新缓存
SpringContextHolder
.
publishEvent
(
new
EquipmentTreeListEvent
(
this
,
idSet
,
typeSet
));
EquipmentCategoryController
controllerProxy
=
SpringUtils
.
getBean
(
EquipmentCategoryController
.
class
);
controllerProxy
.
refreshAllCount
();
}
return
CommonResponseUtil
.
success
(
removeFlag
);
}
...
...
@@ -157,6 +174,8 @@ public class EquipmentCategoryController extends AbstractBaseController {
.
eq
(
"group_code"
,
equipmentCategory
.
getCode
()).
set
(
"group_name"
,
equipmentCategory
.
getName
()));
if
(
updateFlag
)
{
// 更新缓存
EquipmentCategoryController
controllerProxy
=
SpringUtils
.
getBean
(
EquipmentCategoryController
.
class
);
controllerProxy
.
refreshAllCount
();
SpringContextHolder
.
publishEvent
(
new
EquipmentTreeListEvent
(
this
,
equipmentCategory
));
}
return
updateFlag
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
97fb9777
...
...
@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO
;
import
com.yeejoin.equipmanage.common.enums.ExcelEnums
;
import
com.yeejoin.equipmanage.common.enums.SourceTypeEnum
;
import
com.yeejoin.equipmanage.common.utils.ExcelUtils
;
import
com.yeejoin.equipmanage.common.utils.NameUtils
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
...
...
@@ -90,6 +91,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Autowired
FireFightingSystemServiceImpl
fireFightingSystemServiceImpl
;
@Autowired
ISourceStatistics
iSourceStatistics
;
/**
* 新增
*
...
...
@@ -99,7 +103,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
EquipmentDetail
saveEquipmentDetail
(
HttpServletRequest
request
,
@RequestBody
EquipmentDetail
equipmentDetail
)
{
EquipmentDetail
detail
=
iEquipmentDetailService
.
saveOne
(
equipmentDetail
);
EquipmentDetail
detail
=
iEquipmentDetailService
.
saveOne
(
equipmentDetail
);
return
detail
;
}
...
...
@@ -110,7 +114,6 @@ public class EquipmentDetailController extends AbstractBaseController {
fireFightingSystemServiceImpl
.
refreshEquipmentTypeAndCount
(
bizOrgCode
);
}
catch
(
Exception
e
)
{
}
}
/**
...
...
@@ -120,7 +123,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
EquipmentDate
saveEquipmentDetail
(
@RequestBody
EquipmentDate
equipmentDate
)
{
if
(
equipmentDate
.
getEquipmentSpecific
().
getSingle
()
==
null
)
{
throw
new
BadRequest
(
"管理方式未输入"
);
}
...
...
@@ -222,7 +225,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改"
,
notes
=
"修改"
)
public
EquipmentDate
updateByIdEquipmentDetail
(
HttpServletRequest
request
,
@RequestBody
EquipmentDate
equipmentDate
)
{
EquipmentSpecific
vo
=
equipmentDate
.
getEquipmentSpecific
();
String
sysCode
=
vo
.
getCode
();
if
(
StringUtils
.
isNotEmpty
(
sysCode
)
&&
StringUtils
.
isNotEmpty
(
sysCode
.
trim
()))
{
...
...
@@ -281,20 +284,20 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
boolean
falg
=
iEquipmentDetailService
.
removeOneById
(
id
);
if
(
falg
)
{
equipmentSpecificSerivce
.
refreshStaData
();
}
return
falg
;
boolean
falg
=
iEquipmentDetailService
.
removeOneById
(
id
);
if
(
falg
)
{
equipmentSpecificSerivce
.
refreshStaData
();
}
return
falg
;
}
@RequestMapping
(
value
=
"/updatequota"
,
method
=
RequestMethod
.
PUT
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改"
,
notes
=
"修改"
)
public
boolean
quotaUpdate
(
HttpServletRequest
request
,
@RequestBody
List
<
EquProperty
>
e
)
{
boolean
falg
=
iEquipmentDetailService
.
quotaUpdate
(
e
);
if
(
falg
)
{
equipmentSpecificSerivce
.
refreshStaData
();
boolean
falg
=
iEquipmentDetailService
.
quotaUpdate
(
e
);
if
(
falg
)
{
equipmentSpecificSerivce
.
refreshStaData
();
}
return
falg
;
}
...
...
@@ -558,10 +561,16 @@ public class EquipmentDetailController extends AbstractBaseController {
ExcelDto
excelDto
=
new
ExcelDto
(
excelEnums
.
getFileName
(),
excelEnums
.
getSheetName
(),
excelEnums
.
getClassUrl
(),
excelEnums
.
getType
());
excelService
.
commonUpload
(
file
,
excelDto
,
getSelectedOrgInfo
(),
getUserInfo
());
// return iStockService.uploadListByTemplate(equipmentDetailDownloadS, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController
controllerProxy
=
SpringUtils
.
getBean
(
EquipmentDetailController
.
class
);
controllerProxy
.
refreshAllCount
();
return
ResponseHelper
.
buildResponse
(
null
);
}
@Async
public
void
refreshAllCount
()
{
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
}
/**
* 设备信息导入
*
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentSpecificController.java
View file @
97fb9777
...
...
@@ -6,6 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
...
...
@@ -46,6 +48,7 @@ import io.swagger.annotations.ApiOperation;
* @date 2020/10/29 14:26
* @since v2.0
*/
@Slf4j
@RestController
@Api
(
tags
=
"单个设备管理"
)
@RequestMapping
(
value
=
"/equipSpecific"
)
...
...
@@ -63,6 +66,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@Value
(
"${systemctl.sync.switch}"
)
private
Boolean
syncSwitch
;
@Autowired
FireFightingSystemServiceImpl
fireFightingSystemServiceImpl
;
/**
* 补码页面分页
*
...
...
@@ -247,7 +253,20 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"删除装备相关所有数据"
,
notes
=
"删除装备相关所有数据"
)
public
ResponseModel
delEquipmentBySpecificId
(
@RequestParam
Long
specificId
)
{
return
CommonResponseUtil
.
success
(
equipmentSpecificSerivce
.
delEquipmentBySpecificId
(
specificId
));
EquipmentSpecific
equipmentSpecific
=
equipmentSpecificSerivce
.
getById
(
specificId
);
Boolean
result
=
equipmentSpecificSerivce
.
delEquipmentSpecific
(
specificId
);
// 同步刷新,不在异步,原因速度3秒左右
this
.
refreshCount
(
equipmentSpecific
.
getBizOrgCode
());
return
CommonResponseUtil
.
success
(
result
);
}
private
void
refreshCount
(
String
bizOrgCode
)
{
try
{
equipmentSpecificSerivce
.
refreshStaData
();
fireFightingSystemServiceImpl
.
refreshEquipmentTypeAndCount
(
bizOrgCode
);
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新装备分类树缓存失败"
+
e
.
getMessage
());
}
}
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireFightingSystemController.java
View file @
97fb9777
...
...
@@ -7,9 +7,12 @@ import java.util.List;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.utils.SpringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.MediaType
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -33,12 +36,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.feign.morphic.model.ResourceDTO
;
import
com.yeejoin.equipmanage.common.entity.EquProperty
;
import
com.yeejoin.equipmanage.common.entity.Equipment
;
import
com.yeejoin.equipmanage.common.entity.EquipmentCategory
;
import
com.yeejoin.equipmanage.common.entity.EquipmentIndex
;
import
com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity
;
import
com.yeejoin.equipmanage.common.entity.ManufacturerInfo
;
import
com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipCountBySystemVO
;
import
com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO
;
...
...
@@ -170,7 +167,21 @@ public class FireFightingSystemController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"装备卡片删除"
)
public
Boolean
delEquipmentSpecific
(
Long
id
)
{
return
equipmentSpecificSerivce
.
delEquipmentSpecific
(
id
);
EquipmentSpecific
equipmentSpecific
=
equipmentSpecificSerivce
.
getById
(
id
);
Boolean
result
=
equipmentSpecificSerivce
.
delEquipmentSpecific
(
id
);
// 同步刷新,不在异步,原因速度3秒左右
this
.
refreshCount
(
equipmentSpecific
.
getBizOrgCode
());
return
result
;
}
private
void
refreshCount
(
String
bizOrgCode
)
{
equipmentSpecificSerivce
.
refreshStaData
();
try
{
fireFightingSystemService
.
refreshEquipmentTypeAndCount
(
bizOrgCode
);
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新装备分类树缓存失败"
+
e
.
getMessage
());
}
}
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/IndustryController.java
View file @
97fb9777
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
java.util.List
;
import
com.yeejoin.equipmanage.common.entity.Industry
;
import
com.yeejoin.equipmanage.service.IIndustryService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.equipmanage.common.entity.Industry
;
import
com.yeejoin.equipmanage.service.IIndustryService
;
import
io.swagger.annotations.Api
;
import
java.util.List
;
@RestController
@Api
(
tags
=
"行业分类Industry"
)
...
...
@@ -19,6 +19,7 @@ public class IndustryController {
@Autowired
IIndustryService
industryService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/list"
)
public
List
<
Industry
>
listAll
()
{
return
industryService
.
list
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java
View file @
97fb9777
...
...
@@ -222,7 +222,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
*/
Object
getCarTypeAndCount
(
String
bizOrgCode
)
throws
Exception
;
public
Object
refreshEquipmentTypeAndCount
(
String
bizOrgCode
)
throws
Exception
;
Object
refreshEquipmentTypeAndCount
(
String
bizOrgCode
)
throws
Exception
;
public
Object
refreshCarTypeAndCount
(
String
bizOrgCode
)
throws
Exception
;
Object
refreshCarTypeAndCount
(
String
bizOrgCode
)
throws
Exception
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/ISourceStatistics.java
View file @
97fb9777
...
...
@@ -13,4 +13,11 @@ public interface ISourceStatistics {
* @return int 数量
*/
int
equipCategoryStatistics
(
String
bizOrgCode
,
SourceTypeEnum
sourceType
,
String
categoryCode
);
/**
* 初始化所有有分类数据(装备、车辆),bizOrgCode + "_" + sourceType.getCode() + "_" + categoryCode
* * 消防装备、消防车辆页面右侧构建分类树,统计装备和车辆数量使用
* * @param sourceType sourceType
*/
void
initAllCategoryStatisticsData
(
SourceTypeEnum
sourceType
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/ApplicationRunnerImpl.java
View file @
97fb9777
...
...
@@ -2,8 +2,10 @@ package com.yeejoin.equipmanage.service.impl;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.equipmanage.common.enums.ConfigPageTopicEnum
;
import
com.yeejoin.equipmanage.common.enums.SourceTypeEnum
;
import
com.yeejoin.equipmanage.listener.IntegratePageDataListener
;
import
com.yeejoin.equipmanage.service.IMaintenanceResourceDataService
;
import
com.yeejoin.equipmanage.service.ISourceStatistics
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.ApplicationArguments
;
...
...
@@ -40,14 +42,20 @@ public class ApplicationRunnerImpl implements ApplicationRunner {
@Value
(
"${redis_equip_type_count}"
)
private
String
equipTypeAndCount
;
@Autowired
ISourceStatistics
iSourceStatistics
;
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
// 清空装备分类树缓存
// 清空
单位
装备分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
carTypeAndCount
+
"*"
);
// 清空车辆分类树缓存
redisUtils
.
getAndDeletePatternKeys
(
equipTypeAndCount
+
"*"
);
// 清空单位分类数量统计缓存
redisUtils
.
getAndDeletePatternKeys
(
SourcesStatisticsImpl
.
PREFIX_CATEGORY_COUNT
+
"*"
);
// 刷新单位分类数量统计
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
EQUIPMENT
);
iSourceStatistics
.
initAllCategoryStatisticsData
(
SourceTypeEnum
.
CAR
);
maintenanceResourceDataService
.
subscribeTopic
();
emqKeeper
.
getMqttClient
().
subscribe
(
ConfigPageTopicEnum
.
INTEGRATE
.
getTopic
(),
2
,
integratePageDataListener
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
97fb9777
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/SourcesStatisticsImpl.java
View file @
97fb9777
...
...
@@ -19,7 +19,7 @@ public class SourcesStatisticsImpl implements ISourceStatistics {
@Autowired
private
RedisUtils
redisUtil
;
public
static
String
PREFIX_CATEGORY_COUNT
=
"CATEGORY_COUNT_"
;
static
String
PREFIX_CATEGORY_COUNT
=
"CATEGORY_COUNT_"
;
@Override
...
...
@@ -31,28 +31,28 @@ public class SourcesStatisticsImpl implements ISourceStatistics {
//求和
return
this
.
sumNumber
(
keys
);
}
else
{
//按照类型插入缓存
Object
bean
=
SpringContextHelper
.
getBean
(
sourceType
.
getBeanName
());
Method
[]
methods
=
bean
.
getClass
().
getDeclaredMethods
();
for
(
Method
method
:
methods
)
{
if
(
method
.
getName
().
equals
(
sourceType
.
getMethodName
()))
{
try
{
method
.
invoke
(
bean
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"更新redis数据失败"
+
e
.
getMessage
());
}
}
}
return
this
.
sumNumberAndInitRedis
(
bizOrgCode
,
sourceType
,
treeCode
,
keys
);
return
0
;
}
}
private
int
sumNumberAndInitRedis
(
String
bizOrgCode
,
SourceTypeEnum
sourceType
,
String
treeCode
,
Set
<
String
>
keys
)
{
int
result
=
this
.
sumNumber
(
keys
);
if
(
result
==
0
){
redisUtil
.
set
(
buildKey
(
bizOrgCode
,
sourceType
.
getCode
(),
treeCode
),
0
,
86400
);
/**
* 系统初始化时调用刷新缓存
* @param sourceType 缓存类型
*/
@Override
public
void
initAllCategoryStatisticsData
(
SourceTypeEnum
sourceType
)
{
//按照类型插入缓存
Object
bean
=
SpringContextHelper
.
getBean
(
sourceType
.
getBeanName
());
Method
[]
methods
=
bean
.
getClass
().
getDeclaredMethods
();
for
(
Method
method
:
methods
)
{
if
(
method
.
getName
().
equals
(
sourceType
.
getMethodName
()))
{
try
{
method
.
invoke
(
bean
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"更新redis数据失败"
+
e
.
getMessage
());
}
}
}
return
result
;
}
private
int
sumNumber
(
Set
<
String
>
keys
)
{
...
...
@@ -69,7 +69,4 @@ public class SourcesStatisticsImpl implements ISourceStatistics {
return
PREFIX_CATEGORY_COUNT
+
bizOrgCode
+
"*_"
+
sourceType
+
"_"
+
treeCode
+
"*"
;
}
private
String
buildKey
(
String
bizOrgCode
,
String
sourceType
,
String
treeCode
)
{
return
PREFIX_CATEGORY_COUNT
+
bizOrgCode
+
"_"
+
sourceType
+
"_"
+
treeCode
;
}
}
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