Commit b25b3c5a authored by 赵啸非's avatar 赵啸非

修改同步统计只统计开通的站点

parent 9a883119
...@@ -75,7 +75,31 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -75,7 +75,31 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
} }
private void updateSiteCache() { private void updateSiteCache() {
SitePdu sitePdu = new SitePdu();
AccessQuery accessQuery = new AccessQuery();
accessQuery.setTagNotList(Arrays.asList(""));
List<AccessEntity> accessEntities = accessService.find(accessQuery);
for (AccessEntity accessEntity : accessEntities) {
SitePdu site = new SitePdu();
site.setId(accessEntity.getSiteId());
site.setSiteName(accessEntity.getSiteName());
site.setSiteCode(accessEntity.getSiteCode());
site.setAreaCode(accessEntity.getAreaCode());
updatePjSectionCache(site);
updatePjWindowCache(site);
updatePjHallNameCache(site);
updatePhQueueBusniessCache(site);
updatePhQueueSectionNameCache(site);
updatePhQueueWindowsCache(site);
updatePhQueueHallNameCache(site);
}
/* SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) { if (resp.getCode() == 1) {
...@@ -90,7 +114,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -90,7 +114,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
updatePhQueueWindowsCache(site); updatePhQueueWindowsCache(site);
updatePhQueueHallNameCache(site); updatePhQueueHallNameCache(site);
} }
} }*/
} }
private void updatePhQueueBusniessCache(SitePdu site) { private void updatePhQueueBusniessCache(SitePdu site) {
......
...@@ -185,13 +185,54 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ ...@@ -185,13 +185,54 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
SitePdu sitePdu = new SitePdu();
AccessQuery accessQuery = new AccessQuery();
accessQuery.setTagNotList(Arrays.asList(""));
List<AccessEntity> accessEntities = accessService.find(accessQuery);
for (AccessEntity accessEntity : accessEntities) {
SitePdu site = new SitePdu();
site.setId(accessEntity.getSiteId());
site.setSiteName(accessEntity.getSiteName());
site.setSiteCode(accessEntity.getSiteCode());
site.setAreaCode(accessEntity.getAreaCode());
updateSitePhStat(attendStart, compare, stopWatch, site, context);
}
/* SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
log.info("site resp:{}", JSON.toJSONString(resp)); log.info("site resp:{}", JSON.toJSONString(resp));
if (resp.getCode() == 1) { if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData(); List<SitePdu> sitePduList = resp.getData().getData();
for (SitePdu site : sitePduList) { for (SitePdu site : sitePduList) {
updateSitePhStat(attendStart, compare, stopWatch, site, context);
}
//log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}*/
}
};
ThreadPool.getInstance().execute(runnable);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
model.put("message_info", e.getMessage());
}
this.init(model, context);
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
private void updateSitePhStat(DateTime attendStart, Long compare, StopWatch stopWatch, SitePdu site, Context context) {
log.info("统计站点:{}", site.getSiteName()); log.info("统计站点:{}", site.getSiteName());
stopWatch.start("站点排号统计开始"); stopWatch.start("站点排号统计开始");
AccessStatLogEntity statLogEntity = new AccessStatLogEntity(); AccessStatLogEntity statLogEntity = new AccessStatLogEntity();
...@@ -232,27 +273,6 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ ...@@ -232,27 +273,6 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
statLogEntity.setDuration(stopWatch.getLastTaskTimeMillis()); statLogEntity.setDuration(stopWatch.getLastTaskTimeMillis());
accessStatLogService.save(statLogEntity, context); accessStatLogService.save(statLogEntity, context);
} }
//log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
}
};
ThreadPool.getInstance().execute(runnable);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
model.put("message_info", e.getMessage());
}
this.init(model, context);
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
......
...@@ -186,13 +186,50 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -186,13 +186,50 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch"); StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare); log.info("计算天数区间:{}", compare);
SitePdu sitePdu = new SitePdu();
AccessQuery accessQuery = new AccessQuery();
accessQuery.setTagNotList(Arrays.asList(""));
List<AccessEntity> accessEntities = accessService.find(accessQuery);
for (AccessEntity accessEntity : accessEntities) {
SitePdu site = new SitePdu();
site.setId(accessEntity.getSiteId());
site.setSiteName(accessEntity.getSiteName());
site.setSiteCode(accessEntity.getSiteCode());
site.setAreaCode(accessEntity.getAreaCode());
updateSitePjStat(attendStart, compare, stopWatch, site, context);
}
/* SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu); Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
List<SitePdu> sitePduList = resp.getData().getData(); List<SitePdu> sitePduList = resp.getData().getData();
log.info("site resp:{}", JSON.toJSONString(resp)); log.info("site resp:{}", JSON.toJSONString(resp));
if (resp.getCode() == 1) { if (resp.getCode() == 1) {
for (SitePdu site : sitePduList) { for (SitePdu site : sitePduList) {
updateSitePjStat(attendStart, compare, stopWatch, site, context);
}
//log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}*/
}
};
ThreadPool.getInstance().execute(runnable);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
model.put("message_info", e.getMessage());
}
this.init(model, context);
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
private void updateSitePjStat(DateTime attendStart, Long compare, StopWatch stopWatch, SitePdu site, Context context) {
stopWatch.start("站点评价统计开始"); stopWatch.start("站点评价统计开始");
AccessStatLogEntity statLogEntity = new AccessStatLogEntity(); AccessStatLogEntity statLogEntity = new AccessStatLogEntity();
statLogEntity.initAttrValue(); statLogEntity.initAttrValue();
...@@ -232,25 +269,6 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -232,25 +269,6 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
statLogEntity.setDuration(stopWatch.getLastTaskTimeMillis()); statLogEntity.setDuration(stopWatch.getLastTaskTimeMillis());
accessStatLogService.save(statLogEntity, context); accessStatLogService.save(statLogEntity, context);
} }
//log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
}
};
ThreadPool.getInstance().execute(runnable);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
model.put("message_info", e.getMessage());
}
this.init(model, context);
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ POST {{baseUrl}}/pj/evaluate/stat/stat ...@@ -47,7 +47,7 @@ POST {{baseUrl}}/pj/evaluate/stat/stat
Content-Type: application/json Content-Type: application/json
{ {
"pjTimeStart": "2024-06-01", "pjTimeStart": "2023-01-01",
"pjTimeEnd": "2024-07-26" "pjTimeEnd": "2024-07-26"
} }
...@@ -56,7 +56,7 @@ POST {{baseUrl}}/ph/queue/stat/stat ...@@ -56,7 +56,7 @@ POST {{baseUrl}}/ph/queue/stat/stat
Content-Type: application/json Content-Type: application/json
{ {
"taketimeStart": "2024-06-01", "taketimeStart": "2023-01-01",
"taketimeEnd": "2024-07-26" "taketimeEnd": "2024-07-26"
} }
......
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