Commit 9859f90d authored by 赵啸非's avatar 赵啸非

重新调整统计线程实现

parent 1f98f457
...@@ -79,7 +79,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -79,7 +79,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
} }
private void statByDate(Long compare) { private void statByDate(Long compare) {
List<SitePdu> sitePduList = accessService.getStatSiteList(); List<SitePdu> sitePduList = accessService.getStatSiteList( new AccessQuery());
DateTime attendStart = DateUtil.offsetDay(new Date(), -compare.intValue()); DateTime attendStart = DateUtil.offsetDay(new Date(), -compare.intValue());
for (SitePdu site : sitePduList) { for (SitePdu site : sitePduList) {
if (ObjectUtils.isEmpty(site.getId())) continue; if (ObjectUtils.isEmpty(site.getId())) continue;
...@@ -90,7 +90,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -90,7 +90,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
} }
private void updateSiteCache() { private void updateSiteCache() {
List<SitePdu> sitePduList = accessService.getStatSiteList(); List<SitePdu> sitePduList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : sitePduList) { for (SitePdu site : sitePduList) {
updatePjSectionCache(site); updatePjSectionCache(site);
......
...@@ -3,6 +3,7 @@ import com.mortals.framework.service.ICRUDService; ...@@ -3,6 +3,7 @@ import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.site.SitePdu; 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 com.mortals.xhx.module.access.model.AccessQuery;
import java.util.List; import java.util.List;
...@@ -22,5 +23,5 @@ public interface AccessService extends ICRUDService<AccessEntity,Long>{ ...@@ -22,5 +23,5 @@ public interface AccessService extends ICRUDService<AccessEntity,Long>{
* 获取统计站点列表 * 获取统计站点列表
* @return * @return
*/ */
List<SitePdu> getStatSiteList(); List<SitePdu> getStatSiteList(AccessQuery accessQuery);
} }
\ No newline at end of file
...@@ -82,7 +82,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access ...@@ -82,7 +82,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
int total = statSiteList.size(); int total = statSiteList.size();
cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total); cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total);
} }
...@@ -109,7 +109,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access ...@@ -109,7 +109,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
int total = statSiteList.size(); int total = statSiteList.size();
cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total); cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total);
} }
...@@ -127,8 +127,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access ...@@ -127,8 +127,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
} }
@Override @Override
public List<SitePdu> getStatSiteList() { public List<SitePdu> getStatSiteList(AccessQuery accessQuery) {
AccessQuery accessQuery = new AccessQuery();
List<AccessEntity> accessEntities = this.find(accessQuery); List<AccessEntity> accessEntities = this.find(accessQuery);
accessEntities = accessEntities.stream().filter(item -> { accessEntities = accessEntities.stream().filter(item -> {
List<AccessSystemEntity> accessSystemList = item.getAccessSystemList(); List<AccessSystemEntity> accessSystemList = item.getAccessSystemList();
......
...@@ -73,7 +73,7 @@ public class AccessController extends BaseCRUDJsonBodyMappingController<AccessSe ...@@ -73,7 +73,7 @@ public class AccessController extends BaseCRUDJsonBodyMappingController<AccessSe
DateTime attendEnd = DateUtil.parseDate(accessQuery.getAccessTimeEnd()); DateTime attendEnd = DateUtil.parseDate(accessQuery.getAccessTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : statSiteList) { for (SitePdu site : statSiteList) {
StatThread statThread = new StatThread(attendStart, compare, site, context, StatThread statThread = new StatThread(attendStart, compare, site, context,
Arrays.asList(StatTypeEnum.STAT_PH.getValue(),StatTypeEnum.STAT_PJ.getValue(),StatTypeEnum.STAT_ALL.getValue())); Arrays.asList(StatTypeEnum.STAT_PH.getValue(),StatTypeEnum.STAT_PJ.getValue(),StatTypeEnum.STAT_ALL.getValue()));
......
...@@ -185,7 +185,7 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ ...@@ -185,7 +185,7 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
DateTime attendEnd = DateUtil.parseDate(phQueueQuery.getTaketimeEnd()); DateTime attendEnd = DateUtil.parseDate(phQueueQuery.getTaketimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : statSiteList) { for (SitePdu site : statSiteList) {
StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_PH.getValue())); StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_PH.getValue()));
ThreadPool.getInstance().execute(statThread); ThreadPool.getInstance().execute(statThread);
......
...@@ -183,7 +183,7 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -183,7 +183,7 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
DateTime attendEnd = DateUtil.parseDate(pjEvaluateQuery.getPjTimeEnd()); DateTime attendEnd = DateUtil.parseDate(pjEvaluateQuery.getPjTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : statSiteList) { for (SitePdu site : statSiteList) {
StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_PJ.getValue())); StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_PJ.getValue()));
ThreadPool.getInstance().execute(statThread); ThreadPool.getInstance().execute(statThread);
......
...@@ -99,7 +99,7 @@ public class StatController extends BaseCRUDJsonBodyMappingController<StatServic ...@@ -99,7 +99,7 @@ public class StatController extends BaseCRUDJsonBodyMappingController<StatServic
DateTime attendEnd = DateUtil.parseDate(query.getCreateTimeEnd()); DateTime attendEnd = DateUtil.parseDate(query.getCreateTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList(); List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : statSiteList) { for (SitePdu site : statSiteList) {
StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_ALL.getValue())); StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_ALL.getValue()));
ThreadPool.getInstance().execute(statThread); ThreadPool.getInstance().execute(statThread);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment