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

添加首页统计模块 统计近一周

parent eeedb39b
......@@ -7,6 +7,7 @@ import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.GroupListEnum;
......@@ -48,6 +49,8 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
@Autowired
private ISiteFeign siteFeign;
@Autowired
private PhQueueStatService phQueueStatService;
public PhQueueStatController() {
super.setModuleDesc("排队叫号汇总统计");
......@@ -142,39 +145,48 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
String busiDesc = "查询" + this.getModuleDesc();
int code = 1;
try {
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(phQueueQuery.getTaketimeStart());
DateTime attendEnd = DateUtil.parseDate(phQueueQuery.getTaketimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("记录日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
PhQueueStatEntity sitestatEntity = new PhQueueStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(curDate.year());
sitestatEntity.setMonth(curDate.month() + 1);
sitestatEntity.setDay(curDate.dayOfMonth());
//设置年月日
this.service.updateSitePhStat(sitestatEntity, context);
});
Runnable runnable = new Runnable() {
@Override
public void run() {
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(phQueueQuery.getTaketimeStart());
DateTime attendEnd = DateUtil.parseDate(phQueueQuery.getTaketimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("记录日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
PhQueueStatEntity sitestatEntity = new PhQueueStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(curDate.year());
sitestatEntity.setMonth(curDate.month() + 1);
sitestatEntity.setDay(curDate.dayOfMonth());
//设置年月日
phQueueStatService.updateSitePhStat(sitestatEntity, context);
});
}
stopWatch.stop();
log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
}
};
ThreadPool.getInstance().execute(runnable);
stopWatch.stop();
log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
......
......@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
......@@ -44,6 +45,8 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
@Autowired
private ISiteFeign siteFeign;
@Autowired
private PjEvaluateStatService pjEvaluateStatService;
public PjEvaluateStatController() {
super.setModuleDesc("评价汇总统计");
......@@ -144,39 +147,49 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
String busiDesc = "查询" + this.getModuleDesc();
int code = 1;
try {
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(pjEvaluateQuery.getPjTimeStart());
DateTime attendEnd = DateUtil.parseDate(pjEvaluateQuery.getPjTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("记录日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
PjEvaluateStatEntity sitestatEntity = new PjEvaluateStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(curDate.year());
sitestatEntity.setMonth(curDate.month() + 1);
sitestatEntity.setDay(curDate.dayOfMonth());
//设置年月日
this.service.updateSitePjStat(sitestatEntity, context);
});
Runnable runnable = new Runnable() {
@Override
public void run() {
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(pjEvaluateQuery.getPjTimeStart());
DateTime attendEnd = DateUtil.parseDate(pjEvaluateQuery.getPjTimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("记录日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
PjEvaluateStatEntity sitestatEntity = new PjEvaluateStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(curDate.year());
sitestatEntity.setMonth(curDate.month() + 1);
sitestatEntity.setDay(curDate.dayOfMonth());
//设置年月日
pjEvaluateStatService.updateSitePjStat(sitestatEntity, context);
});
}
stopWatch.stop();
log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
}
};
ThreadPool.getInstance().execute(runnable);
stopWatch.stop();
log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
......
......@@ -56,7 +56,7 @@ POST {{baseUrl}}/ph/queue/stat/stat
Content-Type: application/json
{
"taketimeStart": "2023-01-01",
"taketimeStart": "2024-06-01",
"taketimeEnd": "2024-07-10"
}
......
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