提交 9210544a 作者: obcy

Merge remote-tracking branch 'origin/event_fusion' into event_fusion

......@@ -75,7 +75,7 @@ public class EventAnalysisController {
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 结束时间
* @param category 风险评估项目使用(统战部)
* @param category 自定义门户使用(自定义组件)
* @author lkg
* @date 2024/1/24
*/
......@@ -100,7 +100,7 @@ public class EventAnalysisController {
DateTime beforeHour = DateUtil.offsetHour(DateUtil.parseDateTime(endTime), -1);
long lastHour = esStatisticsService.totalCount(subjectIdList, DateUtil.formatDateTime(beforeHour), endTime);
map.put("lastHour", String.valueOf(lastHour));
if ("TZB".equalsIgnoreCase(category)) {
if ("custom".equalsIgnoreCase(category)) {
List<Map<String, Object>> dataList = new ArrayList<>();
Map<String, Object> totalCountMap = new HashMap<>();
totalCountMap.put("name", "信息总量");
......
......@@ -377,7 +377,7 @@ public class StatisticalAnalysisController {
}
}
/*--------------------------------------------以下为【统战部】风险评估页面接口---------------------------------------------------------*/
/*--------------------------------------------以下为【自定义门户】自定义组件接口---------------------------------------------------------*/
/**
* 单个国家统计
......
......@@ -19,7 +19,8 @@ import java.util.List;
@Mapper
public interface KeyWordsMapper extends BaseMapper<KeyWords> {
Page<KeyWordsPage> pageList(@Param("keyWords") KeyWords keyWords, @Param("typeIds") List<String> typeIds,
Page<KeyWordsPage> pageList(@Param("userId") String userId,@Param("customerId") String customerId,
@Param("keyWords") KeyWords keyWords, @Param("typeIds") List<String> typeIds,
@Param("subjectId") String subjectId, @Param("search") int search,
@Param("bindingType") String bindingType, Page<KeyWordsPage> page);
......@@ -58,9 +59,11 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> {
Integer bindCount(@Param("subjectId") String subjectId);
List<KeyWordsPage> pageListByTypeIdList(@Param("ids") List<String> ids, @Param("subjectId") String subjectId, @Param("status") int status, @Param("bindingType") String bindingType);
List<KeyWordsPage> pageListByTypeIdList(@Param("userId") String userId,@Param("customerId") String customerId,
@Param("ids") List<String> ids, @Param("subjectId") String subjectId, @Param("status") int status, @Param("bindingType") String bindingType);
Integer countByTypeAndIdList(@Param("finalIdList") List<String> finalIdList, @Param("subjectId") String subjectId);
Integer countByTypeAndIdList(@Param("userId") String userId,@Param("customerId") String customerId,
@Param("finalIdList") List<String> finalIdList, @Param("subjectId") String subjectId);
List<KeyWordsPage> bindKeyWordsListByIdsAndBindType(@Param("subjectIds") List<String> ids, @Param("bindingType") String bindingType, @Param("metaSearchFlag") Integer metaSearchFlag);
}
......@@ -32,4 +32,5 @@ public interface KeywordsTypeMapper extends BaseMapper<KeywordsType> {
*/
List<KeywordsTypeVo> listAll();
List<KeywordsTypeVo> listAll(@Param("userId") String userId,@Param("customerId") String customerId);
}
......@@ -3,7 +3,20 @@
<mapper namespace="com.zzsn.event.mapper.KeyWordsMapper">
<select id="pageList" resultType="com.zzsn.event.vo.KeyWordsPage">
SELECT distinct d.*, c.id as keyWordsTypeId, c.type_name as keyWordTypeNames from key_words d
SELECT distinct d.*, c.id as keyWordsTypeId, c.type_name as keyWordTypeNames from
<choose>
<when test="userId !=null and userId != ''">
( select s.* from key_words s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{userId} )
</when>
<when test="customerId !=null and customerId != ''">
( select s.* from key_words s inner join customer_data_permission_map m
on s.id=m.permission_id and m.customer_id = #{customerId} )
</when>
<otherwise>
key_words
</otherwise>
</choose> d
LEFT JOIN keywords_type_map b ON b.keywords_id = d.id
LEFT JOIN keywords_type c ON b.type_id = c.id
where 1 = 1
......@@ -93,7 +106,21 @@
</select>
<select id="pageListByTypeIdList" resultType="com.zzsn.event.vo.KeyWordsPage">
SELECT a.*,b.type_id as typeId FROM key_words a
SELECT a.*,b.type_id as typeId FROM
<choose>
<when test="userId !=null and userId != ''">
( select s.* from key_words s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{userId} )
</when>
<when test="customerId !=null and customerId != ''">
( select s.* from key_words s inner join customer_data_permission_map m
on s.id=m.permission_id and m.customer_id = #{customerId} )
</when>
<otherwise>
key_words
</otherwise>
</choose>
a
INNER JOIN keywords_type_map b ON a.id = b.keywords_id
WHERE a.status = #{status}
<if test="ids!=null and ids.size()>0">
......@@ -112,7 +139,21 @@
</select>
<select id="countByTypeAndIdList" resultType="java.lang.Integer">
SELECT count(1) FROM key_words a
SELECT count(1) FROM
<choose>
<when test="userId !=null and userId != ''">
( select s.* from key_words s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{userId} )
</when>
<when test="customerId !=null and customerId != ''">
( select s.* from key_words s inner join customer_data_permission_map m
on s.id=m.permission_id and m.customer_id = #{customerId} )
</when>
<otherwise>
key_words
</otherwise>
</choose>
a
INNER JOIN keywords_type_map b ON a.id = b.keywords_id
WHERE b.type_id in
<foreach item="typeId" collection="finalIdList" open="(" separator="," close=")">
......
......@@ -7,7 +7,21 @@
</update>
<select id="listAll" resultType="com.zzsn.event.vo.KeywordsTypeVo">
select s.* from keywords_type s
select s.* from
<choose>
<when test="userId !=null and userId != ''">
( select s.* from keywords_type s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{userId} )
</when>
<when test="customerId !=null and customerId != ''">
( select s.* from keywords_type s inner join customer_data_permission_map m
on s.id=m.permission_id and m.customer_id = #{customerId} )
</when>
<otherwise>
keywords_type
</otherwise>
</choose>
s
</select>
</mapper>
......@@ -85,9 +85,9 @@ public interface IKeyWordsService extends IService<KeyWords> {
*/
Integer bindCount(String subjectId);
List<KeyWordsPage> listByTypeIdList(List<String> typeIds, String subjectId, int status,String bindingType);
List<KeyWordsPage> listByTypeIdList(String userId,String customerId,List<String> typeIds, String subjectId, int status,String bindingType);
Integer countByTypeAndIdList(List<String> finalIdList, String subjectId);
Integer countByTypeAndIdList(String userId, String customerId,List<String> finalIdList, String subjectId);
List<KeyWordsPage> bindKeyWordsListByIdsAndBindType(List<String> ids, String bindingType,Integer metaSearchFlag);
}
......@@ -22,11 +22,14 @@ import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.KeywordsVO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
......@@ -86,7 +89,19 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
}
//查询列表
Page<KeyWordsPage> page = new Page<>(pageNo, pageSize);
return baseMapper.pageList(keyWords, typeIds, subjectId, searchValue,bindingType,page);
UserVo loginUser = AuthUtil.getLoginUser();
String userId = null;
String customerId = null;
if(loginUser.getCategory() != null){
Integer category = loginUser.getCategory();
if (category.equals(Constants.COMMON_USER)) {
userId = loginUser.getId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = loginUser.getRelTenantIds();
}
}
return baseMapper.pageList(userId,customerId,keyWords, typeIds, subjectId, searchValue,bindingType,page);
}
@Override
......@@ -276,13 +291,14 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
}
@Override
public List<KeyWordsPage> listByTypeIdList(List<String> typeIds, String subjectId, int status, String bindingType) {
return baseMapper.pageListByTypeIdList(typeIds,subjectId,status,bindingType);
public List<KeyWordsPage> listByTypeIdList(String userId, String customerId,
List<String> typeIds, String subjectId, int status, String bindingType) {
return baseMapper.pageListByTypeIdList(userId, customerId,typeIds,subjectId,status,bindingType);
}
@Override
public Integer countByTypeAndIdList(List<String> finalIdList, String subjectId) {
return baseMapper.countByTypeAndIdList(finalIdList,subjectId);
public Integer countByTypeAndIdList(String userId,String customerId,List<String> finalIdList, String subjectId) {
return baseMapper.countByTypeAndIdList(userId,customerId,finalIdList,subjectId);
}
private void addMapMain(KeyWords keyWords, String keyWordsTypeId) {
......
......@@ -2,10 +2,13 @@ package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.KeywordsType;
import com.zzsn.event.mapper.KeywordsTypeMapper;
import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.service.IKeywordsTypeService;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.KeywordsTypeVo;
import org.apache.commons.lang3.StringUtils;
......@@ -98,6 +101,18 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
@Override
public List<KeywordsTypeVo> allList(Boolean contain, String subjectId,String bindingType) {
UserVo loginUser = AuthUtil.getLoginUser();
String userId = null;
String customerId = null;
if(loginUser.getCategory() != null){
Integer category = loginUser.getCategory();
if (category.equals(Constants.COMMON_USER)) {
userId = loginUser.getId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = loginUser.getRelTenantIds();
}
}
List<KeywordsTypeVo> allList = new ArrayList<>();
KeywordsTypeVo infoSourceTypeVo = new KeywordsTypeVo();
infoSourceTypeVo.setId("0");
......@@ -105,7 +120,7 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
infoSourceTypeVo.setPid("0");
infoSourceTypeVo.setHasChild("1");
List<KeywordsTypeVo> list = baseMapper.listAll();
List<KeyWordsPage> keyWordsPageList = keyWordsService.listByTypeIdList(
List<KeyWordsPage> keyWordsPageList = keyWordsService.listByTypeIdList(userId,customerId,
list.stream().map(KeywordsTypeVo::getId).collect(Collectors.toList()), subjectId, 1,bindingType);
if (Boolean.TRUE.equals(contain)) {
Map<String, List<KeyWordsPage>> map = keyWordsPageList.stream().collect(Collectors.groupingBy(KeyWordsPage::getTypeId));
......@@ -135,11 +150,24 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
@Override
public List<KeywordsTypeVo> listByParentIdAndSubjectId(String subjectId, String parentId) {
UserVo loginUser = AuthUtil.getLoginUser();
String userId = null;
String customerId = null;
if(loginUser.getCategory() != null){
Integer category = loginUser.getCategory();
if (category.equals(Constants.COMMON_USER)) {
userId = loginUser.getId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = loginUser.getRelTenantIds();
}
}
if (!parentId.equals("0")) {
KeywordsType parent = this.getById(parentId);
List<KeywordsTypeVo> finalList = new ArrayList<>();
if (StringUtils.isEmpty(parent.getHasChild()) || "0".equals(parent.getHasChild())) {
List<KeyWordsPage> pageList = keyWordsService.listByTypeIdList(Collections.singletonList(parentId), subjectId, 1,null);
List<KeyWordsPage> pageList = keyWordsService.listByTypeIdList(userId,customerId,Collections.singletonList(parentId), subjectId, 1,null);
if (pageList != null && !pageList.isEmpty()) {
for (KeyWordsPage keyWordsPage : pageList) {
KeywordsTypeVo keywordsTypeVo = new KeywordsTypeVo();
......@@ -160,7 +188,7 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
infoSourceTypeVo.setTypeName("所有");
infoSourceTypeVo.setPid("0");
infoSourceTypeVo.setHasChild("1");
List<KeywordsTypeVo> list = baseMapper.listAll();
List<KeywordsTypeVo> list = baseMapper.listAll(userId,customerId);
Map<String, List<KeywordsTypeVo>> pidMap = list.stream().collect(Collectors.groupingBy(KeywordsTypeVo::getPid));
List<KeywordsTypeVo> firstGroup = list.stream().filter(item -> item.getPid().equals(parentId)).collect(Collectors.toList());
......@@ -170,7 +198,7 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
List<String> oneInList = new ArrayList<>();
oneInList.add(keywordsTypeVo.getId());
//tips 当数据量大 最好不用列表
Integer count = keyWordsService.countByTypeAndIdList(oneInList,subjectId);
Integer count = keyWordsService.countByTypeAndIdList(userId,customerId,oneInList,subjectId);
keywordsTypeVo.setChildrenCount(count);
} else {
//获取每个下面最后一级分类列表
......@@ -180,7 +208,7 @@ public class KeywordsTypeServiceImpl extends ServiceImpl<KeywordsTypeMapper, Key
getFinalIdListInMap(singleList, pidMap, finalGradeList);
List<String> finalIdList = finalGradeList.stream().map(KeywordsTypeVo::getId).collect(Collectors.toList());
if (!finalIdList.isEmpty()) {
Integer count = keyWordsService.countByTypeAndIdList(finalIdList, subjectId);
Integer count = keyWordsService.countByTypeAndIdList(userId,customerId,finalIdList, subjectId);
keywordsTypeVo.setChildrenCount(count);
} else {
keywordsTypeVo.setChildrenCount(0);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论