提交 7c581c80 作者: 925993793@qq.com

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

# Conflicts:
#	src/main/java/com/zzsn/event/controller/EventManageController.java
#	src/main/resources/application-test.yml
# 镜像仓库
# 版本 T1.0.0: T为测试版,R为稳定版
version="R1.0.0" # 可自定义
# 镜像仓库地址
domain="swr.cn-southwest-2.myhuaweicloud.com"
# 镜像分组,按部门区分
namespace="ciglobal"
#repo_username="ciglobal-ap"
#repo_passwd="ciglobal.zzsn"
repo_username="cn-southwest-2@O2PWMHIOLKRM0YPULE96"
repo_passwd="9e59dd258a1b25f2949549ad60be11b7a6f0f94349f62ad5b5d7fd1d839a1c0e"
# 服务配置
# 数据挂载根目录
root_dir="/zzsn/clb/logs"
# 需根据日志配置填写,比如:logback-spring.xml
svc_logs="/workspace/logs"
# 环境变量 test or prod
svc_env="yjzx"
profiles="nacos"
# 服务名
svc_name="subject-server"
# 服务端口
svc_port="1689"
# nacos配置
nacos_server="192.168.0.19:8848"
nacos_username="nacos"
nacos_password="Nacos.2024Socan"
# 资源限制
## cpu
limit_cpu=2.0
limit_mem=6g
\ No newline at end of file
...@@ -518,8 +518,10 @@ public class FileController { ...@@ -518,8 +518,10 @@ public class FileController {
private List<String> supplyHeaders(String[] arr, List<LabelModelVo> labelTypeVos) { private List<String> supplyHeaders(String[] arr, List<LabelModelVo> labelTypeVos) {
List<String> headers = new ArrayList<>(Arrays.asList(arr)); List<String> headers = new ArrayList<>(Arrays.asList(arr));
if (CollectionUtils.isNotEmpty(labelTypeVos)) { if (CollectionUtils.isNotEmpty(labelTypeVos)) {
for (LabelModelVo labelTypeVo : labelTypeVos) { for (int i = 0; i < labelTypeVos.size(); i++) {
LabelModelVo labelTypeVo = labelTypeVos.get(i);
headers.add(labelTypeVo.getLabelName()); headers.add(labelTypeVo.getLabelName());
labelTypeVo.setOrderNo(i);
} }
} }
return headers; return headers;
...@@ -669,7 +671,6 @@ public class FileController { ...@@ -669,7 +671,6 @@ public class FileController {
data.add(sb.substring(1)); data.add(sb.substring(1));
} }
} }
} }
list.add(data); list.add(data);
} }
......
...@@ -910,6 +910,19 @@ public class SubjectManageController { ...@@ -910,6 +910,19 @@ public class SubjectManageController {
Subject subject = subjectService.subjectUpdateScope(subjectId, type, scop); Subject subject = subjectService.subjectUpdateScope(subjectId, type, scop);
return Result.OK(subject); return Result.OK(subject);
} }
/**
* 更新事件subject的数据范围
*
* @param subjectId 专题id
*/
@GetMapping("/eventUpdateScope")
public Result<?> eventUpdateScope(@RequestParam(name = "subjectId") String subjectId,
@RequestParam(name = "type") String type,
@RequestParam(name = "scop", defaultValue = "") String scop
) {
Event subject = subjectService.eventUpdateScope(subjectId, type, scop);
return Result.OK(subject);
}
/** /**
* 绑定信息源标签数据 * 绑定信息源标签数据
......
...@@ -128,7 +128,7 @@ public class RelationBindController { ...@@ -128,7 +128,7 @@ public class RelationBindController {
IPage<InfoSourceVo> pageList = null; IPage<InfoSourceVo> pageList = null;
if (CollectionUtil.isNotEmpty(subjectIdList) && subjectIdList.size() == 1 && subjectId.equals(subjectIdList.get(0))) { if (CollectionUtil.isNotEmpty(subjectIdList) && subjectIdList.size() == 1 && subjectId.equals(subjectIdList.get(0))) {
Subject byId = subjectService.getById(subjectId); Subject byId = subjectService.getSubjectOrEventById(subjectId);
if (ObjectUtil.isNotNull(byId) && StringUtils.isNotEmpty(byId.getDataScope()) && byId.getDataScope().contains("1")) { if (ObjectUtil.isNotNull(byId) && StringUtils.isNotEmpty(byId.getDataScope()) && byId.getDataScope().contains("1")) {
Page<InfoSource> page = new Page<>(pageNo, pageSize); Page<InfoSource> page = new Page<>(pageNo, pageSize);
return Result.OK(infoSourceService.page(page, return Result.OK(infoSourceService.page(page,
......
...@@ -183,7 +183,7 @@ public class EventDataController { ...@@ -183,7 +183,7 @@ public class EventDataController {
* @author lkg * @author lkg
* @date 2024/7/22 * @date 2024/7/22
*/ */
@PostMapping("/simpleSaveEvent") //@PostMapping("/simpleSaveEvent")
public Result<?> addEvent(@RequestBody AddEventVO addEventVO) { public Result<?> addEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_ADD)){ if(StringUtils.isNotEmpty(CLB_EVENT_ADD)){
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
...@@ -258,6 +258,32 @@ public class EventDataController { ...@@ -258,6 +258,32 @@ public class EventDataController {
} }
} }
@PostMapping("/simpleSaveEvent")
public Result<?> addEvent_new(@RequestBody AddEventVO addEventVO) {
KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
if (keywordsVO != null) {
UserVo currentUser = UserUtil.getLoginUser();
AddEventParam eventParam = new AddEventParam();
BeanUtils.copyProperties(addEventVO, eventParam);
eventParam.setCreateBy(currentUser.getUsername());
Event event = eventService.saveMain(eventParam);
//新增关键词
keyWordsService.saveBaseAndMap(event, keywordsVO.getKeyword(), keywordsVO.getExclusionWord());
CompletableFuture.runAsync(() -> {
//插入xxlJob
iXxlJobInfoService.eventInsert(event);
//通知采集
configurationMessageService.bindKeyWordsEventSend(event.getId());
//事件分析
kafkaTemplate.send(EVENT_MODEL_KAFKA_CHANNEL, event.getEventCode());
});
return Result.OK();
} else {
return Result.FAIL(500, "关键词不能为空");
}
}
/** /**
* 编辑事件(页面简化版) * 编辑事件(页面简化版)
* *
...@@ -265,7 +291,7 @@ public class EventDataController { ...@@ -265,7 +291,7 @@ public class EventDataController {
* @author lkg * @author lkg
* @date 2024/7/22 * @date 2024/7/22
*/ */
@PostMapping("/simpleUpdateEvent") //@PostMapping("/simpleUpdateEvent")
public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) { public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_EDIT)){ if(StringUtils.isNotEmpty(CLB_EVENT_EDIT)){
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
...@@ -325,6 +351,28 @@ public class EventDataController { ...@@ -325,6 +351,28 @@ public class EventDataController {
} }
} }
@PostMapping("/simpleUpdateEvent")
public Result<?> updateEvent_new(@RequestBody AddEventVO addEventVO) {
KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
AddEventParam addEventParam = new AddEventParam();
BeanUtils.copyProperties(addEventVO, addEventParam);
if (keywordsVO != null) {
UserVo currentUser = UserUtil.getLoginUser();
addEventParam.setUpdateTime(new Date());
addEventParam.setUpdateBy(currentUser.getUsername());
eventService.updateMain(addEventParam);
keyWordsService.updateBaseAndMap(addEventParam, keywordsVO.getKeyword(), keywordsVO.getExclusionWord());
CompletableFuture.runAsync(() -> {
//通知采集
configurationMessageService.bindKeyWordsEventSend(addEventParam.getId());
});
return Result.OK();
} else {
return Result.FAIL(500, "关键词不能为空");
}
}
/** /**
* 事件配置校验 * 事件配置校验
* *
...@@ -345,7 +393,7 @@ public class EventDataController { ...@@ -345,7 +393,7 @@ public class EventDataController {
* @author lkg * @author lkg
* @date 2025/2/6 * @date 2025/2/6
*/ */
@GetMapping("/clearData") //@GetMapping("/clearData")
public Result<?> clearData(@RequestParam String eventId){ public Result<?> clearData(@RequestParam String eventId){
if (StringUtils.isNotEmpty(CLB_CLEAR_DATA)) { if (StringUtils.isNotEmpty(CLB_CLEAR_DATA)) {
try { try {
...@@ -363,14 +411,19 @@ public class EventDataController { ...@@ -363,14 +411,19 @@ public class EventDataController {
return Result.OK("正在清空数据"); return Result.OK("正在清空数据");
} }
@GetMapping("/clearData")
public Result<?> clearData_new(@RequestParam String eventId){
eventService.clearSubjectData(eventId);
return Result.OK("正在清空数据");
}
/** /**
* 通过id删除 * 通过id删除
* *
* @param param:id 事件id * @param param:id 事件id
* @return * @return
*/ */
@ApiOperation(value = "事件-通过id删除", notes = "事件-通过id删除") //@PostMapping(value = "/simpleDeleteEvent")
@PostMapping(value = "/simpleDeleteEvent")
public Result<?> delete(@RequestBody JSONObject param) { public Result<?> delete(@RequestBody JSONObject param) {
if(StringUtils.isNotEmpty(CLB_EVENT_DELETE)){ if(StringUtils.isNotEmpty(CLB_EVENT_DELETE)){
try { try {
...@@ -415,6 +468,19 @@ public class EventDataController { ...@@ -415,6 +468,19 @@ public class EventDataController {
} }
} }
@PostMapping(value = "/simpleDeleteEvent")
public Result<?> delete_new(@RequestBody JSONObject param) {
String id = param.getString("id");
eventService.deleteMain(id);
CompletableFuture.runAsync(() -> {
EventVO eventVO = eventService.queryInfo(id);
iXxlJobInfoService.deleteByInfosourceCode(eventVO.getEventCode());
//删除关键词
keyWordsService.removeBaseAndMap(id);
});
return Result.OK();
}
@GetMapping("/labelList") @GetMapping("/labelList")
public Result<?> labelList(){ public Result<?> labelList(){
......
package com.zzsn.event.entity; package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.Date; import java.util.Date;
...@@ -53,6 +52,7 @@ public class ClbModelArrangeSubjectMap { ...@@ -53,6 +52,7 @@ public class ClbModelArrangeSubjectMap {
/** /**
* 删除标志 0-正常 1-删除 * 删除标志 0-正常 1-删除
*/ */
@TableLogic
@TableField("del_flag") @TableField("del_flag")
private Integer delFlag; private Integer delFlag;
...@@ -73,4 +73,7 @@ public class ClbModelArrangeSubjectMap { ...@@ -73,4 +73,7 @@ public class ClbModelArrangeSubjectMap {
*/ */
@TableField("update_time") @TableField("update_time")
private Date updateTime; private Date updateTime;
@Excel(name = "专题名称", width = 15)
@ApiModelProperty(value = "专题名称")
private String subjectName;
} }
...@@ -118,6 +118,9 @@ public class Event { ...@@ -118,6 +118,9 @@ public class Event {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
/**数据范围(是否是全库) - 采集库全库-1,企业库全库-2,政策库全库-3*/
@TableField(updateStrategy = FieldStrategy.IGNORED) // 忽略更新策略
private String dataScope;
/** /**
* 修改人id * 修改人id
*/ */
...@@ -218,6 +221,7 @@ public class Event { ...@@ -218,6 +221,7 @@ public class Event {
* 是否开启采集(1-是;0-否) * 是否开启采集(1-是;0-否)
*/ */
private Integer ynCollect; private Integer ynCollect;
/** /**
* 第一次开启时间 * 第一次开启时间
*/ */
......
...@@ -621,8 +621,8 @@ public class EsService { ...@@ -621,8 +621,8 @@ public class EsService {
*/ */
public IPage<EventDataVO> collectPageList(InfoDataSearchCondition eventDataCondition) { public IPage<EventDataVO> collectPageList(InfoDataSearchCondition eventDataCondition) {
String index = Constants.COLLECT_INDEX; String index = Constants.COLLECT_INDEX;
Subject byId = subjectService.getSubjectOrEventById(eventDataCondition.getSubjectId());
if ("1".equals(eventDataCondition.getIsSubject())) { if ("1".equals(eventDataCondition.getIsSubject())) {
Subject byId = subjectService.getById(eventDataCondition.getSubjectId());
//更新开始、结束时间 //更新开始、结束时间
if (byId.getTimeEnable() != null) { if (byId.getTimeEnable() != null) {
String timeEnable = DateUtil.format(byId.getTimeEnable(), "yyyy-MM-dd"); String timeEnable = DateUtil.format(byId.getTimeEnable(), "yyyy-MM-dd");
...@@ -701,14 +701,20 @@ public class EsService { ...@@ -701,14 +701,20 @@ public class EsService {
infoSourceIdList.addAll(wordsIdList); infoSourceIdList.addAll(wordsIdList);
} }
//装配信息源的条件 //装配信息源的条件
if (CollectionUtils.isNotEmpty(infoSourceIdList)) { if (!StrUtil.contains(byId.getDataScope(),"1") && CollectionUtils.isNotEmpty(infoSourceIdList)) {
boolQuery.must(QueryBuilders.termsQuery("sid", infoSourceIdList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList()))); boolQuery.must(QueryBuilders.termsQuery("sid", infoSourceIdList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList())));
} else if (StrUtil.contains(byId.getDataScope(),"1")) {
}else if (!Constants.COLLECT_INDEX.equals(index)){
} else { } else {
return new Page<>(); return new Page<>();
} }
} else { } else {
boolQuery.must(QueryBuilders.termQuery("sid", eventDataCondition.getSourceId())); boolQuery.must(QueryBuilders.termQuery("sid", eventDataCondition.getSourceId()));
} }
//
specialQuery(byId,eventDataCondition, boolQuery);
//高级查询数据处理 //高级查询数据处理
BoolQueryBuilder superQuery = buildSuperQuery(eventDataCondition.getSuperQueryMatchType(), eventDataCondition.getSuperQueryParams()); BoolQueryBuilder superQuery = buildSuperQuery(eventDataCondition.getSuperQueryMatchType(), eventDataCondition.getSuperQueryParams());
if (superQuery != null) { if (superQuery != null) {
...@@ -769,6 +775,13 @@ public class EsService { ...@@ -769,6 +775,13 @@ public class EsService {
return pageData; return pageData;
} }
private void specialQuery(Subject byId, InfoDataSearchCondition eventDataCondition, BoolQueryBuilder boolQuery) {
if (StrUtil.isNotBlank(byId.getEsIndex()) && "researchreportdata".equals(byId.getEsIndex()) && StrUtil.equals(byId.getId(),"1662011688013963265")){
//研报库数据,查询企业库的研报类型的数据
boolQuery.must(QueryBuilders.termQuery("type.keyword", "0"));
}
}
/** /**
* 事件对应专题库的资讯分页列表 * 事件对应专题库的资讯分页列表
......
...@@ -36,6 +36,7 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> { ...@@ -36,6 +36,7 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> {
* @date 2024/9/12 * @date 2024/9/12
*/ */
KeywordsVO keywordInfoByEventId(@Param("eventId") String eventId); KeywordsVO keywordInfoByEventId(@Param("eventId") String eventId);
List<KeywordsVO> keywordInfoByEventIdList(@Param("eventId") String eventId);
/** /**
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
t.event_type, t.event_type,
t.sort_order, t.sort_order,
t.yn_collect, t.yn_collect,
t.data_scope,
t.first_open_time, t.first_open_time,
stm.type_id as subjectTypeId, stm.type_id as subjectTypeId,
psm.project_id, psm.project_id,
...@@ -50,8 +51,8 @@ ...@@ -50,8 +51,8 @@
</select> </select>
<select id="pageList" resultType="com.zzsn.event.vo.EventManageVO"> <select id="pageList" resultType="com.zzsn.event.vo.EventManageVO">
select t2.type_name,t1.id,t1.event_icon,t1.event_name,m.subjectTypeName,t1.event_label,t1.status, select t2.type_name,t1.id,t1.event_icon,t1.event_name,m.subjectTypeName,t1.event_label,t1.status,t1.event_code,
t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by,t1.data_scope
from event t1 from event t1
inner join event_category t2 on t1.event_type =t2.id inner join event_category t2 on t1.event_type =t2.id
INNER JOIN INNER JOIN
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
and t1.create_time <![CDATA[ <= ]]> #{endTime} and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="createBy!=null and createBy != ''"> <if test="createBy!=null and createBy != ''">
and t1.create_by like CONCAT('%',#{create_by},'%') and t1.create_by like CONCAT('%',#{createBy},'%')
</if> </if>
<if test="order!=null and order != ''"> <if test="order!=null and order != ''">
order by t1.${order} order by t1.${order}
...@@ -137,7 +138,7 @@ ...@@ -137,7 +138,7 @@
and t1.create_time <![CDATA[ <= ]]> #{endTime} and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if> </if>
<if test="createBy!=null and createBy != ''"> <if test="createBy!=null and createBy != ''">
and t1.create_by like CONCAT('%',#{create_by},'%') and t1.create_by like CONCAT('%',#{createBy},'%')
</if> </if>
</select> </select>
......
...@@ -182,4 +182,10 @@ ...@@ -182,4 +182,10 @@
</if> </if>
group by b.id group by b.id
</select> </select>
<select id="keywordInfoByEventIdList" resultType="com.zzsn.event.vo.KeywordsVO">
select word.id, word.words_code, word.key_word, word.exclusion_word,map.binding_type
from key_words word
inner join subject_keywords_map map on word.id = map.keywords_id
where map.subject_id = #{eventId}
</select>
</mapper> </mapper>
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
LEFT JOIN subject_type c ON b.type_id = c.id LEFT JOIN subject_type c ON b.type_id = c.id
LEFT JOIN subject_statistic_info s on s.subject_id = d.id LEFT JOIN subject_statistic_info s on s.subject_id = d.id
where where
((d.face_public = 1 and d.create_by = #{username}) or (d.face_public = 1 and ${sql})) (d.create_by = #{username} or (d.face_public = 1 and ${sql}))
<if test="subjectCondition.environment !=null and subjectCondition.environment !=''"> <if test="subjectCondition.environment !=null and subjectCondition.environment !=''">
and d.environment =#{subjectCondition.environment} and d.environment =#{subjectCondition.environment}
</if> </if>
......
...@@ -241,10 +241,11 @@ ...@@ -241,10 +241,11 @@
</select> </select>
<select id="allList" resultType="com.zzsn.event.entity.SubjectType"> <select id="allList" resultType="com.zzsn.event.entity.SubjectType">
select t.* from subject_type t where 1=1 select t.* from subject_type t
<if test="userId !=null and userId != ''"> <if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on t.id=dp.permission_id and dp.user_id = #{userId} inner join sys_user_data_permission dp on t.id=dp.permission_id and dp.user_id = #{userId}
</if> </if>
where 1=1
<if test="category !=null"> <if test="category !=null">
and t.category = #{category} and t.category = #{category}
</if> </if>
......
...@@ -153,7 +153,7 @@ public interface IEventService extends IService<Event> { ...@@ -153,7 +153,7 @@ public interface IEventService extends IService<Event> {
void deleteMain(String id); void deleteMain(String id);
void updateStatus(String eventId, Integer status); Event updateStatus(String eventId, Integer status);
/** /**
* 事件配置校验 * 事件配置校验
......
...@@ -64,6 +64,7 @@ public interface IKeyWordsService extends IService<KeyWords> { ...@@ -64,6 +64,7 @@ public interface IKeyWordsService extends IService<KeyWords> {
* @date 2024/9/12 * @date 2024/9/12
*/ */
KeywordsVO keywordInfoByEventId(String eventId); KeywordsVO keywordInfoByEventId(String eventId);
List<KeywordsVO> keywordInfoByEventIdList(String eventId);
/** /**
* 专题绑定的关键词组-分页列表 * 专题绑定的关键词组-分页列表
...@@ -90,4 +91,33 @@ public interface IKeyWordsService extends IService<KeyWords> { ...@@ -90,4 +91,33 @@ public interface IKeyWordsService extends IService<KeyWords> {
Integer countByTypeAndIdList(String userId, String customerId,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); List<KeyWordsPage> bindKeyWordsListByIdsAndBindType(List<String> ids, String bindingType,Integer metaSearchFlag);
/**
* 保存基本信息以及关系数据
*
* @param event 事件信息
* @param keyword 关键词
* @param exclusionWord 排除词
* @author lkg
* @date 2025/7/15
*/
void saveBaseAndMap(Event event, String keyword, String exclusionWord);
/**
* 更新基本信息以及关系数据
*
* @param event 事件信息
* @param keyword 关键词
* @param exclusionWord 排除词
* @author lkg
* @date 2025/7/15
*/
void updateBaseAndMap(Event event, String keyword, String exclusionWord);
/**
* 删除基本信息以及关系数据
*
* @param eventId 事件id
* @author lkg
* @date 2025/7/15
*/
void removeBaseAndMap(String eventId);
} }
...@@ -3,6 +3,7 @@ package com.zzsn.event.service; ...@@ -3,6 +3,7 @@ package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.Subject; import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectStatisticInfo; import com.zzsn.event.entity.SubjectStatisticInfo;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
...@@ -206,4 +207,9 @@ public interface SubjectService extends IService<Subject> { ...@@ -206,4 +207,9 @@ public interface SubjectService extends IService<Subject> {
Subject subjectUpdateScope(String subjectId, String type, String scop); Subject subjectUpdateScope(String subjectId, String type, String scop);
Event eventUpdateScope(String subjectId, String type, String scop);
/**根据id查询专题或者事件*/
Subject getSubjectOrEventById(String id);
/**根据编码查询专题或者事件*/
Subject getSubjectOrEvent(String subjectCode);
} }
...@@ -48,6 +48,8 @@ public class CommonServiceImpl implements CommonService { ...@@ -48,6 +48,8 @@ public class CommonServiceImpl implements CommonService {
private SubjectKeywordsService subjectKeywordsService; private SubjectKeywordsService subjectKeywordsService;
@Autowired @Autowired
private ObsUtil obsUtil; private ObsUtil obsUtil;
@Autowired
private SubjectDictMapService subjectDictMapService;
@Override @Override
...@@ -299,7 +301,24 @@ public class CommonServiceImpl implements CommonService { ...@@ -299,7 +301,24 @@ public class CommonServiceImpl implements CommonService {
@Override @Override
public List<LabelModelVo> subjectModelBindLabels(List<String> subjectIds) { public List<LabelModelVo> subjectModelBindLabels(List<String> subjectIds) {
return commonMapper.subjectModelBindLabels(subjectIds); Set<LabelModelVo> dataSet = new HashSet<>();
List<DictVO> allList = new ArrayList<>();
for (String subjectId : subjectIds) {
List<DictVO> boundList = subjectDictMapService.boundList(subjectId);
allList.addAll(boundList);
}
for (DictVO dictVO : allList) {
LabelModelVo labelModelVo = new LabelModelVo();
labelModelVo.setLabelName(dictVO.getName());
String labelMark = StringUtils.isEmpty(dictVO.getLabelMark()) ? dictVO.getCode() : dictVO.getLabelMark();
if ("enterprise".equals(labelMark)) {
labelModelVo.setLabelMark("company_label");
} else {
labelModelVo.setLabelMark(labelMark);
}
dataSet.add(labelModelVo);
}
return new ArrayList<>(dataSet);
} }
@Override @Override
......
...@@ -133,7 +133,7 @@ public class ConfigurationMessageService { ...@@ -133,7 +133,7 @@ public class ConfigurationMessageService {
} catch (Exception e) { } catch (Exception e) {
log.error("删除专题缓存失败{}",e.getMessage(),e); log.error("删除专题缓存失败{}",e.getMessage(),e);
} }
Subject byId = subjectService.getById(subjectId); Subject byId = subjectService.getSubjectOrEventById(subjectId);
if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) { if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) {
log.info("未查询到专题或专题未启用"); log.info("未查询到专题或专题未启用");
return; return;
...@@ -196,7 +196,7 @@ public class ConfigurationMessageService { ...@@ -196,7 +196,7 @@ public class ConfigurationMessageService {
} catch (Exception e) { } catch (Exception e) {
log.error("删除专题缓存失败{}",e.getMessage(),e); log.error("删除专题缓存失败{}",e.getMessage(),e);
} }
Subject byId = subjectService.getById(subjectId); Subject byId = subjectService.getSubjectOrEventById(subjectId);
if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) { if (byId == null || byId.getStatus() == null || byId.getStatus() != 1) {
log.info("未查询到专题或专题未启用"); log.info("未查询到专题或专题未启用");
return; return;
...@@ -241,7 +241,7 @@ public class ConfigurationMessageService { ...@@ -241,7 +241,7 @@ public class ConfigurationMessageService {
} }
public void subjectEnterpriseSourceSync(String subjectId){ public void subjectEnterpriseSourceSync(String subjectId){
Subject subject = subjectService.getById(subjectId); Subject subject = subjectService.getSubjectOrEventById(subjectId);
if (subject == null || subject.getStatus() == null || subject.getStatus() != 1) { if (subject == null || subject.getStatus() == null || subject.getStatus() != 1) {
log.info("未查询到专题或专题未启用"); log.info("未查询到专题或专题未启用");
return; return;
...@@ -477,7 +477,7 @@ public class ConfigurationMessageService { ...@@ -477,7 +477,7 @@ public class ConfigurationMessageService {
} }
public void subjectPolicySourceSync(String subjectId){ public void subjectPolicySourceSync(String subjectId){
Subject subject = subjectService.getById(subjectId); Subject subject = subjectService.getSubjectOrEventById(subjectId);
if (subject == null || subject.getStatus() == null || subject.getStatus() != 1) { if (subject == null || subject.getStatus() == null || subject.getStatus() != 1) {
log.info("未查询到专题或专题未启用"); log.info("未查询到专题或专题未启用");
return; return;
......
...@@ -151,7 +151,6 @@ public class InformationServiceImpl implements InformationService { ...@@ -151,7 +151,6 @@ public class InformationServiceImpl implements InformationService {
if (total > 0) { if (total > 0) {
List<DisplayInfo> dataList = new ArrayList<>(); List<DisplayInfo> dataList = new ArrayList<>();
List<LabelModelVo> labelModelVos = commonService.subjectModelBindLabels(subjectIdList); List<LabelModelVo> labelModelVos = commonService.subjectModelBindLabels(subjectIdList);
Map<String, List<LabelModelVo>> modelMap = labelModelVos.stream().collect(Collectors.groupingBy(LabelModelVo::getSubjectId));
List<SpecialInformation> records = specialInformationIPage.getRecords(); List<SpecialInformation> records = specialInformationIPage.getRecords();
for (SpecialInformation specialInformation : records) { for (SpecialInformation specialInformation : records) {
DisplayInfo info = new DisplayInfo(); DisplayInfo info = new DisplayInfo();
...@@ -165,8 +164,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -165,8 +164,7 @@ public class InformationServiceImpl implements InformationService {
} }
} }
//标签处理 //标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId()); formatLabel(labelModelVos, info);
formatLabel(modelVoList, info);
dataList.add(info); dataList.add(info);
} }
page.setRecords(dataList); page.setRecords(dataList);
......
...@@ -10,6 +10,7 @@ import cn.hutool.json.JSONUtil; ...@@ -10,6 +10,7 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -106,6 +107,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -106,6 +107,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Autowired @Autowired
private InfoSourceGroupService infoSourceGroupService; private InfoSourceGroupService infoSourceGroupService;
@Autowired @Autowired
private IEventService eventService;
@Autowired
private ISubjectInfoSourceMapService iSubjectInfoSourceMapService; private ISubjectInfoSourceMapService iSubjectInfoSourceMapService;
@Autowired @Autowired
private ParamAop paramAop; private ParamAop paramAop;
...@@ -1082,6 +1085,50 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -1082,6 +1085,50 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
return byId; return byId;
} }
@Override
public Event eventUpdateScope(String subjectId, String type, String scop) {
Event byId = eventService.getById(subjectId);
// Subject byId = super.getById(subjectId);
if (ObjectUtil.isNotNull(byId)){
String dataScope = byId.getDataScope();
if (StrUtil.isNotBlank(dataScope)){
List<String> scopeList = CollectionUtil.newArrayList(dataScope.split(","));
if (StrUtil.equals(type,"1") && "1".equals(scop)){
scopeList.add("1");
}else if (StrUtil.equals(type,"1") && "0".equals(scop)){
scopeList.remove("1");
}
if (StrUtil.equals(type,"2") && "1".equals(scop)){
scopeList.add("2");
}else if (StrUtil.equals(type,"2") && "0".equals(scop)){
scopeList.remove("2");
}
if (StrUtil.equals(type,"3") && "1".equals(scop)){
scopeList.add("3");
}else if (StrUtil.equals(type,"3") && "0".equals(scop)){
scopeList.remove("3");
}
if (CollectionUtil.isNotEmpty(scopeList)) {
scopeList = scopeList.stream().distinct().collect(Collectors.toList());
String join = StrUtil.join(",", scopeList);
byId.setDataScope(join);
}else {
byId.setDataScope(null);
}
eventService.updateById(byId);
}else {
if ("1".equals(scop)) {
byId.setDataScope(scop);
}
eventService.updateById(byId);
}
}
return byId;
}
private void unBindInfoSourceGroup(SubjectPage subjectPage) { private void unBindInfoSourceGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType(); String sourceBindType = subjectPage.getSourceBindType();
...@@ -1453,5 +1500,92 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -1453,5 +1500,92 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
@Override
public Subject getSubjectOrEvent(String subjectCode) {
try {
//根据编码查询出专题设置信息
//查询专题的设置信息
QueryWrapper<Subject> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("subject_code", subjectCode);
Subject subject = super.getOne(queryWrapper);
if (ObjectUtil.isEmpty(subject)){
QueryWrapper<Event> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("event_code", subjectCode);
Event one = eventService.getOne(queryWrapper1);
if (ObjectUtil.isNotEmpty(one)) {
subject = new Subject();
subject.setId(one.getId());
subject.setSubjectCode(one.getEventCode());
subject.setSubjectName(one.getEventName());
subject.setSubjectType(2);
subject.setCreateTime(one.getCreateTime());
subject.setTimeEnable(one.getStartTime());
subject.setTimeDisable(one.getEndTime());
subject.setDataScope(one.getDataScope());
subject.setFirstOpenTime(one.getFirstOpenTime());
subject.setStatus(one.getStatus());
}
}
if (ObjectUtil.isEmpty(subject)){
return null;
}
// if (subject.getCreateTime().before(DateTime.of("2023-11-30","yyyy-MM-dd"))){
// log.info("2023-11-30之前创建的专题{}按照之前的处理逻辑处理",subject.getSubjectName());
// return null;
// }
return subject;
} catch (Exception e) {
log.error("查询专题异常{}",e.getMessage(),e);
return null;
}
}
@Override
public Subject getSubjectOrEventById(String id) {
try {
//根据编码查询出专题设置信息
//查询专题的设置信息
Subject subject = super.getById(id);
if (ObjectUtil.isEmpty(subject)){
Event one = eventService.getById(id);
if (ObjectUtil.isNotEmpty(one)) {
subject = new Subject();
subject.setId(one.getId());
subject.setSubjectCode(one.getEventCode());
subject.setSubjectName(one.getEventName());
subject.setSubjectType(2);
subject.setCreateTime(one.getCreateTime());
subject.setTimeEnable(one.getStartTime());
subject.setTimeDisable(one.getEndTime());
subject.setDataScope(one.getDataScope());
subject.setFirstOpenTime(one.getFirstOpenTime());
subject.setStatus(one.getStatus());
}
}
if (ObjectUtil.isEmpty(subject)){
return null;
}
// if (subject.getCreateTime().before(DateTime.of("2023-11-30","yyyy-MM-dd"))){
// log.info("2023-11-30之前创建的专题{}按照之前的处理逻辑处理",subject.getSubjectName());
// return null;
// }
return subject;
} catch (Exception e) {
log.error("查询专题异常{}",e.getMessage(),e);
return null;
}
}
} }
...@@ -12,6 +12,7 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -12,6 +12,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -72,6 +73,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi ...@@ -72,6 +73,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
@Override @Override
public List<DictTreeVO> dictItemTreeList(List<String> dictIds) { public List<DictTreeVO> dictItemTreeList(List<String> dictIds) {
List<DictTreeVO> itemList = baseMapper.dictItemList(dictIds); List<DictTreeVO> itemList = baseMapper.dictItemList(dictIds);
if (CollectionUtils.isEmpty(itemList)) {
return new ArrayList<>();
}
List<DictTreeVO> tree = TreeUtil.tree(itemList, "0"); List<DictTreeVO> tree = TreeUtil.tree(itemList, "0");
tree.forEach(e -> e.setPid(e.getDictId())); tree.forEach(e -> e.setPid(e.getDictId()));
return tree; return tree;
......
...@@ -29,6 +29,9 @@ public class EventManageVO { ...@@ -29,6 +29,9 @@ public class EventManageVO {
private String startTime; private String startTime;
private String endTime; private String endTime;
private Integer status; private Integer status;
private String dataScope;
private String eventCode;
/**专题题绑定流程信息*/ /**专题题绑定流程信息*/
private List<ClbModelArrange> clbModelArranges; private List<ClbModelArrange> clbModelArranges;
} }
...@@ -78,4 +78,5 @@ public class EventVO { ...@@ -78,4 +78,5 @@ public class EventVO {
List<RegionVO> regionList; List<RegionVO> regionList;
/**关键词*/ /**关键词*/
private KeywordsVO keywordsVO; private KeywordsVO keywordsVO;
private String dataScope;
} }
...@@ -29,4 +29,6 @@ public class KeywordsVO { ...@@ -29,4 +29,6 @@ public class KeywordsVO {
* 屏蔽词 * 屏蔽词
*/ */
private String exclusionWord; private String exclusionWord;
/**绑定类型1:绑定为采集词,2:绑定为过滤词,3绑定为排除词组*/
private String bindingType;
} }
...@@ -155,7 +155,7 @@ python: ...@@ -155,7 +155,7 @@ python:
hot-crawler: http://139.9.144.106:5000/data?option=OPTION hot-crawler: http://139.9.144.106:5000/data?option=OPTION
jeecg: jeecg:
shiro: shiro:
excludeUrls: info/subjectPageListGroupByLabel,/subject/simple/**,/subject/manage/visiblePageListNoSign,/test/** excludeUrls: info/subjectPageListGroupByLabel,/subject/simple/queryInfoNoSign,/subject/manage/visiblePageListNoSign
kafka: kafka:
topic: topic:
subject: subject:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论