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

修改大厅查询

parent a5f2dd07
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.SourceEnum; import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
...@@ -11,18 +14,16 @@ import com.mortals.xhx.module.matter.model.MatterEntity; ...@@ -11,18 +14,16 @@ import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.matters.service.MattersService; import com.mortals.xhx.module.matters.service.MattersService;
import com.mortals.xhx.module.site.model.SiteEntity; import com.mortals.xhx.module.site.model.*;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService; import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.site.service.SiteThemeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
/** /**
* 统计站点部门事项 * 统计站点部门事项
...@@ -35,7 +36,13 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService { ...@@ -35,7 +36,13 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private MatterService matterService; private MatterService matterService;
@Autowired @Autowired
private SiteService siteService; private SiteService siteService;
@Autowired
private ICacheService cacheService;
@Autowired
private SiteThemeService siteThemeService;
@Override @Override
...@@ -47,21 +54,47 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService { ...@@ -47,21 +54,47 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
DeptQuery query = new DeptQuery(); DeptQuery query = new DeptQuery();
query.setSiteId(siteEntity.getId()); query.setSiteId(siteEntity.getId());
List<DeptEntity> deptEntities = deptService.find(query); List<DeptEntity> deptEntities = deptService.find(query);
for (DeptEntity deptEntity : deptEntities) { for (DeptEntity deptEntity : deptEntities) {
MatterQuery matterQuery = new MatterQuery(); MatterQuery matterQuery = new MatterQuery();
matterQuery.setEventTypeShowNotList(Arrays.asList("行政处罚")); matterQuery.setEventTypeShowNotList(Arrays.asList("行政处罚"));
int total = matterService.count(matterQuery.source(SourceEnum.政务网.getValue()).deptCode(deptEntity.getDeptNumber()), null); int total = matterService.count(matterQuery.source(SourceEnum.政务网.getValue()).deptCode(deptEntity.getDeptNumber()), null);
DeptEntity deptQuery = new DeptEntity(); DeptEntity deptQuery = new DeptEntity();
deptQuery.setTotal(total); deptQuery.setTotal(total);
deptQuery.setUpdateTime(new Date()); deptQuery.setUpdateTime(new Date());
DeptEntity condition = new DeptEntity(); DeptEntity condition = new DeptEntity();
condition.setId(deptEntity.getId()); condition.setId(deptEntity.getId());
deptService.getDao().update(deptQuery, condition); deptService.getDao().update(deptQuery, condition);
} }
} }
//分组暂存 站点 个人企业 主题
Map<String, List<SiteThemeEntity>> collect = siteThemeService.find(new SiteThemeQuery())
.parallelStream()
.collect(Collectors.groupingBy(x -> x.getSiteId() + "_" + x.getUserType() + "_" + x.getThemeCode()
));
Iterator<Map.Entry<String, List<SiteThemeEntity>>> iterator = collect.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, List<SiteThemeEntity>> next = iterator.next();
if (next.getValue().size() == 0) {
iterator.remove();
}
}
//重新 构建redis siteId+userType= >themeCodelist
List<SiteThemeEntity> themeEntities = collect.values().stream().flatMap(i -> i.stream()).collect(Collectors.toList());
themeEntities.stream()
.collect(Collectors.groupingBy(x -> x.getSiteId() + "_" + x.getUserType()))
.entrySet()
.stream()
.forEach(item -> {
String key = item.getKey();
List<SiteThemeEntity> values = item.getValue();
String[] split = key.split("_");
String siteId = split[0];
String userType = split[1];
cacheService.hset(RedisCacheKeys.getSiteUserTypeThemeCodeKey() + siteId, userType, JSONObject.toJSONString(values));
});
} }
@Override @Override
......
...@@ -5,6 +5,7 @@ import com.mortals.framework.exception.AppException; ...@@ -5,6 +5,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.matter.dao.MatterDao; import com.mortals.xhx.module.matter.dao.MatterDao;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
...@@ -23,7 +24,7 @@ import java.util.Map; ...@@ -23,7 +24,7 @@ import java.util.Map;
* @author zxfei * @author zxfei
* @date 2022-01-12 * @date 2022-01-12
*/ */
public interface MatterService extends ICRUDService<MatterEntity, Long> { public interface MatterService extends ICRUDCacheService<MatterEntity, Long> {
MatterDao getDao(); MatterDao getDao();
......
...@@ -61,7 +61,7 @@ import java.util.stream.Collectors; ...@@ -61,7 +61,7 @@ import java.util.stream.Collectors;
*/ */
@Service("matterService") @Service("matterService")
@Slf4j @Slf4j
public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, MatterEntity, Long> implements MatterService { public class MatterServiceImpl extends AbstractCRUDCacheServiceImpl<MatterDao, MatterEntity, Long> implements MatterService {
@Autowired @Autowired
private SiteMatterService siteMatterService; private SiteMatterService siteMatterService;
@Autowired @Autowired
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
and a.siteId = #{condition.siteId} and a.siteId = #{condition.siteId}
</if> </if>
</trim> </trim>
</select> </select>
<!-- 获取事项差集列表列表 --> <!-- 获取事项差集列表列表 -->
......
...@@ -49,5 +49,10 @@ public final class RedisCacheKeys { ...@@ -49,5 +49,10 @@ public final class RedisCacheKeys {
public static String getFlowSubKey() { public static String getFlowSubKey() {
return "workflow:sub:key:"; return "workflow:sub:key:";
} }
public static String getSiteUserTypeThemeCodeKey() {
return "site:usertype:themecode:";
}
} }
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