Commit 90f73fe8 authored by 赵啸非's avatar 赵啸非

修改评价统计更新与组合查询

parent 1480d0df
...@@ -22,6 +22,11 @@ public class RedisKey { ...@@ -22,6 +22,11 @@ public class RedisKey {
*/ */
public static final String KEY_SITE_QUEUE_WINDOW_CHCHE = "site:queue:window:"; public static final String KEY_SITE_QUEUE_WINDOW_CHCHE = "site:queue:window:";
/**
* 站点--排号--大厅--count
*/
public static final String KEY_SITE_QUEUE_HALLNAME_CHCHE = "site:queue:hallname:";
/** /**
...@@ -34,4 +39,9 @@ public class RedisKey { ...@@ -34,4 +39,9 @@ public class RedisKey {
*/ */
public static final String KEY_SITE_PJ_WINDOW_CHCHE = "site:pj:window:"; public static final String KEY_SITE_PJ_WINDOW_CHCHE = "site:pj:window:";
/**
* 站点--评价--大厅--count
*/
public static final String KEY_SITE_PJ_HALLNAME_CHCHE = "site:pj:hallname:";
} }
...@@ -68,10 +68,12 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -68,10 +68,12 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
for (SitePdu site : sitePduList) { for (SitePdu site : sitePduList) {
updatePjSectionCache(site); updatePjSectionCache(site);
updatePjWindowCache(site); updatePjWindowCache(site);
updatePjHallNameCache(site);
updatePhQueueBusniessCache(site); updatePhQueueBusniessCache(site);
updatePhQueueSectionNameCache(site); updatePhQueueSectionNameCache(site);
updatePhQueueWindowsCache(site); updatePhQueueWindowsCache(site);
updatePhQueueHallNameCache(site);
} }
} }
} }
...@@ -115,6 +117,19 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -115,6 +117,19 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
} }
} }
private void updatePhQueueHallNameCache(SitePdu site) {
PhQueueStatQuery phQueueStatQuery = new PhQueueStatQuery();
phQueueStatQuery.setSiteId(site.getId());
phQueueStatQuery.setHallNameNotList(Arrays.asList(""));
List<PhQueueStatEntity> phQueueStatEntities = phQueueStatService.find(phQueueStatQuery, null);
if (!ObjectUtils.isEmpty(phQueueStatEntities)) {
cacheService.del(RedisKey.KEY_SITE_QUEUE_HALLNAME_CHCHE + site.getId());
for (PhQueueStatEntity phQueueStatEntity : phQueueStatEntities) {
cacheService.hset(RedisKey.KEY_SITE_QUEUE_HALLNAME_CHCHE + site.getId(), phQueueStatEntity.getHallName(), phQueueStatEntity.getPhCount());
}
}
}
private void updatePjSectionCache(SitePdu site) { private void updatePjSectionCache(SitePdu site) {
...@@ -143,6 +158,19 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -143,6 +158,19 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
} }
} }
private void updatePjHallNameCache(SitePdu site) {
PjEvaluateStatQuery pjEvaluateStatQuery = new PjEvaluateStatQuery();
pjEvaluateStatQuery.setSiteId(site.getId());
pjEvaluateStatQuery.setHallNameNotList(Arrays.asList(""));
List<PjEvaluateStatEntity> pjEvaluateStatEntities = pjEvaluateStatService.find(pjEvaluateStatQuery, null);
if (!ObjectUtils.isEmpty(pjEvaluateStatEntities)) {
cacheService.del(RedisKey.KEY_SITE_PJ_HALLNAME_CHCHE + site.getId());
for (PjEvaluateStatEntity pjEvaluateStatEntity : pjEvaluateStatEntities) {
cacheService.hset(RedisKey.KEY_SITE_PJ_HALLNAME_CHCHE + site.getId(), pjEvaluateStatEntity.getHallName(), pjEvaluateStatEntity.getPjCount());
}
}
}
private void statByDate() { private void statByDate() {
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
......
...@@ -7,6 +7,7 @@ import com.mortals.framework.annotation.UnAuth; ...@@ -7,6 +7,7 @@ import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; 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.service.ICacheService;
import com.mortals.framework.util.ThreadPool; import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
...@@ -52,6 +53,8 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ ...@@ -52,6 +53,8 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Autowired @Autowired
private PhQueueStatService phQueueStatService; private PhQueueStatService phQueueStatService;
@Autowired
private ICacheService cacheService;
public PhQueueStatController() { public PhQueueStatController() {
super.setModuleDesc("排队叫号汇总统计"); super.setModuleDesc("排队叫号汇总统计");
......
...@@ -6,8 +6,10 @@ import cn.hutool.core.date.DateUtil; ...@@ -6,8 +6,10 @@ import cn.hutool.core.date.DateUtil;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.ThreadPool; import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
...@@ -48,6 +50,8 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -48,6 +50,8 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Autowired @Autowired
private PjEvaluateStatService pjEvaluateStatService; private PjEvaluateStatService pjEvaluateStatService;
@Autowired
private ICacheService cacheService;
public PjEvaluateStatController() { public PjEvaluateStatController() {
super.setModuleDesc("评价汇总统计"); super.setModuleDesc("评价汇总统计");
...@@ -61,12 +65,18 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -61,12 +65,18 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
//通过站点 查询存在的部门 大厅等 //通过站点 查询存在的部门 大厅等
Object siteId = model.get("siteId"); Object siteId = model.get("siteId");
if (!ObjectUtils.isEmpty(siteId)) { if (!ObjectUtils.isEmpty(siteId)) {
/*
PjEvaluateStatQuery pjEvaluateStatQuery = new PjEvaluateStatQuery(); PjEvaluateStatQuery pjEvaluateStatQuery = new PjEvaluateStatQuery();
pjEvaluateStatQuery.setSiteId((Long) siteId); pjEvaluateStatQuery.setSiteId((Long) siteId);
List<PjEvaluateStatEntity> pjEvaluateStatEntities = this.service.find(pjEvaluateStatQuery, context); List<PjEvaluateStatEntity> pjEvaluateStatEntities = this.service.find(pjEvaluateStatQuery, context);
Map<String, String> sectionNameMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getSectionName())).collect(Collectors.toMap(PjEvaluateStatEntity::getSectionName, PjEvaluateStatEntity::getSectionName, (k1, k2) -> k2)); Map<String, String> sectionNameMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getSectionName())).collect(Collectors.toMap(PjEvaluateStatEntity::getSectionName, PjEvaluateStatEntity::getSectionName, (k1, k2) -> k2));
Map<String, String> hallNameMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getHallName())).collect(Collectors.toMap(PjEvaluateStatEntity::getHallName, PjEvaluateStatEntity::getHallName, (k1, k2) -> k2)); Map<String, String> hallNameMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getHallName())).collect(Collectors.toMap(PjEvaluateStatEntity::getHallName, PjEvaluateStatEntity::getHallName, (k1, k2) -> k2));
Map<String, String> windowFromnumMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getWindowFromnum())).collect(Collectors.toMap(PjEvaluateStatEntity::getWindowFromnum, PjEvaluateStatEntity::getWindowFromnum, (k1, k2) -> k2)); Map<String, String> windowFromnumMap = pjEvaluateStatEntities.parallelStream().filter(f -> !ObjectUtils.isEmpty(f.getWindowFromnum())).collect(Collectors.toMap(PjEvaluateStatEntity::getWindowFromnum, PjEvaluateStatEntity::getWindowFromnum, (k1, k2) -> k2));
*/
Map<String, String> sectionNameMap = cacheService.hgetAll(RedisKey.KEY_SITE_PJ_SECTIONNAME_CHCHE + siteId);
Map<String, String> hallNameMap = cacheService.hgetAll(RedisKey.KEY_SITE_PJ_HALLNAME_CHCHE + siteId);
Map<String, String> windowFromnumMap = cacheService.hgetAll(RedisKey.KEY_SITE_PJ_WINDOW_CHCHE + siteId);
this.addDict(model, "sectionNameList", sectionNameMap); this.addDict(model, "sectionNameList", sectionNameMap);
this.addDict(model, "hallNameList", hallNameMap); this.addDict(model, "hallNameList", hallNameMap);
......
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