提交 4f2d1685 作者: 925993793@qq.com

事件增删改查逻辑修改

上级 2b4f07b3
package com.zzsn.event.vo;
package com.zzsn.clb.common.model.task.dto.titr;
import lombok.Data;
......@@ -25,9 +25,9 @@ public class KeyWordsDTO {
/**所属专题*/
private List<String> subjectIds;
/*关联事件开始事件*/
private Date startTime;
/**关联事件结束时间*/
private Date endTime;
//需要启动的信息采集器
......
package com.zzsn.event.constant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Constants {
private Constants() { }
......@@ -24,6 +29,8 @@ public class Constants {
public static final String EVENT_CONTEXT_SEND_TOPIC = "event_context_send_data";
//kafka 发送 伪事件脉络所需信息 主题
public static final String FAKE_EVENT_CONTEXT_SEND_TOPIC = "fake_event_context_send_data";
//kafka 发送 事件挖掘信息 主题
public static final String EVENT_DIG_SEND_TOPIC = "event_dig_send_data_test";
//kafka 接收 观点分析结果 主题
......@@ -34,6 +41,8 @@ public class Constants {
public static final String FAKE_EVENT_CONTEXT_RECEIVE_TOPIC = "fake_event_context_result_data";
//kafka 接收 事件分析报告 主题
public static final String EVENT_REPORT_RECEIVE_TOPIC = "event_report_result_data";
//kafka 接收 事件挖掘 主题
public static final String EVENT_DIG_RECEIVE_TOPIC = "event_dig_result_data";
//重复数索引ku
public final static String ES_REPEAT_OLD = "repeathold";
......@@ -47,5 +56,21 @@ public class Constants {
/*数据权限类型*/
public final static String PERMISSION_SUBJECT = "subject";
//事件默认绑定模型集合
public static final Map<String, String> DEFAULT_MODEL = new HashMap<String, String>() {{
put("1706918153597943809","3");
put("1720047300406849537","31");
put("1723954452169232385","1");
put("1725396958677307394","3");
}};
//事件默认绑定搜索引擎id集合
public final static List<String> DEFAULT_SEARCH_ENGINE = Arrays.asList("1539145903551361026","1539146006513135617","1539146115049140225");
/**
* 关键词数据入缓存 key前缀
*/
public static final String KEY_WORDS_TO_REDIS_PREFIX = "KEY_WORDS_TO_REDIS_1::";
//关键词采集通道
public static final String KEY_WORDS_COLLECT_TOPIC = "eventKeyWordsCrawl_1";
}
package com.zzsn.event.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.es.EsService;
import com.zzsn.event.service.EventSimpleService;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.ObjectUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
......@@ -18,10 +23,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
......@@ -45,6 +53,12 @@ public class EventDataController {
private EventSimpleService eventSimpleService;
@Autowired
private IXxlJobInfoService iXxlJobInfoService;
@Autowired
private IKeyWordsService keyWordsService;
@Autowired
private RedisUtil redisUtil;
@Resource
private KafkaTemplate<String, String> kafkaTemplate;
@Value("${translate.url:}")
private String TRANSLATE_URL;
......@@ -97,6 +111,18 @@ public class EventDataController {
public Result<?> addEvent(@RequestBody AddEventVO addEventVO) {
Event event = eventSimpleService.simpleSave(addEventVO);
iXxlJobInfoService.subjectInsert(event);
//关键词
KeyWords keyWords = keyWordsService.saveKeyword(event, addEventVO.getKeywords(), addEventVO.getExclusionWord());
KeyWordsDTO redisKeywordDTO = new KeyWordsDTO();
BeanUtils.copyProperties(keyWords, redisKeywordDTO);
redisKeywordDTO.setStartTime(event.getStartTime());
redisKeywordDTO.setEndTime(event.getEndTime());
redisKeywordDTO.setSearchEngines(Constants.DEFAULT_SEARCH_ENGINE);
redisUtil.set(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWords.getWordsCode(), redisKeywordDTO);
//插入xxljob
iXxlJobInfoService.keyWordsInsert(redisKeywordDTO);
//为了立即响应,关键词新增时放入一个首次录入消息队列
kafkaTemplate.send(Constants.KEY_WORDS_COLLECT_TOPIC, JSON.toJSONString(redisKeywordDTO));
return Result.OK();
}
......
package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzsn.event.constant.Result;
import com.zzsn.event.service.EventExtractService;
import com.zzsn.event.vo.EventExtractVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author lkg
* @date 2024/9/7
*/
@Api(tags = "事件审核管理")
@RestController
@RequestMapping("/examine")
public class EventExtractController {
@Autowired
private EventExtractService eventExtractService;
/**
* 伪事件信息分页列表
*
* @param eventName 事件名称
* @param eventType 时间分类
* @param startTime 开始时间
* @param endTime 结束时间
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/9/9
*/
public Result<?> pageList(@RequestParam(name = "eventName", required = false) String eventName,
@RequestParam(name = "eventType", required = false) Integer eventType,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
IPage<EventExtractVO> page = eventExtractService.pageList(eventName, eventType, startTime, endTime, pageNo, pageSize);
return Result.OK(page);
}
/**
* 删除
*
* @param id 主键id
* @author lkg
* @date 2024/9/9
*/
@GetMapping("/delete")
public Result<?> delete(@RequestParam String id){
eventExtractService.removeById(id);
return Result.OK();
}
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 频道标签映射表
* @Author: jeecg-boot
* @Date: 2023-03-14
* @Version: V1.0
*/
@Data
@TableName("clb_channel_label_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="clb_channel_label_map对象", description="频道标签映射表")
public class ClbChannelLabelMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**标签类别*/
@Excel(name = "标签id", width = 15)
@ApiModelProperty(value = "标签id")
private String labelId;
/**类别id*/
@Excel(name = "类别id", width = 15)
@ApiModelProperty(value = "类别id")
private String labelTypeId;
/**类别标识*/
@Excel(name = "类别标识", width = 15)
@ApiModelProperty(value = "类别标识")
private String labelTypeMark;
/**标签分类类别*/
@Excel(name = "标签分类类别", width = 15)
@ApiModelProperty(value = "标签分类类别")
private String labelType;
/**频道id*/
@Excel(name = "频道id", width = 15)
@ApiModelProperty(value = "频道id")
private String channelId;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**类别(1:标签类别 2:标签)*/
@Excel(name = "类别", width = 15)
@ApiModelProperty(value = "类别")
private Integer type;
/**标签类别名称*/
@TableField(exist = false)
private String labelName;
}
......@@ -146,6 +146,8 @@ public class Event {
private String publishDate;
/**排序号*/
private Integer sortOrder;
/**事件创建方式(1-用户创建;2-事件挖掘)*/
private Integer category;
......
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 挖掘到的事件
* @TableName event_extract
*/
@Data
@TableName("event_extract")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event_extract对象", description="挖掘事件")
public class EventExtract implements Serializable {
/**ID*/
@TableId(value = "id",type = IdType.ASSIGN_ID)
private String id;
/**
* 唯一id
*/
@TableField("unique_id")
private String uniqueId;
/**
* 名称
*/
@TableField("event_name")
private String eventName;
/**
* 事件类型
*/
@TableField("event_type")
private String eventType;
/**
* 开始时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField("start_time")
private Date startTime;
/**
* 结束时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField("end_time")
private Date endTime;
/**
* 自定义事件标签
*/
@TableField("event_label")
private String eventLabel;
/**
* 事件描述
*/
@TableField("event_describe")
private String eventDescribe;
/**
* 创建人id
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField("create_time")
private Date createTime;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 专题与模型关联表
* @Author: jeecg-boot
* @Date: 2021-12-16
* @Version: V1.0
*/
@Data
@TableName("subject_model_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="subject_model_map对象", description="专题与模型关联表")
public class SubjectModelMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
/**模型id*/
@Excel(name = "模型id", width = 15)
@ApiModelProperty(value = "模型id")
private String modelId;
/**种类(1:去重模型 2:筛选模型 3:标签模型)*/
@Excel(name = "种类(1:去重模型 2:筛选模型 3:标签模型)", width = 15)
@ApiModelProperty(value = "种类(1:去重模型 2:筛选模型 3:标签模型)")
private String type;
@Excel(name = "新旧模型标识,1为新模型标识", width = 15)
@ApiModelProperty(value = "新旧模型标识")
private Integer sign;
@TableField(exist = false)
private String modelName;
/**模型服务名称*/
@TableField(exist = false)
private String serviceName;
@TableField(exist = false)
private String url;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 频道表
* @Author: jeecg-boot
* @Date: 2022-05-11
* @Version: V1.0
*/
@Data
@TableName("sys_base_channel")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="sys_base_channel对象", description="频道表")
public class SysBaseChannel implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**频道名称*/
@Excel(name = "频道名称", width = 15)
@ApiModelProperty(value = "频道名称")
private String channelName;
/**频道配置来源*/
@Excel(name = "频道配置来源", width = 15)
@ApiModelProperty(value = "频道配置来源")
private String source;
/**频道组id集合*/
@Excel(name = "频道组id集合", width = 15)
@ApiModelProperty(value = "频道组id集合")
private String channelGroupIds;
/**频道id集合*/
@Excel(name = "频道id集合", width = 15)
@ApiModelProperty(value = "频道id集合")
private String channelIds;
/**专题id集合*/
@Excel(name = "专题id集合", width = 15)
@ApiModelProperty(value = "专题id集合")
private String subjectIds;
private String subjectTypes;
/**地域id集合*/
@Excel(name = "地域id集合", width = 15)
@ApiModelProperty(value = "地域id集合")
private String regionIds;
private String regionTypes;
/**企业id集合*/
@Excel(name = "企业id集合", width = 15)
@ApiModelProperty(value = "企业id集合")
private String enterpriseIds;
private String enterpriseTypes;
/**行业id集合*/
@Excel(name = "行业id集合", width = 15)
@ApiModelProperty(value = "行业id集合")
private String industryIds;
private String industryTypes;
/**标签类别id集合*/
@Excel(name = "标签类别id集合", width = 15)
@ApiModelProperty(value = "标签类别id集合")
private String labelIds;
/**具体某类标签的id*/
@Excel(name = "具体某类标签的id", width = 15)
@ApiModelProperty(value = "具体某类标签的id")
private String detailLabelIds;
/**组合的json*/
private Object json;
/**频道类型*/
@Excel(name = "频道类型", width = 15)
@ApiModelProperty(value = "频道类型")
private String displayType;
/**说明*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private String explanation;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**所属客户*/
@ApiModelProperty(value = "所属客户")
private String customerId;
/**与、或关系(and-与;or-或)*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
@ApiModelProperty(value = "与、或关系(and-与;or-或)")
private String relation;
/**标签类别名称*/
@ApiModelProperty(value = "标签类别名称")
private String labelType;
/**标签类别标识*/
@ApiModelProperty(value = "标签类别标识")
private String labelMark;
/**状态*/
private Integer status;
/**code编码*/
private String code;
@TableField(exist = false)
private Integer type;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 国家地域表
* @Author: jeecg-boot
* @Date: 2022-02-09
* @Version: V1.0
*/
@Data
@TableName("sys_base_region")
@ApiModel(value="sys_base_region对象", description="国家地域表")
public class SysBaseRegion implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**中文名称*/
@Excel(name = "中文名称", width = 15)
@ApiModelProperty(value = "中文名称")
private String nameCn;
/**中文标签*/
@Excel(name = "中文标签", width = 15)
@ApiModelProperty(value = "中文标签")
private String aliaCn;
/**英文名称*/
@Excel(name = "英文名称", width = 15)
@ApiModelProperty(value = "英文名称")
private String nameEn;
/**英文标签*/
@Excel(name = "英文标签", width = 15)
@ApiModelProperty(value = "英文标签")
private String aliaEn;
/**经度*/
@Excel(name = "经度", width = 15)
@ApiModelProperty(value = "经度")
private String longitude;
/**纬度*/
@Excel(name = "纬度", width = 15)
@ApiModelProperty(value = "纬度")
private String latitude;
/**所属洲*/
@Excel(name = "所属洲", width = 15)
@ApiModelProperty(value = "所属洲")
private String continent;
/**所属洲英文*/
@Excel(name = "所属洲英文", width = 15)
@ApiModelProperty(value = "所属洲英文")
private String continentEn;
/**所属洲二级中文名*/
@Excel(name = "所属洲二级中文名", width = 15)
@ApiModelProperty(value = "所属洲二级中文名")
private String continentSub;
/**所属洲二级英文名称*/
@Excel(name = "所属洲二级英文名称", width = 15)
@ApiModelProperty(value = "所属洲二级英文名称")
private String continentSubEn;
/**国家代码*/
@Excel(name = "国家代码", width = 15)
@ApiModelProperty(value = "国家代码")
private String code;
/**货币*/
@Excel(name = "货币", width = 15)
@ApiModelProperty(value = "货币")
private String currency;
/**官方语言*/
@Excel(name = "官方语言", width = 15)
@ApiModelProperty(value = "官方语言")
private String lang;
/**时区*/
@Excel(name = "时区", width = 15)
@ApiModelProperty(value = "时区")
private String timezone;
/**国土面积*/
@Excel(name = "国土面积", width = 15)
@ApiModelProperty(value = "国土面积")
private Integer area;
/**人口数量*/
@Excel(name = "人口数量", width = 15)
@ApiModelProperty(value = "人口数量")
private Integer population;
/**描述*/
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private String regionDesc;
/**地区描述英文*/
@Excel(name = "地区描述英文", width = 15)
@ApiModelProperty(value = "地区描述英文")
private String regionDescEn;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**父级节点*/
@Excel(name = "父级节点", width = 15)
@ApiModelProperty(value = "父级节点")
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
/**层级路径id集合*/
@Excel(name = "层级路径id集合", width = 15)
@ApiModelProperty(value = "层级路径id集合")
private String pathIds;
/**层级路径id集合*/
@Excel(name = "等级id", width = 15)
@ApiModelProperty(value = "等级id")
private String levelId;
}
......@@ -12,8 +12,7 @@ public enum CodePrefixEnum {
CUSTOMER_DEFAULT("CS", "客户编码默认前缀"),
SPECIAL_INFO_SOURCE_DEFAULT("PY","信息源编码默认前缀"),
INFO_SOURCE_GROUP_DEFAULT("ING","信息源组编码默认前缀"),
KEY_WORDS_DEFAULT("KW", "关键词默认前缀"),
SOCIAL_CREDIT_CODE_DEFAULT("ZZSN", "统一社会信用代码前缀"),
KEY_WORDS_DEFAULT("EVENT_KW", "关键词默认前缀"),
QCC_ENTERPRISE_ID_DEFAULT("QCC", "老企业库ID"),
COLUMN_CODE_DEFAULT("COL", "栏目编码默认前缀"),
LABEL_CODE_DEFAULT("LABEL", "标签编码默认前缀");
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.ClbChannelLabelMap;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 频道标签映射表
* @Author: jeecg-boot
* @Date: 2023-03-14
* @Version: V1.0
*/
@Mapper
public interface ClbChannelLabelMapMapper extends BaseMapper<ClbChannelLabelMap> {
}
package com.zzsn.event.mapper;
import com.zzsn.event.entity.EventExtract;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.vo.EventExtractVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author lenovo
* @description 针对表【event_extract(事件)】的数据库操作Mapper
* @createDate 2024-09-07 18:00:28
* @Entity com.zzsn.event.entity.EventExtract
*/
@Mapper
public interface EventExtractMapper extends BaseMapper<EventExtract> {
/**
* 伪事件信息列表
*
* @param eventName 事件名称
* @param eventType 时间分类
* @param startTime 开始时间
* @param endTime 结束时间
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/9/9
*/
List<EventExtractVO> pageList(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 伪事件信息总数量
*
* @param eventName 事件名称
* @param eventType 时间分类
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/9/9
*/
Long totalCount(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("startTime") String startTime, @Param("endTime") String endTime);
}
......@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.vo.KeywordsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -18,4 +19,13 @@ import java.util.List;
public interface KeyWordsMapper extends BaseMapper<KeyWords> {
List<KeyWordsPage> selectKeyWordsListById(@Param("subjectId") String subjectId);
/**
* 事件绑定关键词信息
*
* @param eventId 事件id
* @author lkg
* @date 2024/9/12
*/
KeywordsVO keywordInfoByEventId(@Param("eventId") String eventId);
}
......@@ -3,6 +3,7 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.SysLabelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -42,6 +43,9 @@ public interface LabelEntityMapper extends BaseMapper<LabelEntity> {
* @date 2024/4/9
*/
List<Node> regionOutList();
List<SysLabelVo> queryCustomLabel(@Param("sysLabelVo") SysLabelVo sysLabelVo);
}
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 专题关键词关联表
* @Author: jeecg-boot
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectModelMap;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 专题与模型关联表
* @Author: jeecg-boot
* @Date: 2021-12-16
* @Version: V1.0
*/
@Mapper
public interface SubjectModelMapMapper extends BaseMapper<SubjectModelMap> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysBaseChannel;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 频道表
* @Author: jeecg-boot
* @Date: 2022-05-11
* @Version: V1.0
*/
@Mapper
public interface SysBaseChannelMapper extends BaseMapper<SysBaseChannel> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysBaseDomesticRegion;
import com.zzsn.event.entity.SysBaseRegion;
import org.apache.ibatis.annotations.Mapper;
/**
......@@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
* @Version: V1.0
*/
@Mapper
public interface SysBaseDomesticRegionMapper extends BaseMapper<SysBaseDomesticRegion> {
public interface SysBaseRegionMapper extends BaseMapper<SysBaseRegion> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.EventExtractMapper">
<resultMap id="BaseResultMap" type="com.zzsn.event.entity.EventExtract">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="eventName" column="event_name" jdbcType="VARCHAR"/>
<result property="eventType" column="event_type" jdbcType="INTEGER"/>
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="eventLabel" column="event_label" jdbcType="VARCHAR"/>
<result property="eventDescribe" column="event_describe" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="pageList" resultType="com.zzsn.event.vo.EventExtractVO">
select t2.type_name,t1.id,t1.event_name,t1.event_type,t1.event_label,t1.create_time
from event_extract t1
inner join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventType!=null and eventType != ''">
and t1.event_type = #{eventType}
</if>
<if test="startTime!=null and startTime != ''">
and t1.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if>
order by t1.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="totalCount" resultType="Long">
select count(1) from event_extract t1
inner join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventType!=null and eventType != ''">
and t1.event_type = #{eventType}
</if>
<if test="startTime!=null and startTime != ''">
and t1.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if>
</select>
</mapper>
......@@ -17,6 +17,7 @@
<select id="queryInfo" resultType="com.zzsn.event.vo.EventVO">
select t.id,
t.event_code,
t.event_name,
t.event_icon,
t.start_time,
......@@ -312,7 +313,7 @@
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
where user_id = #{subjectCondition.userId}
and user_id = #{subjectCondition.userId}
)
</if>
) m
......@@ -359,7 +360,7 @@
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
where user_id = #{subjectCondition.userId}
and user_id = #{subjectCondition.userId}
)
</if>
) m
......
......@@ -11,4 +11,9 @@
where a.subject_id = #{subjectId}
</select>
<select id="keywordInfoByEventId" resultType="com.zzsn.event.vo.KeywordsVO">
select word.id,word.words_code,word.key_word,word.exclusion_word
from key_words word inner join subject_keywords_map map on word.id = map.keywords_id
where map.subject_id = #{eventId}
</select>
</mapper>
......@@ -39,4 +39,19 @@
select id,name_cn as name,pid,top_id from sys_base_region
</select>
<select id="queryCustomLabel" resultType="com.zzsn.event.vo.SysLabelVo">
select b.*, a.label_id as labelTypeId, a.label_type as labelType, c.label_mark as labelMark from sys_base_label_type_map a
inner join label_entity b on a.relation_id = b.id and b.pid = 0
left join sys_base_label_type c on a.label_id = c.id
where 1=1
<if test="sysLabelVo.labelIdList!=null and sysLabelVo.labelIdList.size()>0">
and a.label_id in
<foreach collection="sysLabelVo.labelIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="sysLabelVo.name!=null and sysLabelVo.name != ''">
and b.name like concat('%',#{sysLabelVo.name},'%')
</if>
</select>
</mapper>
......@@ -24,13 +24,13 @@
</foreach>
</delete>
<select id="selectByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
<select id="selectByKeyWordsId" resultType="com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO">
SELECT b.words_code, GROUP_CONCAT(a.subject_id SEPARATOR ',') as subjectId FROM subject_keywords_map a
left join key_words b on a.keywords_id = b.id
WHERE a.keywords_id = #{keyWordsId}
</select>
<select id="selectMinByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
<select id="selectMinByKeyWordsId" resultType="com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO">
SELECT b.words_code, min(time_enable) as startTime FROM subject_keywords_map a
LEFT JOIN key_words b ON a.keywords_id = b.id
LEFT JOIN subject c ON a.subject_id = c.id
......@@ -43,7 +43,7 @@
WHERE a.keywords_id = #{keyWordsId} and time_disable is null
</select>
<select id="selectMaxByKeyWordsId" resultType="com.zzsn.event.vo.KeyWordsDTO">
<select id="selectMaxByKeyWordsId" resultType="com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO">
SELECT b.words_code, max(time_disable) as endTime from subject_keywords_map a
LEFT JOIN key_words b ON a.keywords_id = b.id
LEFT JOIN subject c ON a.subject_id = c.id
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.EventExtract;
import com.zzsn.event.vo.EventExtractVO;
/**
* @author lenovo
* @description 针对表【event_extract(事件)】的数据库操作Service
* @createDate 2024-09-07 18:00:28
*/
public interface EventExtractService extends IService<EventExtract> {
/**
* 伪事件信息分页列表
*
* @param eventName 事件名称
* @param eventType 时间分类
* @param startTime 开始时间
* @param endTime 结束时间
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/9/9
*/
IPage<EventExtractVO> pageList(String eventName, Integer eventType, String startTime, String endTime,
Integer pageNo, Integer pageSize);
}
package com.zzsn.event.service;
import com.cronutils.model.Cron;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.util.CodeGenerateUtil;
......@@ -10,9 +9,7 @@ import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.AddEventVO;
import com.zzsn.event.vo.RegionVO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -41,12 +38,8 @@ public class EventSimpleService {
private IProjectSubjectMapService projectSubjectMapService;
@Autowired
private ISubjectSearchEnginesMapService subjectSearchEnginesMapService;
@Autowired
private IKeyWordsService keyWordsService;
@Autowired
private IKeywordsTypeMapService keywordsTypeMapService;
@Autowired
private ISubjectKeywordsMapService subjectKeywordsMapService;
@Autowired
private IEventTagService eventTagService;
@Autowired
......@@ -66,6 +59,11 @@ public class EventSimpleService {
public Event simpleSave(AddEventVO addEventVO) {
Event event = new Event();
BeanUtils.copyProperties(addEventVO, event);
Date endTime = event.getEndTime();
if (endTime == null) {
endTime = DateUtil.addDate(new Date(), 15);
}
event.setEndTime(endTime);
event.setIncreAnaRule(20);
event.setTotalAnaRule(50);
event.setTimeAnaRule(5);
......@@ -76,20 +74,21 @@ public class EventSimpleService {
event.setPublishDate(DateUtil.dateToString(new Date()));
//调度周期,默认2小时
event.setUnit("2");
event.setSpace(2);
event.setCron(CronUtil.generateCron("2",2));
event.setSpace(1);
event.setCron(CronUtil.generateCron("2",1));
event.setCreateTime(new Date());
UserVo currentUser = UserUtil.getLoginUser();
event.setCreateBy(currentUser.getUsername());
eventService.save(event);
String eventId = event.getId();
saveMapMain(eventId);
saveKeyword(event, addEventVO.getKeywords(), addEventVO.getExclusionWord());
//事件标签
eventTagService.save(EventTag.builder().eventId(eventId).build());
//地域关系绑定
List<RegionVO> regionList = addEventVO.getRegionList();
addRegionMap(eventId, regionList);
//默认绑定搜索引擎、模型
eventService.saveDefaultMap(eventId);
return event;
}
......@@ -107,44 +106,9 @@ public class EventSimpleService {
projectSubjectMap.setProjectId("1476527644425682945");
projectSubjectMap.setSubjectId(eventId);
projectSubjectMapService.save(projectSubjectMap);
//专题和搜索引擎关系
List<SubjectSearchEnginesMap> enginesMaps = new ArrayList<>();
for (String searchEngine : SEARCH_ENGINES) {
SubjectSearchEnginesMap subjectSearchEnginesMap = new SubjectSearchEnginesMap();
subjectSearchEnginesMap.setSearchEngineId(searchEngine);
subjectSearchEnginesMap.setSubjectId(eventId);
enginesMaps.add(subjectSearchEnginesMap);
}
subjectSearchEnginesMapService.saveBatch(enginesMaps);
}
private void saveKeyword(Event event, String keyword, String exclusionWord) {
if (StringUtils.isNotEmpty(keyword) || StringUtils.isNotEmpty(exclusionWord)) {
//关键词
KeyWords keyWords = new KeyWords();
String wordsCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.KEY_WORDS_DEFAULT.getValue());
keyWords.setWordsCode(wordsCode);
keyWords.setWordsName(event.getEventName());
keyWords.setKeyWord(keyword);
keyWords.setExclusionWord(exclusionWord);
keyWords.setStatus("1");
keyWords.setCreateTime(new Date());
keyWordsService.save(keyWords);
String keyWordsId = keyWords.getId();
//关键词和分类关系
KeywordsTypeMap keywordsTypeMap = new KeywordsTypeMap();
keywordsTypeMap.setKeywordsId(keyWordsId);
//分类默认 事件专题
keywordsTypeMap.setTypeId("1802634369064525826");
keywordsTypeMap.setCreateTime(new Date());
keywordsTypeMapService.save(keywordsTypeMap);
//专题和关键词关系
SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap();
subjectKeywordsMap.setKeywordsId(keyWordsId);
subjectKeywordsMap.setSubjectId(event.getId());
subjectKeywordsMapService.save(subjectKeywordsMap);
}
}
private void addRegionMap(String eventId, List<RegionVO> regionList) {
if (CollectionUtils.isNotEmpty(regionList)) {
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ClbChannelLabelMap;
/**
* @Description: 频道标签映射表
* @Author: jeecg-boot
* @Date: 2023-03-14
* @Version: V1.0
*/
public interface IClbChannelLabelMapService extends IService<ClbChannelLabelMap> {
}
......@@ -112,6 +112,8 @@ public interface IEventService extends IService<Event> {
Event saveMain(AddEventParam addEventParam);
void saveDefaultMap(String eventId);
void updateMain(AddEventParam addEventParam);
void deleteMain(String id);
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.vo.KeywordsVO;
import java.util.List;
......@@ -14,9 +16,20 @@ import java.util.List;
*/
public interface IKeyWordsService extends IService<KeyWords> {
KeyWords saveKeyword(Event event, String keyword, String exclusionWord);
/**
* 获取专题绑定的信息源列表
*/
List<KeyWordsPage> bindKeyWordsList(String subjectId);
/**
* 事件绑定关键词信息
*
* @param eventId 事件id
* @author lkg
* @date 2024/9/12
*/
KeywordsVO keywordInfoByEventId(String eventId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import java.util.List;
/**
* @Description: 专题关键词关联表
* @Author: jeecg-boot
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysBaseDomesticRegion;
import com.zzsn.event.entity.SubjectModelMap;
/**
* @Description: 国内地域
* @Description: 专题与模型关联
* @Author: jeecg-boot
* @Date: 2022-03-09
* @Date: 2021-12-16
* @Version: V1.0
*/
public interface ISysBaseDomesticRegionService extends IService<SysBaseDomesticRegion> {
public interface ISubjectModelMapService extends IService<SubjectModelMap> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysBaseChannel;
/**
* @Description: 频道表
* @Author: jeecg-boot
* @Date: 2022-05-11
* @Version: V1.0
*/
public interface ISysBaseChannelService extends IService<SysBaseChannel> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysBaseRegion;
import java.util.List;
/**
* @Description: 国内地域表
* @Author: jeecg-boot
* @Date: 2022-03-09
* @Version: V1.0
*/
public interface ISysBaseRegionService extends IService<SysBaseRegion> {
/**
* 获取多有下级节点的id
*
* @param regionId 地域本级id
* @author lkg
* @date 2024/8/30
*/
List<String> belowIdList(String regionId);
}
......@@ -3,7 +3,7 @@ package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.LabelEntity;
import com.zzsn.event.util.tree.Node;
import org.apache.ibatis.annotations.Param;
import com.zzsn.event.vo.SysLabelVo;
import java.util.List;
......@@ -30,4 +30,6 @@ public interface LabelEntityService extends IService<LabelEntity> {
* @date 2024/4/10
*/
List<Node> regionTree(Integer type);
List<SysLabelVo> queryCustomLabel(SysLabelVo sysLabelVo);
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysBaseDomesticRegion;
import com.zzsn.event.mapper.SysBaseDomesticRegionMapper;
import com.zzsn.event.service.ISysBaseDomesticRegionService;
import com.zzsn.event.entity.ClbChannelLabelMap;
import com.zzsn.event.mapper.ClbChannelLabelMapMapper;
import com.zzsn.event.service.IClbChannelLabelMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 国内地域
* @Description: 频道标签映射
* @Author: jeecg-boot
* @Date: 2022-03-09
* @Date: 2023-03-14
* @Version: V1.0
*/
@Service
public class SysBaseDomesticRegionServiceImpl extends ServiceImpl<SysBaseDomesticRegionMapper, SysBaseDomesticRegion> implements ISysBaseDomesticRegionService {
public class ClbChannelLabelMapServiceImpl extends ServiceImpl<ClbChannelLabelMapMapper, ClbChannelLabelMap> implements IClbChannelLabelMapService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventExtract;
import com.zzsn.event.service.EventExtractService;
import com.zzsn.event.mapper.EventExtractMapper;
import com.zzsn.event.vo.EventExtractVO;
import com.zzsn.event.vo.EventManageVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author lenovo
* @description 针对表【event_extract(事件)】的数据库操作Service实现
* @createDate 2024-09-07 18:00:28
*/
@Service
public class EventExtractServiceImpl extends ServiceImpl<EventExtractMapper, EventExtract> implements EventExtractService{
@Override
public IPage<EventExtractVO> pageList(String eventName, Integer eventType, String startTime, String endTime, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize;
List<EventExtractVO> pageList = baseMapper.pageList(eventName, eventType, startTime, endTime, offset, pageSize);
Long count = baseMapper.totalCount(eventName, eventType, startTime, endTime);
IPage<EventExtractVO> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList);
return pageData;
}
}
package com.zzsn.event.service.impl;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -14,13 +15,11 @@ import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.es.EsService;
import com.zzsn.event.mapper.EventMapper;
import com.zzsn.event.service.*;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.DateUtil;
import com.zzsn.event.util.HanlpUtil;
import com.zzsn.event.util.*;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.*;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -43,12 +42,14 @@ import org.elasticsearch.search.sort.SortOrder;
import org.jsoup.Jsoup;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
......@@ -78,6 +79,12 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
private ISubjectTypeService iSubjectTypeService;
@Autowired
private IEventCategoryService eventCategoryService;
@Autowired
private ISubjectSearchEnginesMapService subjectSearchEnginesMapService;
@Autowired
private ISubjectModelMapService subjectModelMapService;
@Autowired
private IKeyWordsService keyWordsService;
@Resource
private RestHighLevelClient client;
......@@ -85,6 +92,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
private EsService esService;
@Override
public List<SubjectKafkaVo> progressList(Date disableDate) {
return this.baseMapper.processList(disableDate);
......@@ -97,7 +105,22 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Override
public EventVO queryInfo(String eventId) {
return baseMapper.queryInfo(eventId);
EventVO eventVO = baseMapper.queryInfo(eventId);
String relationEvents = eventVO.getRelationEvents();
if (null != relationEvents) {
List<String> split = Arrays.asList(relationEvents.split(","));
List<EventVO> relationEventList = this.eventList(split);
eventVO.setRelatedEventList(relationEventList);
}
EventTag one = eventTagService.getOne(new LambdaQueryWrapper<EventTag>()
.eq(EventTag::getEventId, eventId)
.last(" limit 1"));
eventVO.setEventTag(one);
List<RegionVO> regionList = eventRegionMapService.regionList(eventId);
eventVO.setRegionList(regionList);
KeywordsVO keywordsVO = keyWordsService.keywordInfoByEventId(eventId);
eventVO.setKeywordsVO(keywordsVO);
return eventVO;
}
@Override
......@@ -240,17 +263,17 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
Event event = new Event();
//事件专题的默认分析规则参数-必填
BeanUtils.copyProperties(addEventParam, event);
Date endTime = event.getEndTime();
if (endTime == null) {
endTime = DateUtil.addDate(new Date(), 15);
}
event.setEndTime(endTime);
event.setIncreAnaRule(20);
event.setTotalAnaRule(50);
event.setTimeAnaRule(5);
String subjectCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.SUBJECT_DEFAULT.getValue());
event.setEventCode(subjectCode);
String cron;
if (StringUtils.isEmpty(event.getUnit()) || null == event.getSpace()) {
cron = CronUtil.getRandomCron();
} else {
cron = CronUtil.generateCron(event.getUnit(), event.getSpace());
}
String cron = CronUtil.generateCron(event.getUnit(), event.getSpace());
event.setCron(cron);
baseMapper.insert(event);
String eventId = event.getId();
......@@ -261,6 +284,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
//地缘关系绑定
List<RegionVO> regionList = addEventParam.getRegionList();
addRegionMap(eventId, regionList);
//默认绑定搜索引擎、模型
saveDefaultMap(eventId);
return event;
}
......@@ -271,14 +296,12 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
BeanUtils.copyProperties(addEventParam, subject);
String eventId = subject.getId();
baseMapper.updateById(subject);
//专题-类别、项目的绑定关系处理
//删除专题-类别绑定关系
iSubjectTypeMapService.deleteBySubjectId(subject.getId());
//删除专题-项目的绑定关系
iProjectSubjectMapService.deleteBySubjectId(subject.getId());
saveMapMain(subject, addEventParam);
//地域关系处理
LambdaQueryWrapper<EventRegionMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventRegionMap::getEventId, eventId);
......@@ -290,19 +313,26 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Override
@Transactional
public void deleteMain(String id) {
//删除与信息源的关联关系
iSubjectInfoSourceMapService.delete(id);
//删除与关键词组的关联关系
iSubjectKeywordsMapService.delete(id);
//删除地域关系
LambdaQueryWrapper<EventRegionMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(EventRegionMap::getEventId, id);
eventRegionMapService.remove(queryWrapper);
//删除专题-类别绑定关系
iSubjectTypeMapService.deleteBySubjectId(id);
//删除专题-项目的绑定关系
iProjectSubjectMapService.deleteBySubjectId(id);
baseMapper.deleteById(id);
CompletableFuture.runAsync(()->{
//删除与信息源的关联关系
iSubjectInfoSourceMapService.delete(id);
//删除与关键词组的关联关系
iSubjectKeywordsMapService.delete(id);
//删除地域关系
eventRegionMapService.remove(Wrappers.<EventRegionMap>lambdaQuery().eq(EventRegionMap::getEventId, id));
//删除专题-类别绑定关系
iSubjectTypeMapService.deleteBySubjectId(id);
//删除专题-项目的绑定关系
iProjectSubjectMapService.deleteBySubjectId(id);
//删除事件标签
eventTagService.remove(Wrappers.<EventTag>lambdaQuery().eq(EventTag::getEventId, id));
//删除事件-模型关系
subjectModelMapService.remove(Wrappers.<SubjectModelMap>lambdaQuery().eq(SubjectModelMap::getSubjectId, id));
//删除事件-搜索引擎关系
subjectSearchEnginesMapService.remove(Wrappers.<SubjectSearchEnginesMap>lambdaQuery().eq(SubjectSearchEnginesMap::getSubjectId, id));
});
}
@Override
......@@ -526,6 +556,34 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
}
}
@Override
public void saveDefaultMap(String eventId){
//默认引擎
List<String> defaultSearchEngines = Constants.DEFAULT_SEARCH_ENGINE;
List<SubjectSearchEnginesMap> enginesMaps = new ArrayList<>();
for (String defaultSearchEngine : defaultSearchEngines) {
SubjectSearchEnginesMap enginesMap = new SubjectSearchEnginesMap();
enginesMap.setSubjectId(eventId);
enginesMap.setSearchEngineId(defaultSearchEngine);
enginesMaps.add(enginesMap);
}
subjectSearchEnginesMapService.saveBatch(enginesMaps);
//默认模型
Map<String, String> defaultModels = Constants.DEFAULT_MODEL;
List<SubjectModelMap> modelMaps = new ArrayList<>();
for (Map.Entry<String, String> entry : defaultModels.entrySet()) {
SubjectModelMap modelMap = new SubjectModelMap();
modelMap.setSubjectId(eventId);
modelMap.setModelId(entry.getKey());
modelMap.setType(entry.getValue());
modelMap.setSign(1);
modelMaps.add(modelMap);
}
subjectModelMapService.saveBatch(modelMaps);
}
//专题实际绑定信息源的集合
private List<SubjectSourceVO> subjectBindSourceList(List<String> subjectIds){
List<SubjectSourceVO> bindList = baseMapper.bindSourceList(subjectIds);
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.mapper.KeyWordsMapper;
import com.zzsn.event.service.IKeyWordsService;
import com.zzsn.event.service.ISubjectKeywordsMapService;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.vo.KeyWordsPage;
import com.zzsn.event.entity.KeyWords;
import com.zzsn.event.vo.KeywordsVO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -18,9 +27,49 @@ import java.util.List;
@Service
public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> implements IKeyWordsService {
@Autowired
private ISubjectKeywordsMapService subjectKeywordsMapService;
@Autowired
private CodeGenerateUtil codeGenerateUtil;
@Override
public KeyWords saveKeyword(Event event, String keyword, String exclusionWord) {
KeyWords keyWords = new KeyWords();
if (StringUtils.isNotEmpty(keyword) || StringUtils.isNotEmpty(exclusionWord)) {
//关键词
String wordsCode = codeGenerateUtil.geneCodeNo(CodePrefixEnum.KEY_WORDS_DEFAULT.getValue());
keyWords.setWordsCode(wordsCode);
keyWords.setWordsName(event.getEventName());
keyWords.setKeyWord(keyword);
keyWords.setExclusionWord(exclusionWord);
keyWords.setStatus("1");
keyWords.setCreateTime(new Date());
save(keyWords);
String keyWordsId = keyWords.getId();
/*//关键词和分类关系
KeywordsTypeMap keywordsTypeMap = new KeywordsTypeMap();
keywordsTypeMap.setKeywordsId(keyWordsId);
//分类默认 事件专题
keywordsTypeMap.setTypeId("1802634369064525826");
keywordsTypeMap.setCreateTime(new Date());
keywordsTypeMapService.save(keywordsTypeMap);*/
//专题和关键词关系
SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap();
subjectKeywordsMap.setKeywordsId(keyWordsId);
subjectKeywordsMap.setSubjectId(event.getId());
subjectKeywordsMapService.save(subjectKeywordsMap);
}
return keyWords;
}
@Override
public List<KeyWordsPage> bindKeyWordsList(String subjectId) {
return baseMapper.selectKeyWordsListById(subjectId);
}
@Override
public KeywordsVO keywordInfoByEventId(String eventId) {
return baseMapper.keywordInfoByEventId(eventId);
}
}
......@@ -6,6 +6,7 @@ import com.zzsn.event.mapper.LabelEntityMapper;
import com.zzsn.event.service.LabelEntityService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.SysLabelVo;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -33,4 +34,9 @@ public class LabelEntityServiceImpl extends ServiceImpl<LabelEntityMapper, Label
}
return TreeUtil.tree(nodes,"0");
}
@Override
public List<SysLabelVo> queryCustomLabel(SysLabelVo sysLabelVo) {
return baseMapper.queryCustomLabel(sysLabelVo);
}
}
......@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.mapper.SubjectKeywordsMapMapper;
import com.zzsn.event.service.ISubjectKeywordsMapService;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.vo.SubjectKeywordsMap;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectModelMap;
import com.zzsn.event.mapper.SubjectModelMapMapper;
import com.zzsn.event.service.ISubjectModelMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 专题与模型关联表
* @Author: jeecg-boot
* @Date: 2021-12-16
* @Version: V1.0
*/
@Service
public class SubjectModelMapServiceImpl extends ServiceImpl<SubjectModelMapMapper, SubjectModelMap> implements ISubjectModelMapService {
}
......@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
......@@ -88,10 +89,13 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
@Override
public List<SubjectTreeVO> subjectAndTypeTree(String userId, String customerId) {
List<SubjectTreeVO> tree = new ArrayList<>();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree(userId, customerId);
List<SubjectTreeVO> tree = TreeUtil.tree(subjectTreeVOS, "0");
tree.forEach(this::subjectNumCount);
tree.sort(Comparator.comparing(SubjectTreeVO::getCreateTime));
if (CollectionUtils.isNotEmpty(subjectTreeVOS)) {
tree = TreeUtil.tree(subjectTreeVOS, "0");
tree.forEach(this::subjectNumCount);
tree.sort(Comparator.comparing(SubjectTreeVO::getCreateTime));
}
return tree;
}
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysBaseChannel;
import com.zzsn.event.mapper.SysBaseChannelMapper;
import com.zzsn.event.service.ISysBaseChannelService;
import org.springframework.stereotype.Service;
/**
* @Description: 频道表
* @Author: jeecg-boot
* @Date: 2022-05-11
* @Version: V1.0
*/
@Service
public class SysBaseChannelServiceImpl extends ServiceImpl<SysBaseChannelMapper, SysBaseChannel> implements ISysBaseChannelService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysBaseRegion;
import com.zzsn.event.mapper.SysBaseRegionMapper;
import com.zzsn.event.service.ISysBaseRegionService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 国内地域表
* @Author: jeecg-boot
* @Date: 2022-03-09
* @Version: V1.0
*/
@Service
public class SysBaseRegionServiceImpl extends ServiceImpl<SysBaseRegionMapper, SysBaseRegion> implements ISysBaseRegionService {
@Override
public List<String> belowIdList(String regionId) {
LambdaQueryWrapper<SysBaseRegion> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.like(SysBaseRegion::getPathIds,regionId);
List<SysBaseRegion> sysBaseRegions = baseMapper.selectList(queryWrapper);
List<Node> nodes = new ArrayList<>();
for (SysBaseRegion sysBaseRegion : sysBaseRegions) {
Node node = new Node();
node.setId(sysBaseRegion.getId());
node.setName(sysBaseRegion.getNameCn());
node.setPid(sysBaseRegion.getPid());
nodes.add(node);
}
return TreeUtil.belowList(nodes,regionId,true);
}
}
package com.zzsn.event.task;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONWriter;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.es.EsService;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.vo.EventDigDataVO;
import com.zzsn.event.vo.KafkaDataVo;
import com.zzsn.event.vo.SubjectDataVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 事件挖掘任务
*
* @author lkg
* @date 2024/8/30
*/
@Slf4j
@Component
public class EventDigTask {
@Autowired
private EsService esService;
@Resource
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private RedisUtil redisUtil;
private final static String EVENT_DIG_TIME_KEY = "EVENT_DIG_HANDLER_TIME";
// @Scheduled(cron = "0 0/3 * * * ?")
public void sendData(){
String startTime = null;
Object object = redisUtil.get(EVENT_DIG_TIME_KEY);
if (object != null) {
startTime = object.toString();
}
List<EventDigDataVO> eventDigDataVOS = esService.pageListOfColumn("1828017348013912065", startTime, 120);
if (CollectionUtils.isNotEmpty(eventDigDataVOS)) {
//分批发送
List<List<EventDigDataVO>> partition = ListUtils.partition(eventDigDataVOS, 30);
partition.forEach(e -> kafkaTemplate.send(Constants.EVENT_DIG_SEND_TOPIC, JSON.toJSONString(e)));
//将最新时间存入redis,供下次使用
String processDate = eventDigDataVOS.get(eventDigDataVOS.size() - 1).getProcessDate();
redisUtil.set(EVENT_DIG_TIME_KEY,processDate);
log.info("事件挖掘数据,本次kafka推送开始时间为-{},总条数为-{}",startTime,eventDigDataVOS.size());
}
}
}
......@@ -13,4 +13,6 @@ public class AddEventParam extends Event {
private String subjectTypeId;
/**项目id*/
private String projectId;
/**关键词*/
private KeywordsVO keywordsVO;
}
......@@ -17,6 +17,8 @@ import java.util.List;
@Getter
@Setter
public class AddEventVO {
private String id;
/**图标*/
private String eventIcon;
/**名称*/
......
package com.zzsn.event.vo;
import lombok.Getter;
import lombok.Setter;
/**
*
*
* @author lkg
* @date 2024/8/30
*/
@Getter
@Setter
public class EventDigDataVO extends SubjectDataVo{
private String processDate;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
*
*
* @author lkg
* @date 2024/4/8
*/
@Data
public class EventExtractVO {
private String id;
private String eventName;
private String typeName;
private String eventLabel;
private String createTime;
}
......@@ -18,6 +18,8 @@ public class EventVO {
private String id;
/**事件图标*/
private String eventIcon;
/**事件编码*/
private String eventCode;
/**事件名称*/
private String eventName;
/**开始时间*/
......@@ -46,8 +48,6 @@ public class EventVO {
private Integer space;
/***cron表达式*/
private String cron;
/**是否提取热词*/
private String ynExtractHotWords;
/**专题分类id*/
private String subjectTypeId;
/**项目id*/
......@@ -65,4 +65,6 @@ public class EventVO {
private EventTag eventTag;
/**事件地域信息*/
List<RegionVO> regionList;
/**关键词*/
private KeywordsVO keywordsVO;
}
package com.zzsn.event.vo;
import lombok.Getter;
import lombok.Setter;
/**
*
*
* @author lkg
* @date 2024/9/12
*/
@Getter
@Setter
public class KeywordsVO {
/**
* 词组id
*/
private String id;
/**
* 词组编码
*/
private String wordsCode;
/**
* 关键词
*/
private String keyword;
/**
* 屏蔽词
*/
private String exclusionWord;
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class SysLabelVo {
/**
* 主键
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 近义词
*/
private String synonym;
/**
* 说明
*/
private String explanation;
/**
* 层级
*/
private Integer level;
/**
* 一级主键id
*/
private String topId;
/**
* 所有id
*/
private String pathIds;
/**
* 状态
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
/**
* 创建人
*/
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**
* 所属部门
*/
private String sysOrgCode;
/**
* 父级节点
*/
private String pid;
/**
* 是否有子节点
*/
private String hasChild;
/**
* 属于哪个标签(表sys_base_label_type的主键id)
*/
private String labelTypeId;
/**
* 标签类别(如企业、自定义等)
*/
private String labelType;
/**
* 标签标识
*/
private String labelMark;
/**
* 下级节点
*/
private List<SysLabelVo> children;
private Boolean isLeaf;
/**
* 具体标签的id集合
*/
private List<String> labelIdList;
private String queryParam;
private String dataType = "";
/**
* 专题字段
*/
private Integer category;
/**
* 词条名称
*/
private String itemText;
/**
* 词条代码
*/
private String itemValue;
/**
* 描述
*/
private String description;
/**
* 排序值
*/
private String sortOrder;
/**
* 字典id
*/
private String dictId;
/**唯一编码(前端回显)*/
private String code;
private Integer pageNo=1;
private Integer pageSize=10;
}
package com.zzsn.event.xxljob.entity;
import lombok.Data;
@Data
public class KeyWords {
/**主键*/
private String id;
/**词组编码*/
private String wordsCode;
/**词组名称*/
private String wordsName;
/**关键词*/
private String keyWord;
/**排除词*/
private String exclusionWord;
/**状态*/
private Integer status;
/**创建人*/
private String createBy;
/**创建日期*/
private java.util.Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
private java.util.Date updateTime;
/**所属部门*/
private String sysOrgCode;
}
......@@ -3,8 +3,7 @@ package com.zzsn.event.xxljob.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.Event;
import com.zzsn.event.vo.AddEventParam;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.xxljob.entity.XxlJobInfo;
......
......@@ -4,10 +4,9 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.Event;
import com.zzsn.event.enums.InfoSourceStatusEnum;
import com.zzsn.event.enums.XxljobInfoStatusEnum;
import com.zzsn.event.util.CronUtil;
import com.zzsn.event.vo.KeyWordsDTO;
import com.zzsn.clb.common.model.task.dto.titr.KeyWordsDTO;
import com.zzsn.event.xxljob.entity.XxlJobGroup;
import com.zzsn.event.xxljob.entity.XxlJobInfo;
import com.zzsn.event.xxljob.mapper.XxlJobInfoMapper;
......@@ -64,8 +63,8 @@ public class XxlJobInfoServiceImpl extends ServiceImpl<XxlJobInfoMapper, XxlJobI
// 执行器
xxlJobInfo.setJobGroup(xxlJobGroup.getId());
}
//获取随机时间的间隔
String cron = CronUtil.getRandomCron();
//间隔事件 1小时
String cron = CronUtil.generateCron("2",1);
xxlJobInfo.setJobCron(cron);
// 任务描述
......@@ -90,11 +89,7 @@ public class XxlJobInfoServiceImpl extends ServiceImpl<XxlJobInfoMapper, XxlJobI
// 失败重试次数
xxlJobInfo.setExecutorFailRetryCount(0);
xxlJobInfo.setGlueUpdatetime(new Date());
if (keyWordsDTO.getStatus().equals(InfoSourceStatusEnum.ENABLE.getvalue())) {
xxlJobInfo.setTriggerStatus(XxljobInfoStatusEnum.RUNNING.getvalue());
} else {
xxlJobInfo.setTriggerStatus(XxljobInfoStatusEnum.STOP.getvalue());
}
xxlJobInfo.setTriggerStatus(XxljobInfoStatusEnum.RUNNING.getvalue());
// 关联的信息源编码
xxlJobInfo.setInfoSourceCode(keyWordsDTO.getWordsCode());
save(xxlJobInfo);
......
......@@ -59,7 +59,7 @@ spring:
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
elasticsearch:
uris: [ "114.115.215.250:9700","114.116.19.92:9700","114.115.215.96:9200","114.116.36.231:9200" ]
uris: ["114.115.215.250:9700","114.115.215.96:9200","1.95.3.121:9200"]
username: elastic
password: zzsn9988
connection-timeout: 300000
......@@ -68,8 +68,8 @@ spring:
stream:
kafka:
binder:
brokers: 114.115.159.144:9092
zkNodes: 114.115.159.144:2181
brokers: 1.95.78.131:9092
zkNodes: 1.95.78.131:2181
requiredAcks: 1
redis:
database: 7
......@@ -84,7 +84,7 @@ spring:
port: 6380
password: clbzzsn
kafka:
bootstrap-servers: 114.115.159.144:9092
bootstrap-servers: 1.95.78.131:9092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
......
......@@ -51,12 +51,12 @@ spring:
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource1:
url: jdbc:mysql://114.116.44.11:3306/clb_xxl_job?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://1.95.78.131:3306/clb_xxl_job?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
elasticsearch:
uris: [ "192.168.0.149:9700","192.168.0.35:9700","192.168.200.108:9200","192.168.200.222:9200" ]
uris: ["114.115.215.250:9700","114.115.215.96:9200","1.95.3.121:9200"]
username: elastic
password: zzsn9988
connection-timeout: 300000
......@@ -65,8 +65,8 @@ spring:
stream:
kafka:
binder:
brokers: 114.115.159.144:9092
zkNodes: 114.115.159.144:2181
brokers: 1.95.78.131:9092
zkNodes: 1.95.78.131:2181
requiredAcks: 1
redis:
database: 0
......@@ -81,7 +81,7 @@ spring:
port: 6380
password: clbzzsn
kafka:
bootstrap-servers: 114.115.159.144:9092
bootstrap-servers: 1.95.78.131:9092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 -->
<property name="LOG_HOME" value="../clbLogs/eventAnalysis" />
<property name="LOG_HOME" value="logs" />
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
<!-- 控制台输出 -->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论