Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bill-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
bill-platform
Commits
5a51f004
Commit
5a51f004
authored
Jul 24, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改评价统计更新与组合查询
parent
5c3c720a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
46 deletions
+120
-46
bill-manager/src/main/java/com/mortals/xhx/common/key/RedisKey.java
...er/src/main/java/com/mortals/xhx/common/key/RedisKey.java
+13
-31
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
+107
-15
No files found.
bill-manager/src/main/java/com/mortals/xhx/common/key/RedisKey.java
View file @
5a51f004
...
...
@@ -5,51 +5,33 @@ package com.mortals.xhx.common.key;
*/
public
class
RedisKey
{
public
static
final
String
KEY_USER_MENU_CACHE
=
"user:menu"
;
/**
*
登录 key
*
站点--排号--业务--count
*/
public
static
final
String
KEY_
MENU_CACHE
=
"iot:base:MenuCacheKey
:"
;
public
static
final
String
KEY_
SITE_QUEUE_BUSNIESS_CHCHE
=
"site:queue:busniess
:"
;
/**
*
设备心跳上报
*
站点--排号--部门--count
*/
public
static
final
String
KEY_DEVICE_ONLINE_CACHE
=
"device:online:"
;
public
static
final
String
KEY_SITE_QUEUE_SECTIONNAME_CHCHE
=
"site:queue:sectionname:"
;
/**
*
设备上线更新队列
*
站点--排号--窗口--count
*/
public
static
final
String
KEY_
DEVICE_ONLINE_QUEUE
=
"device:queue
"
;
public
static
final
String
KEY_
SITE_QUEUE_WINDOW_CHCHE
=
"site:queue:window:
"
;
/**
* 设备更新队列
*/
public
static
final
String
KEY_DEVICE_UPDATE_QUEUE
=
"device:update:queue"
;
/**
*
设备通知外部更新队列
*
站点--评价--部门--count
*/
public
static
final
String
KEY_
DEVICE_THIRDPARTY_QUEUE
=
"device:thirdparty:queue
"
;
public
static
final
String
KEY_
SITE_PJ_SECTIONNAME_CHCHE
=
"site:pj:sectionname:
"
;
/**
*
下发消息队列
*
站点--评价--窗口--count
*/
public
static
final
String
KEY_DEVICE_DOWN_MSG_QUEUE
=
"device:down:msg:queue"
;
public
static
final
String
KEY_SITE_CACHE
=
"siteDict"
;
public
static
final
String
KEY_PLATFORM_CACHE
=
"platformDict"
;
public
static
final
String
KEY_SITE_PJ_WINDOW_CHCHE
=
"site:pj:window:"
;
public
static
final
String
KEY_PRODUCT_CACHE
=
"productDict"
;
public
static
final
String
KEY_TOKEN_API_CACHE
=
"token:api:"
;
public
static
final
String
KEY_USER_MENU_CACHE
=
"user:menu"
;
/**
* 设备资源路径缓存
*/
public
static
final
String
KEY_DEVICE_DISBUTE_PATH_CHCHE
=
"device:homeurl:chche:"
;
}
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
View file @
5a51f004
...
...
@@ -4,21 +4,28 @@ import cn.hutool.core.date.DateTime;
import
cn.hutool.core.date.DateUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ITask
;
import
com.mortals.framework.service.ITaskExcuteService
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.keys.RedisCacheKeys
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.ph.model.PhQueueStatEntity
;
import
com.mortals.xhx.module.ph.model.PhQueueStatQuery
;
import
com.mortals.xhx.module.ph.service.PhQueueStatService
;
import
com.mortals.xhx.module.pj.model.PjEvaluateStatEntity
;
import
com.mortals.xhx.module.pj.model.PjEvaluateStatQuery
;
import
com.mortals.xhx.module.pj.service.PjEvaluateStatService
;
import
com.mortals.xhx.module.stat.model.StatEntity
;
import
com.mortals.xhx.module.stat.service.StatService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -41,27 +48,113 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
private
PhQueueStatService
phQueueStatService
;
@Autowired
private
StatService
statService
;
@Autowired
private
ICacheService
cacheService
;
@Override
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
log
.
info
(
"站点评价统计任务"
);
//统计最近一周
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
/* int year = DateUtil.date().year();
int month = DateUtil.date().month() + 1;
int day = DateUtil.date().dayOfMonth();*/
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
SitePdu
>>>
resp
=
siteFeign
.
list
(
sitePdu
);
if
(
resp
.
getCode
()
==
1
)
{
List
<
SitePdu
>
sitePduList
=
resp
.
getData
().
getData
();
for
(
SitePdu
site
:
sitePduList
)
{
statByDate
();
log
.
info
(
"站点统计缓存任务"
);
//统计排号与评价 部门,等字典顺序记录次数
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
SitePdu
>>>
resp
=
siteFeign
.
list
(
sitePdu
);
if
(
resp
.
getCode
()
==
1
)
{
List
<
SitePdu
>
sitePduList
=
resp
.
getData
().
getData
();
for
(
SitePdu
site
:
sitePduList
)
{
updatePjSectionCache
(
site
);
updatePjWindowCache
(
site
);
updatePhQueueBusniessCache
(
site
);
updatePhQueueSectionNameCache
(
site
);
updatePhQueueWindowsCache
(
site
);
}
}
}
private
void
updatePhQueueBusniessCache
(
SitePdu
site
)
{
PhQueueStatQuery
phQueueStatQuery
=
new
PhQueueStatQuery
();
phQueueStatQuery
.
setSiteId
(
site
.
getId
());
phQueueStatQuery
.
setBusinessNotList
(
Arrays
.
asList
(
""
));
List
<
PhQueueStatEntity
>
phQueueStatEntities
=
phQueueStatService
.
find
(
phQueueStatQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
phQueueStatEntities
))
{
cacheService
.
del
(
RedisKey
.
KEY_SITE_QUEUE_BUSNIESS_CHCHE
+
site
.
getId
());
for
(
PhQueueStatEntity
phQueueStatEntity
:
phQueueStatEntities
)
{
cacheService
.
hset
(
RedisKey
.
KEY_SITE_QUEUE_BUSNIESS_CHCHE
+
site
.
getId
(),
phQueueStatEntity
.
getBusiness
(),
phQueueStatEntity
.
getPhCount
());
}
}
}
private
void
updatePhQueueSectionNameCache
(
SitePdu
site
)
{
PhQueueStatQuery
phQueueStatQuery
=
new
PhQueueStatQuery
();
phQueueStatQuery
.
setSiteId
(
site
.
getId
());
phQueueStatQuery
.
setSectionNameNotList
(
Arrays
.
asList
(
""
));
List
<
PhQueueStatEntity
>
phQueueStatEntities
=
phQueueStatService
.
find
(
phQueueStatQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
phQueueStatEntities
))
{
cacheService
.
del
(
RedisKey
.
KEY_SITE_QUEUE_SECTIONNAME_CHCHE
+
site
.
getId
());
for
(
PhQueueStatEntity
phQueueStatEntity
:
phQueueStatEntities
)
{
cacheService
.
hset
(
RedisKey
.
KEY_SITE_QUEUE_SECTIONNAME_CHCHE
+
site
.
getId
(),
phQueueStatEntity
.
getBusiness
(),
phQueueStatEntity
.
getPhCount
());
}
}
}
private
void
updatePhQueueWindowsCache
(
SitePdu
site
)
{
PhQueueStatQuery
phQueueStatQuery
=
new
PhQueueStatQuery
();
phQueueStatQuery
.
setSiteId
(
site
.
getId
());
phQueueStatQuery
.
setWindowFromnumNotList
(
Arrays
.
asList
(
""
));
List
<
PhQueueStatEntity
>
phQueueStatEntities
=
phQueueStatService
.
find
(
phQueueStatQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
phQueueStatEntities
))
{
cacheService
.
del
(
RedisKey
.
KEY_SITE_QUEUE_WINDOW_CHCHE
+
site
.
getId
());
for
(
PhQueueStatEntity
phQueueStatEntity
:
phQueueStatEntities
)
{
cacheService
.
hset
(
RedisKey
.
KEY_SITE_QUEUE_WINDOW_CHCHE
+
site
.
getId
(),
phQueueStatEntity
.
getBusiness
(),
phQueueStatEntity
.
getPhCount
());
}
}
}
private
void
updatePjSectionCache
(
SitePdu
site
)
{
PjEvaluateStatQuery
pjEvaluateStatQuery
=
new
PjEvaluateStatQuery
();
pjEvaluateStatQuery
.
setSiteId
(
site
.
getId
());
pjEvaluateStatQuery
.
setSectionNameNotList
(
Arrays
.
asList
(
""
));
List
<
PjEvaluateStatEntity
>
pjEvaluateStatEntities
=
pjEvaluateStatService
.
find
(
pjEvaluateStatQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
pjEvaluateStatEntities
))
{
cacheService
.
del
(
RedisKey
.
KEY_SITE_PJ_SECTIONNAME_CHCHE
+
site
.
getId
());
for
(
PjEvaluateStatEntity
pjEvaluateStatEntity
:
pjEvaluateStatEntities
)
{
cacheService
.
hset
(
RedisKey
.
KEY_SITE_PJ_SECTIONNAME_CHCHE
+
site
.
getId
(),
pjEvaluateStatEntity
.
getSectionName
(),
pjEvaluateStatEntity
.
getPjCount
());
}
}
}
private
void
updatePjWindowCache
(
SitePdu
site
)
{
PjEvaluateStatQuery
pjEvaluateStatQuery
=
new
PjEvaluateStatQuery
();
pjEvaluateStatQuery
.
setSiteId
(
site
.
getId
());
pjEvaluateStatQuery
.
setWindowFromnumNotList
(
Arrays
.
asList
(
""
));
List
<
PjEvaluateStatEntity
>
pjEvaluateStatEntities
=
pjEvaluateStatService
.
find
(
pjEvaluateStatQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
pjEvaluateStatEntities
))
{
cacheService
.
del
(
RedisKey
.
KEY_SITE_PJ_WINDOW_CHCHE
+
site
.
getId
());
for
(
PjEvaluateStatEntity
pjEvaluateStatEntity
:
pjEvaluateStatEntities
)
{
cacheService
.
hset
(
RedisKey
.
KEY_SITE_PJ_WINDOW_CHCHE
+
site
.
getId
(),
pjEvaluateStatEntity
.
getSectionName
(),
pjEvaluateStatEntity
.
getPjCount
());
}
}
}
private
void
statByDate
()
{
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
SitePdu
>>>
resp
=
siteFeign
.
list
(
sitePdu
);
if
(
resp
.
getCode
()
==
1
)
{
List
<
SitePdu
>
sitePduList
=
resp
.
getData
().
getData
();
for
(
SitePdu
site
:
sitePduList
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
PjEvaluateStatEntity
sitestatEntity
=
new
PjEvaluateStatEntity
();
sitestatEntity
.
initAttrValue
();
...
...
@@ -102,7 +195,6 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
}
}
}
...
...
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