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

重新调整统计线程实现

parent 1f98f457
......@@ -79,7 +79,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
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());
for (SitePdu site : sitePduList) {
if (ObjectUtils.isEmpty(site.getId())) continue;
......@@ -90,7 +90,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
private void updateSiteCache() {
List<SitePdu> sitePduList = accessService.getStatSiteList();
List<SitePdu> sitePduList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : sitePduList) {
updatePjSectionCache(site);
......
......@@ -3,6 +3,7 @@ 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.dao.AccessDao;
import com.mortals.xhx.module.access.model.AccessQuery;
import java.util.List;
......@@ -22,5 +23,5 @@ public interface AccessService extends ICRUDService<AccessEntity,Long>{
* 获取统计站点列表
* @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
Runnable runnable = new Runnable() {
@Override
public void run() {
List<SitePdu> statSiteList = accessService.getStatSiteList();
List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
int total = statSiteList.size();
cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total);
}
......@@ -109,7 +109,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
Runnable runnable = new Runnable() {
@Override
public void run() {
List<SitePdu> statSiteList = accessService.getStatSiteList();
List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
int total = statSiteList.size();
cacheService.set(RedisKey.KEY_SITE_STAT_COUNT_CHCHE, total);
}
......@@ -127,8 +127,7 @@ public class AccessServiceImpl extends AbstractCRUDServiceImpl<AccessDao, Access
}
@Override
public List<SitePdu> getStatSiteList() {
AccessQuery accessQuery = new AccessQuery();
public List<SitePdu> getStatSiteList(AccessQuery accessQuery) {
List<AccessEntity> accessEntities = this.find(accessQuery);
accessEntities = accessEntities.stream().filter(item -> {
List<AccessSystemEntity> accessSystemList = item.getAccessSystemList();
......
......@@ -73,7 +73,7 @@ public class AccessController extends BaseCRUDJsonBodyMappingController<AccessSe
DateTime attendEnd = DateUtil.parseDate(accessQuery.getAccessTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList();
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(),StatTypeEnum.STAT_PJ.getValue(),StatTypeEnum.STAT_ALL.getValue()));
......
......@@ -185,7 +185,7 @@ 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();
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()));
ThreadPool.getInstance().execute(statThread);
......
......@@ -183,7 +183,7 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
DateTime attendEnd = DateUtil.parseDate(pjEvaluateQuery.getPjTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
log.info("计算天数区间:{}", compare);
List<SitePdu> statSiteList = accessService.getStatSiteList();
List<SitePdu> statSiteList = accessService.getStatSiteList( new AccessQuery());
for (SitePdu site : statSiteList) {
StatThread statThread = new StatThread(attendStart, compare, site, context, Arrays.asList(StatTypeEnum.STAT_PJ.getValue()));
ThreadPool.getInstance().execute(statThread);
......
......@@ -99,7 +99,7 @@ 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();
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()));
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