Compare commits

...

3 Commits

2 changed files with 85 additions and 20 deletions

View File

@ -17,6 +17,8 @@ import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.DateUtils;
import io.renren.modules.category.dao.CategoryDao;
import io.renren.modules.category.entity.Category;
import io.renren.modules.demanData.dao.TDemandDataDao;
import io.renren.modules.demandComment.dao.TDemandCommentDao;
import io.renren.modules.enke.service.EnkeService;
@ -279,6 +281,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private SysRoleUserService sysRoleUserService;
@Autowired
private CategoryDao categoryDao;
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
private static final String getAllsql = "SELECT " +
@ -2100,9 +2105,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectInfrastructureList() {
HashMap<String, Object> resultMap = new HashMap<>();
HashMap<String, Object> resultMap = new LinkedHashMap<>();
//云资源
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> resultMap.put("云资源", resourceDao.selectYzyCount()), executor);
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> resultMap.put("政务云资源", resourceDao.selectYzyCount()), executor);
//视频资源
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
@ -2165,7 +2170,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> hkt = CompletableFuture.runAsync(() -> {
QueryWrapper<TMeetingroom> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag", 0);
resultMap.put("会客厅", tMeetingroomMapper.selectCount(wrapper));
resultMap.put("城市云脑会客厅", tMeetingroomMapper.selectCount(wrapper));
}, executor);
@ -2174,8 +2179,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(yzy, hkt, sphy);
all.join();
return resultMap;
HashMap<String, Object> resultMap_ = new LinkedHashMap<String, Object>() {{
put("城市云脑会客厅", resultMap.get("城市云脑会客厅"));
put("视频资源", resultMap.get("视频资源"));
put("政务云资源", resultMap.get("政务云资源"));
put("视频会议", resultMap.get("视频会议"));
}};
return resultMap_;
}
@Override
@ -2188,9 +2198,37 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectCollectResourceList() {
// 顺序与编目保持一致
List<String> resource_yyly = new ArrayList<>(); // 应用领域名称列表
QueryWrapper<Category> wrapper = new QueryWrapper<>();
wrapper.eq("root_category", "应用资源")
.eq("del_flag", 0)
.eq("is_link_to_dic", "true")
.eq("is_filter_criteria", "true")
.orderByAsc("xh");
List<Category> categories = categoryDao.selectList(wrapper);
Optional<Category> yyly = categories.stream().filter(index -> "应用领域".equals(index.getName())).findFirst(); // 获取应用领域编目内容
if (yyly.isPresent()) {
List<Map> yyly_cat = categoryDao.selectDictData(yyly.get().getLinkValue());
resource_yyly = yyly_cat.stream().map(index -> index.get("dict_label").toString()).collect(Collectors.toList());
}
List<Map> resourceCountList = baseDao.selectCollectResourceList();
Map result = new HashMap();
resourceCountList.stream().filter(it -> it.get("type") != null && !it.get("type").equals("")).forEach(it -> result.put(it.get("type"), it.get("count")));
Map result = new LinkedHashMap();
if (resource_yyly.isEmpty()) {
resourceCountList.stream().filter(it -> it.get("type") != null && !it.get("type").equals("")).forEach(it -> result.put(it.get("type"), it.get("count")));
} else {
resource_yyly.stream().map(index -> {
Map<String, Object> temp = new LinkedHashMap<>();
temp.put("type", index);
Optional<Map> temp_suit = resourceCountList.stream().filter(i -> index.equals(i.get("type").toString())).findFirst();
if (temp_suit.isPresent()) {
temp.put("count", temp_suit.get().get("count"));
} else {
temp.put("count", "0");
}
return temp;
}).forEach(it -> result.put(it.get("type"), it.get("count")));
}
return result;
}

View File

@ -2101,19 +2101,46 @@
</select>
<select id="selectCollectResourceList" resultType="java.util.Map">
SELECT tda.attr_value as type, count(*) as count FROM tb_data_resource tdr LEFT JOIN
(SELECT a.data_resource_id, a.id, a.attr_type, substring_index(substring_index(a.attr_value, ';',
b.help_topic_id + 1), ';', - 1) AS attr_value
FROM tb_data_attr a INNER JOIN mysql.help_topic b ON a.attr_type='应用领域' AND a.del_flag=0 AND b.help_topic_id
<![CDATA[ < ]]> (length(a.attr_value) - length(REPLACE(a.attr_value, ';', '')) + 1)) tda
ON tdr.id=tda.data_resource_id
LEFT JOIN (select sdd.sort, sdd.dict_label from sys_dict_data sdd left join tb_data_category tdc on
sdd.dict_type_id=tdc.link_value
where 1=1 and sdd.status=1 and tdc.del_flag=0 and tdc.name='应用领域' and tdc.root_category='应用资源') dict ON
dict.dict_label=tda.attr_value
WHERE 1=1 AND tdr.del_flag=0 AND tdr.type='应用资源'
GROUP BY tda.attr_value
ORDER BY ANY_VALUE(IFNULL(dict.sort, 9999)) ASC
SELECT
tda.attr_value AS type,
count(*) AS count
FROM
tb_data_resource tdr
LEFT JOIN (
SELECT
a.data_resource_id,
a.id,
a.attr_type,
substring_index( substring_index( a.attr_value, ';', b.help_topic_id + 1 ), ';', - 1 ) AS attr_value
FROM
tb_data_attr a
INNER JOIN mysql.help_topic b ON a.attr_type = '应用领域'
AND a.del_flag = 0
AND b.help_topic_id &lt; ( length( a.attr_value ) - length( REPLACE ( a.attr_value, ';', '' )) + 1 )) tda ON tdr.id = tda.data_resource_id
LEFT JOIN (
SELECT
sdd.sort,
sdd.dict_label
FROM
sys_dict_data sdd
LEFT JOIN tb_data_category tdc ON sdd.dict_type_id = tdc.link_value
WHERE
1 = 1
AND sdd.STATUS = 1
AND tdc.del_flag = 0
AND tdc.NAME = '应用领域'
AND tdc.root_category = '应用资源'
) dict ON dict.dict_label = tda.attr_value
WHERE
1 = 1
AND tdr.del_flag = 0
AND tdr.type = '应用资源'
AND tda.attr_value IS NOT NULL
GROUP BY
tda.attr_value
ORDER BY
ANY_VALUE (
IFNULL( dict.sort, 9999 )) ASC
</select>
<select id="getPraiseList" resultType="java.util.Map">