提交 b4577e50 作者: 王峰

研究中心定时同步事件表部分信息和标签表信息

上级 19b2d20a
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.util.Date;
import java.util.List;
/** 克虏宝事件表
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event对象", description="事件")
public class EventClb {
/**ID*/
//@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.INPUT)
@ApiModelProperty(value = "ID")
private String id;
/**编码*/
@Excel(name = "编码", width = 15)
@ApiModelProperty(value = "编码")
private String eventCode;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String eventName;
/**图标*/
@Excel(name = "图标", width = 15)
@ApiModelProperty(value = "图标")
private String eventIcon;
/**事件类型*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private String eventType;
/**开始时间*/
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间")
private Date startTime;
/**结束时间*/
@Excel(name = "结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束时间")
private Date endTime;
/**标签*/
@Excel(name = "标签", width = 15)
@ApiModelProperty(value = "标签")
private String eventLabel;
/**是否公开*/
@Excel(name = "是否公开", width = 15)
@ApiModelProperty(value = "是否公开")
private Integer facePublic;
/**事件描述*/
@Excel(name = "事件描述", width = 15)
@ApiModelProperty(value = "事件描述")
private String eventDescribe;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**修改人id*/
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private String updateBy;
/**状态(0-禁用;1-启用)*/
private Integer status=1;
/**
* 专题最近一次分析时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date analysisTime;
/**
* 分析事件脉络-最新资讯的时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date eventTime;
/**划分专题库*/
@ApiModelProperty(value = "划分专题库")
private String library;
/**定时单位(1分;2小时;3日;4月)*/
@ApiModelProperty(value = "定时单位")
private String unit;
/**定时数值*/
@ApiModelProperty(value = "定时数值")
private Integer space;
/**cron表达式*/
@ApiModelProperty(value = "cron表达式")
private String cron;
/**是否提取热词*/
@ApiModelProperty(value = "是否提取热词")
private String ynExtractHotWords;
/**事件专题增量分析规则*/
@ApiModelProperty(value = "事件专题增量分析规则")
private Integer increAnaRule;
/**事件专题总量分析规则*/
@ApiModelProperty(value = "事件专题总量分析规则")
private Integer totalAnaRule;
/**事件专题时间间隔分析规则(天)*/
@ApiModelProperty(value = "事件专题时间间隔分析规则(天)")
private Integer timeAnaRule;
/**总热度*/
private Integer totalHot;
/**媒体热度*/
private Integer mediaHot;
/**微信热度*/
private Integer wechatHot;
/**其他热度*/
private Integer otherHot;
/**发布状态(0-未发布;1-已发布)*/
private Integer publishStatus;
/**发布状态(0-未发布;1-已发布)*/
private String relationEvents;
/**发布时间*/
private String publishDate;
/**排序号*/
private Integer sortOrder;
/**事件创建方式(1-用户直接创建;2-基于挖掘的事件创建)*/
private Integer category;
@TableField(exist = false)
private String typeName;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
@TableField(exist = false)
private List<EventClb> relatedEventList;
@TableField(exist = false)
private EventTag eventTag;
@TableField(exist = false)
private String extractIndustryTag;
@TableField(exist = false)
private String extractCompanyTag;
@TableField(exist = false)
private String extractPersonTag;
@TableField(exist = false)
private String extractSentimentTag;
@TableField(exist = false)
private String extractKeywordsTag;
@TableField(exist = false)
private String extractLocationTag;
@TableField(exist = false)
private String extractTimeTag;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
/**
* 克虏宝中的事件标签数据库,因为python目前只更新克虏宝事件标签库,所以这里直接取克虏宝的事件标签库
* @Description: EventTag
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event_tag")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="EventTag对象", description="事件")
public class EventTagClb {
/**ID*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "ID")
private String id;
private String eventId;
private String extractIndustryTag;
private String extractCompanyTag;
private String extractPersonTag;
private String extractSentimentTag;
private String extractKeywordsTag;
private String extractLocationTag;
private String extractTimeTag;
}
package com.zzsn.event.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventClb;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 克虏宝事件
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
@DS("multi-datasource-clb")
public interface EventClbMapper extends BaseMapper<EventClb> {
List<SubjectKafkaVo> eventSubjectList();
/**
* 获取事件详情
*
* @param eventId 事件id
* @author lkg
* @date 2024/4/12
*/
EventVO queryInfo(@Param("eventId") String eventId);
/**
* 分页列表-后台管理
*
* @param eventName 事件名称
* @param eventType 事件分类id
* @param startTime 开始时间
* @param endTime 结束时间
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventManageVO> pageList(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-后台管理
*
* @param eventName 事件名称
* @param eventType 事件分类id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/8
*/
Integer totalCount(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 分页列表-门户(全部)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventId 事件id
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventFrontVO> frontAllPageList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-门户(全部)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventId 事件id
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @author lkg
* @date 2024/4/8
*/
Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type);
/**
* 分页列表-门户(我的)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventFrontVO> frontOwnerPageList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-门户(我的)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @author lkg
* @date 2024/4/8
*/
Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type);
/**
* 分页列表(专题分类)-新平台管理
*
* @param subjectCondition 筛选条件
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
List<EventNewPlatVO> newPlatPageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量(专题分类)-新平台管理
*
* @param subjectCondition 筛选条件
* @author lkg
* @date 2024/4/28
*/
Integer newPlatCount(@Param("subjectCondition") SubjectCondition subjectCondition);
/**
* 分页列表(客户)-新平台管理
*
* @param subjectCondition 筛选条件
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/30
*/
List<EventNewPlatVO> newPlatCustomerPageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量(客户)-新平台管理
*
* @param subjectCondition 筛选条件
* @author lkg
* @date 2024/4/28
*/
Integer newPlatCustomerCount(@Param("subjectCondition") SubjectCondition subjectCondition);
/**
* 热点事件列表-前10
*
* @param projectId 项目id
* @param createBy 创建人
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 分类(1-按发布时间;2.按热度)
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("type") Integer type,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate);
/**
* 根据地域获取事件信息列表
*
* @param name 地域名称
* @author lkg
* @date 2024/4/10
*/
List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name);
/**
* 公开且发布的事件信息集合
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventIdList 事件id集合
* @param size 数量
* @author lkg
* @date 2024/4/10
*/
List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size);
/**
* 默认创建的,公开且发布的事件信息集合
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventIdList 事件id集合
* @param size 数量
* @author lkg
* @date 2024/4/10
*/
List<EventExcelVO> frontOwnerList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size);
/**
* 模型信息列表
*
* @author lkg
* @date 2024/4/11
*/
List<ModelVO> modelList();
/**
* 获取事件信息集合
*
* @param eventIdList 事件id集合
* @author lkg
* @date 2024/4/12
*/
List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList);
/**
* 专题绑定关键词数量
*
* @param idList 专题id集合
* @author lkg
* @date 2024/4/28
*/
List<SubjectPage> bindKeywordCountList(@Param("idList") List<String> idList);
/**
* 专题绑定的信息源集合
*
* @param subjectIds 专题id
* @author lkg
* @date 2024/4/24
*/
List<SubjectSourceVO> bindSourceList(@Param("subjectIds") List<String> subjectIds);
/**
* 专题绑定的信息源集合
*
* @param subjectIds 专题id
* @author lkg
* @date 2024/4/24
*/
List<SubjectSourceVO> excludeSourceList(@Param("subjectIds") List<String> subjectIds);
/**
* 项目列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<Node> projectList(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 分类下的事件id集合
*
* @param userId 用户id
* @param typeIds 分类id集合
* @author lkg
* @date 2024/5/6
*/
List<String> selectSubjectByTypeIds(@Param("userId") String userId, @Param("typeIds") List<String> typeIds);
/**
* 用户下的事件id集合
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/5/6
*/
List<String> selectSubjectWithCustomer(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 专题绑定关键词的id集合
*
* @param subjectIds 专题id集合
* @author lkg
* @date 2024/5/6
*/
List<String> bindKeyWordsIdList(@Param("subjectIds") List<String> subjectIds);
/**
* 专题绑定模型信息列表
*
* @param subjectIds 专题id集合
* @author lkg
* @date 2024/5/6
*/
List<LabelModelVo> selectLabelModelBySubjectId(@Param("subjectIds") List<String> subjectIds);
/**
* 企业标签下的企业信用代码集合
*
* @param labelIds 企业标签id集合
* @author lkg
* @date 2024/5/6
*/
List<String> codesByLabels(@Param("labelIds") List<String> labelIds);
/**
* 判断信息源是否在专题绑定的信息源组下
*
* @param subjectId 专题id
* @param sourceId 信息源id
* @author lkg
* @date 2024/4/24
*/
int ynBelowBindGroup(@Param("subjectId") String subjectId, @Param("sourceId") String sourceId);
/**
* 判断信息源是否在专题排除的信息源组下
*
* @param subjectId 专题id
* @param sourceId 信息源id
* @author lkg
* @date 2024/4/24
*/
int ynBelowExcludeGroup(@Param("subjectId") String subjectId, @Param("sourceId") String sourceId);
/**
* 专题绑定关键词信息-分页列表
*
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/5/7
*/
List<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds,
@Param("groupName") String groupName, @Param("wordName") String wordName,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 专题绑定关键词信息-总数量
*
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @author lkg
* @date 2024/5/7
*/
Long bindKeyWordsCount(@Param("subjectIds") List<String> subjectIds, @Param("groupName") String groupName, @Param("wordName") String wordName);
}
package com.zzsn.event.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.EventTagClb;
import org.apache.ibatis.annotations.Mapper;
/**
* 克虏宝中事件标签库
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
public interface EventTagClbMapper extends BaseMapper<EventTagClb> {
}
<?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.EventClbMapper">
<select id="eventSubjectList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,
s.event_name as subject_name,
s.start_time as time_enable,
s.end_time as time_disable,
s.incre_ana_rule,
s.total_ana_rule,
s.time_ana_rule,
s.analysis_time,
s.event_time
from event s
</select>
<select id="queryInfo" resultType="com.zzsn.event.vo.EventVO">
select t.id,
t.event_code,
t.event_name,
t.event_icon,
t.start_time,
t.end_time,
t.publish_date,
t.event_describe,
t.event_label,
t.library,
t.unit,
t.space,
t.cron,
t.yn_extract_hot_words,
t.face_public,
t.relation_events,
t.event_type,
t.sort_order,
stm.type_id as subjectTypeId,
psm.project_id,
c.type_name,
IFNULL(r.id, false) as hasReport
from event t
inner join event_category c on t.event_type = c.id
inner join subject_type_map stm on t.id = stm.subject_id
inner join project_subject_map psm on t.id = psm.subject_id
left join event_analysis_report r on t.id = r.event_id
where t.id = #{eventId}
</select>
<select id="pageList" resultType="com.zzsn.event.vo.EventManageVO">
select t2.type_name,t1.id,t1.event_icon,t1.event_name,t1.event_label,t1.status,
t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by
from event 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="facePublic!=null">
and t1.face_public = #{facePublic}
</if>
<if test="publishStatus!=null">
and t1.publish_status = #{publishStatus}
</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>
<if test="order!=null and order != ''">
order by t1.${order}
<if test="orderType!=null and orderType != ''">
${orderType}
</if>
</if>
limit #{offset}, #{pageSize}
</select>
<select id="totalCount" resultType="java.lang.Integer">
select count(1) from event 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="facePublic!=null">
and t1.face_public = #{facePublic}
</if>
<if test="publishStatus!=null">
and t1.publish_status = #{publishStatus}
</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>
<select id="frontAllPageList" resultType="com.zzsn.event.vo.EventFrontVO">
select distinct a.* from (select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1
union
select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
<if test="eventId!=null and eventId != ''">
and a.id = #{eventId}
</if>
<if test="eventName!=null and eventName != ''">
and a.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and a.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and a.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and a.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
<choose>
<when test="order != null and order != ''">
order by a.${order}
<if test="orderType != null and orderType != ''">
${orderType}
</if>
</when>
<otherwise>
order by a.publish_date desc
</otherwise>
</choose>
limit #{offset}, #{pageSize}
</select>
<select id="frontAllCount" resultType="java.lang.Integer">
select count(1) from (
select distinct a.*,m.project_id from (select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1
union
select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy}) a
inner join project_subject_map m on a.id = m.subject_id
) b
where b.project_id = #{projectId}
<if test="eventId!=null and eventId != ''">
and b.id = #{eventId}
</if>
<if test="eventName!=null and eventName != ''">
and b.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and b.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and b.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and b.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
</select>
<select id="frontOwnerPageList" resultType="com.zzsn.event.vo.EventFrontVO">
select
t1.id,t1.event_name,t1.event_icon,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and t1.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and t1.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
<choose>
<when test="order != null and order != ''">
order by t1.${order}
<if test="orderType != null and orderType != ''">
${orderType}
</if>
</when>
<otherwise>
order by t1.publish_date desc
</otherwise>
</choose>
limit #{offset}, #{pageSize}
</select>
<select id="frontOwnerCount" resultType="java.lang.Integer">
select count(1)
from event t1 inner join event_category t2 on t1.event_type =t2.id
inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and t1.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and t1.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
</select>
<select id="newPlatPageList" resultType="com.zzsn.event.vo.EventNewPlatVO">
SELECT distinct d.id,d.event_name,d.start_time,d.end_time,d.status, m.type_name as subjectTypeName,
n.project_name
from
<choose>
<when test="subjectCondition.userId !=null and subjectCondition.userId != ''">
( select s.* from event s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{subjectCondition.userId}
)
</when>
<when test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
( select s.* from event s inner join customer_data_permission_map m on s.id = m.permission_id
and m.customer_id = #{subjectCondition.customerId}
)
</when>
<otherwise>
event
</otherwise>
</choose>
d
INNER JOIN
(
select stm.subject_id,st.type_name from subject_type_map stm inner join subject_type st on stm.type_id = st.id
where 1=1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and stm.type_id in
<foreach collection="subjectCondition.typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on d.id = m.subject_id
INNER JOIN
(
select psm.subject_id,p.project_name from project_subject_map psm inner join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
) n
on d.id = n.subject_id
where 1 = 1
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and d.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and d.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and d.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
order by d.sort_order,d.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="newPlatCount" resultType="Integer">
select count(1) from (
SELECT distinct d.id
from
<choose>
<when test="subjectCondition.userId !=null and subjectCondition.userId != ''">
( select s.* from event s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{subjectCondition.userId}
)
</when>
<when test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
( select s.* from event s inner join customer_data_permission_map m on s.id = m.permission_id
and m.customer_id = #{subjectCondition.customerId}
)
</when>
<otherwise>
event
</otherwise>
</choose>
d
INNER JOIN
(
select stm.subject_id from subject_type_map stm
where 1=1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and stm.type_id in
<foreach collection="subjectCondition.typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on d.id = m.subject_id
INNER JOIN
(
select psm.subject_id from project_subject_map psm
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and psm.id = #{subjectCondition.projectId}
</if>
) n
on d.id = n.subject_id
where 1 = 1
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and d.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and d.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and d.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
</select>
<select id="newPlatCustomerPageList" resultType="com.zzsn.event.vo.EventNewPlatVO">
select distinct x.id,x.event_name,x.start_time,x.end_time,st.type_name as subjectTypeName,p.project_name from (
select c.id, c.event_name,c.create_time,c.start_time,c.end_time,c.sort_order
from event c inner join
(
select a.id, b.permission_id
from customer_data_permission_map b
inner join customer a on b.customer_id = a.id and a.status = 1
and a.is_delete = 0 and b.category = 'subject'
<if test="subjectCondition.userId !=null and subjectCondition.userId != ''">
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
and user_id = #{subjectCondition.userId}
)
</if>
) m
on c.id = m.permission_id
where c.status = 1
<if test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
and m.id = #{subjectCondition.customerId}
</if>
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and c.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and c.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and c.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and c.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
left join subject_type_map stm on stm.subject_id = x.id
left join subject_type st on stm.type_id = st.id
left join project_subject_map psm on psm.subject_id = x.id
left join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
order by x.sort_order, x.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="newPlatCustomerCount" resultType="Integer">
select count(1) from (
select distinct x.id from (
select c.id, c.event_name,c.create_time
from event c inner join
(
select a.id, b.permission_id
from customer_data_permission_map b
inner join customer a on b.customer_id = a.id and a.status = 1
and a.is_delete = 0 and b.category = 'subject'
<if test="subjectCondition.userId !=null and subjectCondition.userId != ''">
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
and user_id = #{subjectCondition.userId}
)
</if>
) m
on c.id = m.permission_id
where c.status = 1
<if test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
and m.id = #{subjectCondition.customerId}
</if>
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and c.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and c.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and c.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and c.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
left join subject_type_map stm on stm.subject_id = x.id
left join subject_type st on stm.type_id = st.id
left join project_subject_map psm on psm.subject_id = x.id
left join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
) y
</select>
<select id="topEventList" resultType="com.zzsn.event.vo.EventTopVO">
select distinct a.* from(
select t.id,t.event_name,t.start_time,t.end_time,t.publish_date,t.total_hot,ec.type_name
from event t inner join event_category ec on t.event_type = ec.id
where t.publish_status = 1 and t.face_public = 1
union
select e.id,e.event_name,e.start_time,e.end_time,e.publish_date,e.total_hot,ec.type_name
from event e inner join event_category ec on e.event_type = ec.id
where e.publish_status = 1 and e.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
<if test="startTime!=null and startTime != ''">
and a.publish_date >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and a.publish_date <![CDATA[ <= ]]> #{endTime}
</if>
order by
<choose>
<when test="type == 1">
a.publish_date
</when>
<otherwise>
a.total_hot
</otherwise>
</choose>
desc
limit #{offset}, #{pageSize}
</select>
<select id="processList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,s.event_name as subject_name,s.start_time as time_enable,s.end_time as time_disable,
s.incre_ana_rule, s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time,s.face_public,
s.publish_status,s.event_describe
from event s
where 1=1
<if test="disableDate != null">
and (s.end_time is null or s.end_time <![CDATA[ >= ]]> #{disableDate})
</if>
</select>
<select id="listByRegion" resultType="com.zzsn.event.vo.EventRegionVO">
SELECT
b.id AS eventId,
b.event_name,
b.start_time,
b.end_time,
r.name_cn AS regionName
FROM
(
select distinct a.* from(
select t.id,t.event_name,t.start_time,t.end_time from event t where t.publish_status = 1 and t.face_public = 1
union
select e.id,e.event_name,e.start_time,e.end_time from event e where e.publish_status = 1 and e.create_by =
#{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
) b
INNER JOIN event_region_map m ON b.id = m.event_id
INNER JOIN sys_base_region r ON m.top_region_id = r.id
WHERE m.type = #{type}
<if test="name != null and name !=''">
and r.name_cn = #{name}
</if>
</select>
<select id="frontAllList" resultType="com.zzsn.event.vo.EventExcelVO">
select distinct a.* from (
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.face_public = 1
union
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
left join event_tag t3 on a.id=t3.event_id
where m.project_id = #{projectId}
<if test="eventIdList != null and eventIdList.size() > 0">
and a.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
<if test="eventName!=null and eventName != ''">
and a.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and a.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and a.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
order by a.publish_date desc
<if test="size != null">
limit #{size}
</if>
</select>
<select id="frontOwnerList" resultType="com.zzsn.event.vo.EventExcelVO">
select e.id,e.event_name,e.event_describe,e.publish_date,e.total_hot from event e
inner join project_subject_map m on e.id = m.subject_id
left join event_tag t3 on e.id=t3.event_id
where e.publish_status = 1 and e.face_public = 1
and e.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventIdList != null and eventIdList.size() > 0">
and e.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
<if test="eventName!=null and eventName != ''">
and e.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and e.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and e.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
order by e.publish_date desc
<if test="size != null">
limit #{size}
</if>
</select>
<select id="modelList" resultType="com.zzsn.event.vo.ModelVO">
select id, model_name, type
from model
where pid = '0'
and type is not null
</select>
<select id="eventList" resultType="com.zzsn.event.vo.EventVO">
select t.id,t.event_name from event t where 1=1
<if test="eventIdList != null and eventIdList.size()>0">
and t.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
</select>
<select id="bindKeywordCountList" resultType="com.zzsn.event.vo.SubjectPage">
select subject_id as id , count(1) keyWordsNum from subject_keywords_map where subject_id in
<foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group By subject_id
</select>
<select id="bindSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type in(2,5)
<if test="subjectIds != null and subjectIds.size() > 0">
and n.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.subject_id from subject_info_source_map sm where type = 1
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x
</select>
<select id="excludeSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type = 4
<if test="subjectIds != null and subjectIds.size() > 0">
and n.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.subject_id from subject_info_source_map sm where type = 3
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x
</select>
<select id="projectList" resultType="com.zzsn.event.util.tree.Node">
select s.id,s.project_name as name from project s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.is_delete = 0 and s.status = 1
</select>
<select id="selectSubjectByTypeIds" resultType="String">
select distinct a.id from event a
<if test="userId!=null and userId != ''">
inner join sys_user_data_permission b on b.permission_id = a.id and b.category = 'subject' and b.user_id =
#{userId}
</if>
inner join subject_type_map c on c.subject_id = a.id
where 1=1
<if test="typeIds!=null and typeIds.size()>0">
and c.type_id in
<foreach collection="typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectSubjectWithCustomer" resultType="String">
select distinct a.id
<choose>
<when test="customerId!=null and customerId != ''">
from customer_data_permission_map b
inner join event a on b.permission_id = a.id
inner join subject_type_map c on c.subject_id = b.permission_id
inner join project_subject_map d on b.permission_id = d.subject_id
inner join customer_project_map e on d.project_id = e.project_id
where b.category = 'subject' and b.customer_id = #{customerId}
</when>
<when test="userId!=null and userId != ''">
from sys_user_data_permission b
inner join event a on b.permission_id = a.id
inner join subject_type_map c on c.subject_id = b.permission_id
inner join project_subject_map d on b.permission_id = d.subject_id
inner join customer_project_map e on d.project_id = e.project_id
where b.category = 'subject' and b.user_id = #{userId}
</when>
<otherwise>
from event a
</otherwise>
</choose>
</select>
<select id="bindKeyWordsIdList" resultType="String">
select distinct b.id from key_words b
left join subject_keywords_map a on a.keywords_id = b.id
left join keywords_type_map c on b.id = c.keywords_id
left join keywords_type d on d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectLabelModelBySubjectId" resultType="com.zzsn.event.vo.LabelModelVo">
SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as
labelId,c.label_mark,c.label_name,c.label_type
FROM subject_model_map a
inner JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1
LEFT JOIN sys_base_label_type c on c.id = b.label_id
WHERE b.service_name is not null and a.type = 3
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="codesByLabels" resultType="String">
select e.social_credit_code from sys_base_enterprise e
inner join sys_base_label_type_map m on e.social_credit_code = m.relation_id
where 1=1
<if test="labelIds!=null and labelIds.size()>0">
and m.label_id in
<foreach collection="labelIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by e.social_credit_code
</select>
<select id="ynBelowBindGroup" resultType="Integer">
select count(1)
from subject_info_source_map n
left join info_source_group_map m on n.source_id = m.group_id
where n.type in (2, 5)
and n.subject_id = #{subjectId}
and m.source_id = #{sourceId}
</select>
<select id="ynBelowExcludeGroup" resultType="Integer">
select count(1)
from subject_info_source_map n
left join info_source_group_map m on n.source_id = m.group_id
where n.type = 4
and n.subject_id = #{subjectId}
and m.source_id = #{sourceId}
</select>
<select id="bindKeyWordsList" resultType="com.zzsn.event.vo.KeyWordsPage">
select x.* from (
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by b.id
) x
where 1=1
<if test="groupName != null and groupName !=''">
and x.words_name like CONCAT('%',#{groupName},'%')
</if>
<if test="wordName != null and wordName !=''">
and x.key_word like CONCAT('%',#{wordName},'%')
</if>
order by x.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="bindKeyWordsCount" resultType="Long">
select count(1) from (
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by b.id
) x
where 1=1
<if test="groupName != null and groupName !=''">
and x.words_name like CONCAT('%',#{groupName},'%')
</if>
<if test="wordName != null and wordName !=''">
and x.key_word like CONCAT('%',#{wordName},'%')
</if>
</select>
</mapper>
\ No newline at end of file
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.EventTagClb;
/**
* 克虏宝中事件标签
* @author wangFeng
* @date 2024/10/15 10:07
*/
public interface IEventTagClbService extends IService<EventTagClb> {
}
package com.zzsn.event.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventTag;
import com.zzsn.event.entity.EventTagClb;
import com.zzsn.event.mapper.EventTagClbMapper;
import com.zzsn.event.mapper.EventTagMapper;
import com.zzsn.event.service.IEventTagClbService;
import com.zzsn.event.service.IEventTagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 克虏宝事件标签
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Service
@Slf4j
@DS("multi-datasource-clb")
public class EventTagClbServiceImpl extends ServiceImpl<EventTagClbMapper, EventTagClb> implements IEventTagClbService {
}
package com.zzsn.event.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventTag;
import com.zzsn.event.entity.EventTagClb;
import com.zzsn.event.mapper.EventClbMapper;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.IEventTagClbService;
import com.zzsn.event.service.IEventTagService;
import com.zzsn.event.vo.EventVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* 同步克虏宝事件相关信息,因为查询事件时候关联的有其它相关表,并且相关表的字段也参与过滤条件
* @author wangFeng
* @date 2024/10/15 13:51
*/
@Slf4j
@Component
public class SynClbEventDataTask {
@Resource
private IEventService eventService;
@Resource
private IEventTagService eventTagService;
@Resource
private EventClbMapper eventClbMapper;
@Resource
private IEventTagClbService eventTagClbService;
/**
* 同步克虏宝中事件信息到研究中心数据库
*/
@Scheduled(cron = "0 15 0/1 * * ?")
public void synEventData () {
log.info("同步克虏宝中事件信息到研究中心数据库开始");
LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(queryWrapper);
for (Event event : list) {
try{
// 克虏宝事件表
String eventId = event.getId();
EventVO eventVOClb = eventClbMapper.queryInfo(eventId);
if (eventVOClb != null) {
LambdaUpdateWrapper<Event> lambdaUpdateWrapper = Wrappers.lambdaUpdate(Event.class).eq(Event::getId, eventId)
.set(Event::getRelationEvents, eventVOClb.getRelationEvents()) // 事件关联事件
.set(Event::getEventLabel, eventVOClb.getEventLabel()) // 事件表中打的标签
// total_hot根据所有事件定时统计,这个使用研究中心自己的
;
eventService.update(lambdaUpdateWrapper);
// 事件标签表
EventTagClb eventTagClb = eventTagClbService.getOne(new LambdaQueryWrapper<EventTagClb>()
.eq(EventTagClb::getEventId, eventId)
.last(" limit 1"));
LambdaUpdateWrapper<EventTag> tagUpdateWrapper = Wrappers.lambdaUpdate(EventTag.class)
.eq(EventTag::getEventId, eventId)
.set(EventTag::getExtractIndustryTag, eventTagClb.getExtractIndustryTag()) // 事件关联事件
.set(EventTag::getExtractCompanyTag, eventTagClb.getExtractCompanyTag())
.set(EventTag::getExtractPersonTag, eventTagClb.getExtractPersonTag())
.set(EventTag::getExtractSentimentTag, eventTagClb.getExtractSentimentTag())
.set(EventTag::getExtractKeywordsTag, eventTagClb.getExtractKeywordsTag())
.set(EventTag::getExtractLocationTag, eventTagClb.getExtractLocationTag())
.set(EventTag::getExtractTimeTag, eventTagClb.getExtractTimeTag());
eventTagService.update(tagUpdateWrapper);
}
}catch (Exception e){
log.error("同步克虏宝中事件信息到研究中心数据库失败:{}", e);
}
}
log.info("同步克虏宝中事件信息到研究中心数据库结束");
}
}
......@@ -25,8 +25,8 @@ spring:
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 10
maxActive: 100
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
......@@ -55,6 +55,11 @@ spring:
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource-clb:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://114.116.44.11:3306/clb_project?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
username: ciglobal
password: _PSuWVQ4CLpX
elasticsearch:
uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"] # ["192.168.0.24:9700","192.168.0.150:9200","192.168.0.81:9700"]
username: elastic
......
### 服务说明
### 服务说明
1. 研究中心事件使用单独的数据库
2. 研究中心新增/data/simpleSaveEvent时候会先调用克虏宝平台新增方法,然后再调用自身方法入库
3. 研究中心的queryInfo中关联事件、事件标签目前直接查询克虏宝平台
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论