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
964e25d6
Commit
964e25d6
authored
10 months ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重新调整统计线程实现
parent
6cfbf0b9
master
first
No related merge requests found
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
97 deletions
+38
-97
bill-manager/src/main/java/com/mortals/xhx/common/thread/PhStatThread.java
...main/java/com/mortals/xhx/common/thread/PhStatThread.java
+0
-57
bill-manager/src/main/java/com/mortals/xhx/common/thread/StatThread.java
...c/main/java/com/mortals/xhx/common/thread/StatThread.java
+19
-13
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
+4
-4
bill-manager/src/main/java/com/mortals/xhx/module/ph/web/PhQueueStatController.java
.../com/mortals/xhx/module/ph/web/PhQueueStatController.java
+5
-5
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateController.java
...a/com/mortals/xhx/module/pj/web/PjEvaluateController.java
+0
-8
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateStatController.java
...m/mortals/xhx/module/pj/web/PjEvaluateStatController.java
+3
-3
bill-manager/src/main/java/com/mortals/xhx/module/stat/web/StatController.java
.../java/com/mortals/xhx/module/stat/web/StatController.java
+5
-5
bill-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+2
-2
No files found.
bill-manager/src/main/java/com/mortals/xhx/common/thread/PhStatThread.java
deleted
100644 → 0
View file @
6cfbf0b9
package
com.mortals.xhx.common.thread
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.access.model.AccessEntity
;
import
com.mortals.xhx.module.access.model.AccessQuery
;
import
com.mortals.xhx.module.access.model.AccessSystemEntity
;
import
com.mortals.xhx.module.access.service.AccessService
;
import
com.mortals.xhx.module.ph.model.PhQueueQuery
;
import
com.mortals.xhx.module.ph.service.PhQueueStatService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
collectingAndThen
;
import
static
java
.
util
.
stream
.
Collectors
.
toCollection
;
/**
* 排号统计数据
* @author: zxfei
* @date: 2024/8/2 14:13
*/
@Slf4j
@AllArgsConstructor
public
class
PhStatThread
implements
Runnable
{
private
DateTime
attendStart
;
private
Long
compare
;
private
SitePdu
site
;
private
Context
context
;
@Override
public
void
run
()
{
StopWatch
stopWatch
=
new
StopWatch
();
PhQueueStatService
phQueueStatService
=
SpringUtil
.
getBean
(
PhQueueStatService
.
class
);
phQueueStatService
.
updateSitePhStatLog
(
attendStart
,
compare
,
stopWatch
,
site
,
context
);
}
}
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/common/thread/StatThread.java
View file @
964e25d6
...
...
@@ -11,6 +11,7 @@ import com.mortals.xhx.module.pj.service.PjEvaluateStatService;
import
com.mortals.xhx.module.stat.service.StatService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
java.util.List
;
...
...
@@ -29,14 +30,18 @@ public class StatThread implements Runnable {
private
Long
compare
;
private
SitePdu
site
;
private
List
<
SitePdu
>
statSiteList
;
private
Context
context
;
private
List
<
Integer
>
typeStatList
;
@Override
public
void
run
()
{
for
(
SitePdu
site
:
statSiteList
)
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
StopWatch
stopWatch
=
new
StopWatch
();
PhQueueStatService
phQueueStatService
=
SpringUtil
.
getBean
(
PhQueueStatService
.
class
);
PjEvaluateStatService
pjEvaluateStatService
=
SpringUtil
.
getBean
(
PjEvaluateStatService
.
class
);
...
...
@@ -53,6 +58,7 @@ public class StatThread implements Runnable {
if
(
typeStatList
.
contains
(
StatTypeEnum
.
STAT_ALL
.
getValue
()))
{
statService
.
updateSiteStatLog
(
attendStart
,
compare
,
stopWatch
,
site
,
context
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
View file @
964e25d6
...
...
@@ -81,12 +81,12 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
private
void
statByDate
(
Long
compare
)
{
List
<
SitePdu
>
sitePduList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
DateTime
attendStart
=
DateUtil
.
offsetDay
(
new
Date
(),
-
compare
.
intValue
());
for
(
SitePdu
site
:
sitePduList
)
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
site
,
null
,
//
for (SitePdu site : sitePduList) {
//
if (ObjectUtils.isEmpty(site.getId())) continue;
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
site
PduList
,
null
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_PH
.
getValue
(),
StatTypeEnum
.
STAT_PJ
.
getValue
(),
StatTypeEnum
.
STAT_ALL
.
getValue
()));
ThreadPool
.
getInstance
().
execute
(
statThread
);
}
//
}
}
private
void
updateSiteCache
()
{
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/module/ph/web/PhQueueStatController.java
View file @
964e25d6
...
...
@@ -185,11 +185,11 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
DateTime
attendEnd
=
DateUtil
.
parseDate
(
phQueueQuery
.
getTaketimeEnd
());
Long
compare
=
DateUtil
.
between
(
attendEnd
,
attendStart
,
DateUnit
.
DAY
);
log
.
info
(
"计算天数区间:{}"
,
compare
);
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
for
(
SitePdu
site
:
statSiteList
)
{
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
site
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_PH
.
getValue
()));
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
//
for (SitePdu site : statSiteList) {
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
statSiteList
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_PH
.
getValue
()));
ThreadPool
.
getInstance
().
execute
(
statThread
);
}
//
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateController.java
View file @
964e25d6
...
...
@@ -108,15 +108,7 @@ public class PjEvaluateController extends BaseCRUDJsonBodyMappingController<PjEv
@Override
@UnAuth
public
String
batchSave
(
@RequestBody
List
<
PjEvaluateEntity
>
list
)
{
/* BatchSavePjTask batchSavePjTask = new BatchSavePjTask(list);
ThreadPool.getInstance().execute(batchSavePjTask);*/
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
for
(
PjEvaluateEntity
entity
:
list
)
{
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/module/pj/web/PjEvaluateStatController.java
View file @
964e25d6
...
...
@@ -184,10 +184,10 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
Long
compare
=
DateUtil
.
between
(
attendEnd
,
attendStart
,
DateUnit
.
DAY
);
log
.
info
(
"计算天数区间:{}"
,
compare
);
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
for
(
SitePdu
site
:
statSiteList
)
{
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
s
ite
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_PJ
.
getValue
()));
//
for (SitePdu site : statSiteList) {
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
s
tatSiteList
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_PJ
.
getValue
()));
ThreadPool
.
getInstance
().
execute
(
statThread
);
}
//
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/main/java/com/mortals/xhx/module/stat/web/StatController.java
View file @
964e25d6
...
...
@@ -99,11 +99,11 @@ public class StatController extends BaseCRUDJsonBodyMappingController<StatServic
DateTime
attendEnd
=
DateUtil
.
parseDate
(
query
.
getCreateTimeEnd
());
Long
compare
=
DateUtil
.
between
(
attendEnd
,
attendStart
,
DateUnit
.
DAY
);
log
.
info
(
"计算天数区间:{}"
,
compare
);
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
for
(
SitePdu
site
:
statSiteList
)
{
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
site
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_ALL
.
getValue
()));
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
(
new
AccessQuery
());
//
for (SitePdu site : statSiteList) {
StatThread
statThread
=
new
StatThread
(
attendStart
,
compare
,
statSiteList
,
context
,
Arrays
.
asList
(
StatTypeEnum
.
STAT_ALL
.
getValue
()));
ThreadPool
.
getInstance
().
execute
(
statThread
);
}
//
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
bill-manager/src/test/java/com/mortals/httpclient/system.http
View file @
964e25d6
...
...
@@ -75,8 +75,8 @@ POST {{baseUrl}}/access/stat
Content-Type: application/json
{
"accessTimeStart": "202
4-07
-01",
"accessTimeEnd": "2024-0
7-29
"
"accessTimeStart": "202
3-01
-01",
"accessTimeEnd": "2024-0
8-01
"
}
...
...
This diff is collapsed.
Click to expand it.
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