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
30337ac9
Commit
30337ac9
authored
Aug 02, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加刷新接入站点
parent
6d9d51db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
9 deletions
+88
-9
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/access/service/AccessService.java
.../com/mortals/xhx/module/access/service/AccessService.java
+6
-0
bill-manager/src/main/java/com/mortals/xhx/module/access/service/impl/AccessServiceImpl.java
...als/xhx/module/access/service/impl/AccessServiceImpl.java
+78
-5
No files found.
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
View file @
30337ac9
...
@@ -79,7 +79,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -79,7 +79,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
}
private
void
statByDate
()
{
private
void
statByDate
()
{
List
<
SitePdu
>
sitePduList
=
getStatSiteList
();
List
<
SitePdu
>
sitePduList
=
accessService
.
getStatSiteList
();
for
(
SitePdu
site
:
sitePduList
)
{
for
(
SitePdu
site
:
sitePduList
)
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
StopWatch
allStopWatch
=
new
StopWatch
(
"allStopWatch"
);
StopWatch
allStopWatch
=
new
StopWatch
(
"allStopWatch"
);
...
@@ -196,7 +196,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -196,7 +196,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
}
private
List
<
SitePdu
>
getStatSiteList
()
{
/*
private List<SitePdu> getStatSiteList() {
AccessQuery accessQuery = new AccessQuery();
AccessQuery accessQuery = new AccessQuery();
// accessQuery.setTagNotList(Arrays.asList(""));
// accessQuery.setTagNotList(Arrays.asList(""));
List<AccessEntity> accessEntities = accessService.find(accessQuery);
List<AccessEntity> accessEntities = accessService.find(accessQuery);
...
@@ -234,10 +234,10 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -234,10 +234,10 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
toCollection(() -> new TreeSet<>(Comparator.comparing(SitePdu::getId))), ArrayList::new));
toCollection(() -> new TreeSet<>(Comparator.comparing(SitePdu::getId))), ArrayList::new));
}
}
return sitePduList;
return sitePduList;
}
}
*/
private
void
updateSiteCache
()
{
private
void
updateSiteCache
()
{
List
<
SitePdu
>
sitePduList
=
getStatSiteList
();
List
<
SitePdu
>
sitePduList
=
accessService
.
getStatSiteList
();
for
(
SitePdu
site
:
sitePduList
)
{
for
(
SitePdu
site
:
sitePduList
)
{
updatePjSectionCache
(
site
);
updatePjSectionCache
(
site
);
...
...
bill-manager/src/main/java/com/mortals/xhx/module/access/service/AccessService.java
View file @
30337ac9
package
com.mortals.xhx.module.access.service
;
package
com.mortals.xhx.module.access.service
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.module.access.model.AccessEntity
;
import
com.mortals.xhx.module.access.model.AccessEntity
;
import
com.mortals.xhx.module.access.dao.AccessDao
;
import
com.mortals.xhx.module.access.dao.AccessDao
;
import
java.util.List
;
/**
/**
* AccessService
* AccessService
*
*
...
@@ -13,4 +17,6 @@ import com.mortals.xhx.module.access.dao.AccessDao;
...
@@ -13,4 +17,6 @@ import com.mortals.xhx.module.access.dao.AccessDao;
public
interface
AccessService
extends
ICRUDService
<
AccessEntity
,
Long
>{
public
interface
AccessService
extends
ICRUDService
<
AccessEntity
,
Long
>{
AccessDao
getDao
();
AccessDao
getDao
();
List
<
SitePdu
>
getStatSiteList
();
}
}
\ No newline at end of file
bill-manager/src/main/java/com/mortals/xhx/module/access/service/impl/AccessServiceImpl.java
View file @
30337ac9
package
com.mortals.xhx.module.access.service.impl
;
package
com.mortals.xhx.module.access.service.impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.access.dao.AccessDao
;
import
com.mortals.xhx.module.access.dao.AccessDao
;
import
com.mortals.xhx.module.access.model.AccessEntity
;
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.model.AccessSystemEntity
;
import
com.mortals.xhx.module.access.model.AccessSystemQuery
;
import
com.mortals.xhx.module.access.model.AccessSystemQuery
;
import
com.mortals.xhx.module.access.service.AccessService
;
import
com.mortals.xhx.module.access.service.AccessService
;
...
@@ -15,12 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -15,12 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
collectingAndThen
;
import
static
java
.
util
.
stream
.
Collectors
.
toCollection
;
/**
/**
* AccessService
* AccessService
* 区域接入 service实现
* 区域接入 service实现
...
@@ -33,7 +42,12 @@ import java.util.stream.Collectors;
...
@@ -33,7 +42,12 @@ import java.util.stream.Collectors;
public
class
AccessServiceImpl
extends
AbstractCRUDServiceImpl
<
AccessDao
,
AccessEntity
,
Long
>
implements
AccessService
{
public
class
AccessServiceImpl
extends
AbstractCRUDServiceImpl
<
AccessDao
,
AccessEntity
,
Long
>
implements
AccessService
{
@Autowired
@Autowired
private
AccessSystemService
accessSystemService
;
private
AccessSystemService
accessSystemService
;
@Autowired
private
ISiteFeign
siteFeign
;
@Autowired
private
AccessService
accessService
;
@Autowired
private
ICacheService
cacheService
;
@Override
@Override
protected
void
findAfter
(
AccessEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
AccessEntity
>
list
)
throws
AppException
{
protected
void
findAfter
(
AccessEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
AccessEntity
>
list
)
throws
AppException
{
...
@@ -64,6 +78,16 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
...
@@ -64,6 +78,16 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
item
.
setCreateTime
(
new
Date
());
item
.
setCreateTime
(
new
Date
());
}).
count
();
}).
count
();
accessSystemService
.
save
(
entity
.
getAccessSystemList
());
accessSystemService
.
save
(
entity
.
getAccessSystemList
());
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
List
<
SitePdu
>
statSiteList
=
accessService
.
getStatSiteList
();
int
total
=
statSiteList
.
size
();
cacheService
.
set
(
RedisKey
.
KEY_SITE_STAT_COUNT_CHCHE
,
total
);
}
};
ThreadPool
.
getInstance
().
execute
(
runnable
);
}
}
super
.
saveAfter
(
entity
,
context
);
super
.
saveAfter
(
entity
,
context
);
}
}
...
@@ -91,4 +115,53 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
...
@@ -91,4 +115,53 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
accessSystemService
.
removeList
(
accessSystemlist
,
context
);
accessSystemService
.
removeList
(
accessSystemlist
,
context
);
super
.
removeAfter
(
ids
,
context
,
result
);
super
.
removeAfter
(
ids
,
context
,
result
);
}
}
@Override
public
List
<
SitePdu
>
getStatSiteList
()
{
AccessQuery
accessQuery
=
new
AccessQuery
();
// accessQuery.setTagNotList(Arrays.asList(""));
List
<
AccessEntity
>
accessEntities
=
this
.
find
(
accessQuery
);
accessEntities
=
accessEntities
.
stream
().
filter
(
item
->
{
List
<
AccessSystemEntity
>
accessSystemList
=
item
.
getAccessSystemList
();
//判断排队机或者评价系统是否开通
if
(
ObjectUtils
.
isEmpty
(
accessSystemList
))
return
false
;
List
<
AccessSystemEntity
>
collect
=
accessSystemList
.
stream
().
filter
(
f
->
f
.
getEnabled
()
==
YesNoEnum
.
YES
.
getValue
()).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
collect
))
{
return
false
;
}
return
true
;
}).
collect
(
Collectors
.
toList
());
List
<
SitePdu
>
sitePduList
=
new
ArrayList
<>();
for
(
AccessEntity
accessEntity
:
accessEntities
)
{
if
(
accessEntity
.
getSiteId
()
==
1L
)
{
SitePdu
site
=
new
SitePdu
();
site
.
setId
(
accessEntity
.
getSiteId
());
site
.
setSiteName
(
accessEntity
.
getSiteName
());
site
.
setSiteCode
(
accessEntity
.
getSiteCode
());
site
.
setAreaCode
(
accessEntity
.
getAreaCode
());
sitePduList
.
add
(
site
);
continue
;
}
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setId
(
accessEntity
.
getSiteId
());
Rest
<
List
<
SitePdu
>>
sitesRest
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
sitesRest
.
getCode
())
{
sitePduList
.
addAll
(
sitesRest
.
getData
());
}
}
if
(!
ObjectUtils
.
isEmpty
(
sitePduList
))
{
sitePduList
=
sitePduList
.
stream
().
collect
(
collectingAndThen
(
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
SitePdu:
:
getId
))),
ArrayList:
:
new
));
}
return
sitePduList
;
}
public
static
void
main
(
String
[]
args
)
{
String
a
=
StrUtil
.
prependIfMissing
(
"a123"
,
"a"
);
System
.
out
.
println
(
a
);
}
}
}
\ No newline at end of file
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