提交 cd3ccb2c 作者: 925993793@qq.com

自定义专题

上级 c7e4973d
...@@ -134,29 +134,7 @@ public class FileController { ...@@ -134,29 +134,7 @@ public class FileController {
@GetMapping("/downloadTemplate") @GetMapping("/downloadTemplate")
public void downloadTemplate(HttpServletResponse response) { public void downloadTemplate(HttpServletResponse response) {
String filePath = "subjectDataImport/导入模板.xlsx"; String filePath = "subjectDataImport/导入模板.xlsx";
BufferedInputStream bis = null; commonService.downloadTemplate(response, filePath);
BufferedOutputStream bos = null;
byte[] bytes = obsUtil.getObjectByte(filePath);
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
try {
OutputStream outs = response.getOutputStream();
bos = new BufferedOutputStream(outs);
bis = new BufferedInputStream(inputStream);
int i;
while ((i = bis.read(bytes)) != -1) {
bos.write(bytes, 0, i);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bos.flush();
bos.close();
bis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} }
/** /**
......
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.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("clb_label")
public class ClbLabel extends Model<ClbLabel> {
private static final long serialVersionUID = 1L;
/**
* 标签表id
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建日期
*/
@TableField("create_time")
private Date createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新日期
*/
@TableField("update_time")
private Date updateTime;
/**
* 实体id
*/
@TableField("entity_object_id")
private String entityObjectId;
/**
* 所属类目id
*/
@TableField("label_type_id")
private String labelTypeId;
/**
* 标签类别(字典维护)
*/
@TableField("label_category")
private String labelCategory;
/**
* 标签名称
*/
@TableField("label_name")
private String labelName;
/**
* 是否互斥(1互斥(默认),0不互斥)
*/
@TableField("is_mutual_exclusion")
private String isMutualExclusion;
/**
* 标签描述
*/
@TableField("label_desc")
private String labelDesc;
/**
* 标签状态(1开启,0关闭)
*/
@TableField("label_status")
private Integer labelStatus;
/**
* 标签编码
*/
@TableField("label_code")
private String labelCode;
/**
* 数据字典编码
*/
@TableField("dict_code")
private String dictCode;
/**
* 业务口径(1自定义,2实体表引用,3字典引用)
*/
@TableField("business_caliber")
private Integer businessCaliber;
/**
* 标签对应的任务id
*/
@TableField(exist = false)
private String taskId;
/**
* 任务计划描述
*/
@TableField(exist = false)
private String planDescription;
@Override
protected Serializable pkVal() {
return this.id;
}
}
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.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("clb_label_item")
public class ClbLabelItem extends Model<ClbLabelItem> {
private static final long serialVersionUID = 1L;
/**
* 标签值id
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建日期
*/
@TableField("create_time")
private Date createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新日期
*/
@TableField("update_time")
private Date updateTime;
/**
* 所属标签id
*/
@TableField("label_id")
private String labelId;
/**
* 标签值编码
*/
@TableField("label_item_code")
private String labelItemCode;
/**
* 标签值名称
*/
@TableField("label_item_name")
private String labelItemName;
/**
* 节点绝对路径
*/
@TableField("path_ids")
private String pathIds;
@Override
protected Serializable pkVal() {
return this.id;
}
}
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 lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 专题-信息源绑定中间表
* @Author: jeecg-boot
* @Date: 2021-12-09
* @Version: V1.0
*/
@Data
@TableName("subject_info_source_middle_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class SubjectInfoSourceMiddleMap implements Serializable {
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**专题id*/
@TableField("subject_id")
private String subjectId;
/**信息源id或信息源组id*/
@TableField("info_source_name")
private String infoSourceName;
/**网址*/
@TableField("url")
private String url;
/**创建时间*/
@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;
/**创建人*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField("create_by")
private Date createBy;
}
package com.zzsn.event.entity;
import java.util.Date;
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.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: 专题样例文章表
* @Author: jeecg-boot
* @Date: 2025-01-03
* @Version: V1.0
*/
@Data
@TableName("subject_sample_file")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="subject_sample_file对象", description="专题样例文章表")
public class SubjectSampleFile {
/**主键id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键id")
private String id;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
/**文件名称*/
@Excel(name = "文件名称", width = 15)
@ApiModelProperty(value = "文件名称")
private String fileName;
/**文件路径*/
@Excel(name = "文件路径", width = 15)
@ApiModelProperty(value = "文件路径")
private String filePath;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
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;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
@Data
@TableName("sys_dict_item")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysDictItem implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 字典id
*/
private String dictId;
/**
* 字典项文本
*/
@Excel(name = "字典项文本", width = 20)
private String itemText;
/**
* 字典项值
*/
@Excel(name = "字典项值", width = 30)
private String itemValue;
/**
* 描述
*/
@Excel(name = "描述", width = 40)
private String description;
/**
* 排序
*/
@Excel(name = "排序", width = 15,type=4)
private Integer sortOrder;
/**
* 状态(1启用 0不启用)
*/
private Integer status;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
/**
* 字典id
*/
private String pid;
/**
* 字典id
*/
private String hasChild;
/**
* 字典id
*/
private String pathIds;
/**
* 字典id
*/
private String dictItemCode;
/**
* 层级
*/
private Integer level;
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.ClbLabelItem;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Mapper
public interface ClbLabelItemMapper extends BaseMapper<ClbLabelItem> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.ClbLabel;
import com.zzsn.event.vo.InfoSourceLabelVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Mapper
public interface ClbLabelMapper extends BaseMapper<ClbLabel> {
/**
* 专题绑定的信息源标签信息
*
* @param subjectId 专题id
* @author lkg
* @date 2025/1/2
*/
List<InfoSourceLabelVO> bindInfoSourceLabelInfo(@Param("subjectId") String subjectId);
/**
* 获取分类下的标签信息
*
* @param labelTypeId 标签分类id
* @author lkg
* @date 2025/1/2
*/
List<InfoSourceLabelVO> labelInfoByType(@Param("labelTypeId") String labelTypeId);
}
...@@ -62,7 +62,7 @@ public interface CommonMapper { ...@@ -62,7 +62,7 @@ public interface CommonMapper {
* @author lkg * @author lkg
* @date 2024/4/24 * @date 2024/4/24
*/ */
List<SubjectInfoSourceLabelTypeVo> bindSourceList(@Param("subjectIds") List<String> subjectId); List<SubjectSourceVO> bindSourceList(@Param("subjectIds") List<String> subjectId);
/** /**
* 专题/事件绑定的信息源集合 * 专题/事件绑定的信息源集合
...@@ -71,7 +71,7 @@ public interface CommonMapper { ...@@ -71,7 +71,7 @@ public interface CommonMapper {
* @author lkg * @author lkg
* @date 2024/4/24 * @date 2024/4/24
*/ */
List<SubjectInfoSourceLabelTypeVo> excludeSourceList(@Param("subjectIds") List<String> subjectId); List<SubjectSourceVO> excludeSourceList(@Param("subjectIds") List<String> subjectId);
/** /**
* 模型列表 * 模型列表
......
...@@ -236,33 +236,6 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -236,33 +236,6 @@ public interface EventMapper extends BaseMapper<Event> {
*/ */
List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList); 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);
/** /**
* 专题绑定关键词的id集合 * 专题绑定关键词的id集合
......
...@@ -68,4 +68,33 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -68,4 +68,33 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* @date 2024/4/30 * @date 2024/4/30
*/ */
Page<InfoSourceVo> unBindSourcePageList(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, Page<InfoSourceVo> page); Page<InfoSourceVo> unBindSourcePageList(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, Page<InfoSourceVo> page);
/**
* 信息源分页列表(专题绑定定向信息源时使用)
*
* @param searchWord 搜索词
* @param page 分页参数
* @author lkg
* @date 2025/1/4
*/
Page<String> directSourceList(@Param("searchWord") String searchWord, Page<String> page);
/**
* 信息源下栏目分页列表(专题绑定定向信息源时使用)
*
* @param webSiteName 信息源名称
* @param page 分页参数
* @author lkg
* @date 2025/1/4
*/
Page<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName, Page<InfoSource> page);
/**
* 信息源下栏目列表(专题绑定定向信息源时使用)
*
* @param webSiteName 信息源名称
* @author lkg
* @date 2025/1/4
*/
List<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName);
} }
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectInfoSourceMiddleMap;
import org.apache.ibatis.annotations.Mapper;
/**
* 专题-信息源绑定中间表
*
* @author lkg
* @date 2025/1/2
*/
@Mapper
public interface SubjectInfoSourceMiddleMapMapper extends BaseMapper<SubjectInfoSourceMiddleMap> {
}
...@@ -8,8 +8,6 @@ import com.zzsn.event.vo.SubjectPage; ...@@ -8,8 +8,6 @@ import com.zzsn.event.vo.SubjectPage;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Description: 专题表 * @Description: 专题表
* @Author: jeecg-boot * @Author: jeecg-boot
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectSampleFile;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 专题样例文章表
* @Author: jeecg-boot
* @Date: 2025-01-03
* @Version: V1.0
*/
@Mapper
public interface SubjectSampleFileMapper extends BaseMapper<SubjectSampleFile> {
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysDictItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
@Mapper
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
List<SysDictItem> listByDictCode(@Param("dictCode") String dictCode);
}
<?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.ClbLabelMapper">
<resultMap id="labelMap" type="com.zzsn.event.vo.InfoSourceLabelVO">
<result column="label_code" property="labelCode"/>
<result column="label_name" property="labelName"/>
<collection property="infoSourceLabelItemList" ofType="com.zzsn.event.vo.InfoSourceLabelItemVO">
<result column="label_item_code" property="labelItemCode"/>
<result column="label_item_name" property="labelItemName"/>
</collection>
</resultMap>
<select id="bindInfoSourceLabelInfo" resultMap="labelMap">
select label.label_code, label.label_name, item.label_item_code, item.label_item_name
from subject_info_source_map m on s.id = m.subject_id
left join clb_label label
on m.source_id = label.label_code
left join clb_label_item item on label.id = item.label_id
where m.subject_id = #{subjectId} and m.type = 6
union
select label.label_code, label.label_name, item.label_item_code, item.label_item_name
from subject_info_source_map m on s.id = m.subject_id
left join clb_label_item item
on m.source_id = item.label_item_code
left join clb_label label on item.label_id = label.id
where m.subject_id = #{subjectId} and m.type = 7
</select>
<select id="labelInfoByType" resultMap="labelMap">
select label.label_code, label.label_name, item.label_item_code, item.label_item_name
from clb_label label
left join clb_label_item item on label.id = item.label_id
where label.label_type_id = #{labelTypeId}
order by label.create_time
</select>
</mapper>
\ No newline at end of file
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
group By subject_id group By subject_id
</select> </select>
<select id="bindSourceList" resultType="com.zzsn.event.vo.SubjectInfoSourceLabelTypeVo"> <select id="bindSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from ( select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n 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 inner join info_source_group_map m on n.source_id = m.group_id
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
) x ) x
</select> </select>
<select id="excludeSourceList" resultType="com.zzsn.event.vo.SubjectInfoSourceLabelTypeVo"> <select id="excludeSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from ( select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n 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 inner join info_source_group_map m on n.source_id = m.group_id
......
...@@ -493,58 +493,6 @@ ...@@ -493,58 +493,6 @@
</if> </if>
</select> </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="bindKeyWordsIdList" resultType="String"> <select id="bindKeyWordsIdList" resultType="String">
select distinct b.id from key_words b select distinct b.id from key_words b
......
...@@ -203,4 +203,24 @@ ...@@ -203,4 +203,24 @@
</if> </if>
order by s.create_time desc order by s.create_time desc
</select> </select>
<select id="directSourceList" resultType="String">
select iso.web_site_name
from info_source iso where 1=1
<if test="searchWord!=null and searchWord != ''">
and (
iso.web_site_name like CONCAT('%',#{infoSourceCondition.searchWord},'%')
or iso.site_uri = like CONCAT('%',#{infoSourceCondition.searchWord},'%')
)
</if>
group by iso.web_site_name
order by iso.create_time
</select>
<select id="directSourceColumnList" resultType="com.zzsn.event.entity.InfoSource">
select iso.site_name,iso.site_uri
from info_source iso where iso.web_site_name = #{webSiteName}
order by iso.create_time
</select>
</mapper> </mapper>
<?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.SubjectSampleFileMapper">
</mapper>
\ No newline at end of file
<?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.SysDictItemMapper">
<select id="listByDictCode" resultType="com.zzsn.event.entity.SysDictItem">
select * from sys_dict_item item inner join sys_dict dict on item.dict_id = dict.id
where dict.dict_code = #{dictCode}
</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.ClbLabelItem;
/**
* <p>
* 服务类
* </p>
*
* @author obcy
* @since 2024-08-23
*/
public interface ClbLabelItemService extends IService<ClbLabelItem> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ClbLabel;
import com.zzsn.event.vo.InfoSourceLabelVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author obcy
* @since 2024-08-23
*/
public interface ClbLabelService extends IService<ClbLabel> {
/**
* 专题绑定的信息源标签信息
*
* @param subjectId 专题
* @author lkg
* @date 2025/1/2
*/
List<InfoSourceLabelVO> bindInfoSourceLabelInfo(String subjectId);
/**
* 获取分类下的标签信息
*
* @param labelTypeId 标签分类id
* @author lkg
* @date 2025/1/2
*/
List<InfoSourceLabelVO> labelInfoByType(String labelTypeId);
}
...@@ -5,6 +5,7 @@ import com.zzsn.event.util.tree.Node; ...@@ -5,6 +5,7 @@ import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -68,9 +69,11 @@ public interface CommonService { ...@@ -68,9 +69,11 @@ public interface CommonService {
* @author lkg * @author lkg
* @date 2024/4/24 * @date 2024/4/24
*/ */
List<SubjectInfoSourceLabelTypeVo> bindSourceList(List<String> subjectIds); List<SubjectSourceVO> bindSourceList(List<String> subjectIds);
/**获取所有节点*/ /**
* 获取所有节点
*/
List<ModelVO> allList(String subjectType); List<ModelVO> allList(String subjectType);
/** /**
...@@ -86,4 +89,14 @@ public interface CommonService { ...@@ -86,4 +89,14 @@ public interface CommonService {
* 根据专题或栏目配置查询关键词黑名单 * 根据专题或栏目配置查询关键词黑名单
*/ */
Set<String> getExcludeKeywords(String databaseIds); Set<String> getExcludeKeywords(String databaseIds);
/**
* 下载模板文件
*
* @param response 响应
* @param path 文件路径
* @author lkg
* @date 2025/1/4
*/
void downloadTemplate(HttpServletResponse response, String path);
} }
...@@ -40,7 +40,7 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -40,7 +40,7 @@ public interface IInfoSourceService extends IService<InfoSource> {
* @author lkg * @author lkg
* @date 2024/4/30 * @date 2024/4/30
*/ */
IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition,Integer pageNo, Integer pageSize); IPage<InfoSourceVo> unBindSourcePageList(InfoSourceCondition infoSourceCondition, Integer pageNo, Integer pageSize);
/** /**
...@@ -51,4 +51,36 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -51,4 +51,36 @@ public interface IInfoSourceService extends IService<InfoSource> {
* @date 2024/4/24 * @date 2024/4/24
*/ */
Integer bindSourceCount(List<String> subjectIds); Integer bindSourceCount(List<String> subjectIds);
/**
* 信息源分页列表(专题绑定定向信息源时使用)
*
* @param searchWord 搜索词
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2025/1/4
*/
IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize);
/**
* 信息源下栏目分页列表(专题绑定定向信息源时使用)
*
* @param webSiteName 信息源名称
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2025/1/4
*/
IPage<InfoSource> directSourceColumnPageList(String webSiteName, Integer pageNo, Integer pageSize);
/**
* 信息源下栏目列表(专题绑定定向信息源时使用)
*
* @param webSiteName 信息源名称
* @author lkg
* @date 2025/1/4
*/
List<InfoSource> directSourceColumnList(String webSiteName);
} }
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectInfoSourceMiddleMap;
/**
* 专题-信息源绑定时,待配置信息源表
*
* @author lkg
* @date 2025/1/2
*/
public interface SubjectInfoSourceMiddleMapService extends IService<SubjectInfoSourceMiddleMap> {
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectSampleFile;
/**
* @Description: 专题样例文章表
* @Author: jeecg-boot
* @Date: 2025-01-03
* @Version: V1.0
*/
public interface SubjectSampleFileService extends IService<SubjectSampleFile> {
}
...@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Subject; import com.zzsn.event.entity.Subject;
import com.zzsn.event.vo.DirectBindInfoVO; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.SearchEnginesVo;
import com.zzsn.event.vo.SubjectCondition;
import com.zzsn.event.vo.SubjectPage;
import java.util.List; import java.util.List;
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysDictItem;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
public interface SysDictItemService extends IService<SysDictItem> {
List<SysDictItem> listByDictCode(String dictCode);
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.ClbLabelItem;
import com.zzsn.event.mapper.ClbLabelItemMapper;
import com.zzsn.event.service.ClbLabelItemService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Service
public class ClbLabelItemServiceImpl extends ServiceImpl<ClbLabelItemMapper, ClbLabelItem> implements ClbLabelItemService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.ClbLabel;
import com.zzsn.event.mapper.ClbLabelMapper;
import com.zzsn.event.service.ClbLabelService;
import com.zzsn.event.vo.InfoSourceLabelVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author obcy
* @since 2024-08-23
*/
@Service
public class ClbLabelServiceImpl extends ServiceImpl<ClbLabelMapper, ClbLabel> implements ClbLabelService {
@Override
public List<InfoSourceLabelVO> bindInfoSourceLabelInfo(String subjectId) {
return baseMapper.bindInfoSourceLabelInfo(subjectId);
}
@Override
public List<InfoSourceLabelVO> labelInfoByType(String labelTypeId) {
return baseMapper.labelInfoByType(labelTypeId);
}
}
...@@ -11,6 +11,7 @@ import com.zzsn.event.enums.ScoreTypeEnum; ...@@ -11,6 +11,7 @@ import com.zzsn.event.enums.ScoreTypeEnum;
import com.zzsn.event.mapper.CommonMapper; import com.zzsn.event.mapper.CommonMapper;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.DateUtil; import com.zzsn.event.util.DateUtil;
import com.zzsn.event.util.ObsUtil;
import com.zzsn.event.util.tree.Node; import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -18,6 +19,8 @@ import org.springframework.beans.BeanUtils; ...@@ -18,6 +19,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*; import java.util.*;
/** /**
...@@ -42,7 +45,7 @@ public class CommonServiceImpl implements CommonService { ...@@ -42,7 +45,7 @@ public class CommonServiceImpl implements CommonService {
@Autowired @Autowired
private SubjectKeywordsService subjectKeywordsService; private SubjectKeywordsService subjectKeywordsService;
@Autowired @Autowired
private InfoSourceGroupService infoSourceGroupService; private ObsUtil obsUtil;
@Override @Override
...@@ -247,9 +250,9 @@ public class CommonServiceImpl implements CommonService { ...@@ -247,9 +250,9 @@ public class CommonServiceImpl implements CommonService {
} }
@Override @Override
public List<SubjectInfoSourceLabelTypeVo> bindSourceList(List<String> subjectIds) { public List<SubjectSourceVO> bindSourceList(List<String> subjectIds) {
List<SubjectInfoSourceLabelTypeVo> bindList = commonMapper.bindSourceList(subjectIds); List<SubjectSourceVO> bindList = commonMapper.bindSourceList(subjectIds);
List<SubjectInfoSourceLabelTypeVo> excludeList = commonMapper.excludeSourceList(subjectIds); List<SubjectSourceVO> excludeList = commonMapper.excludeSourceList(subjectIds);
bindList.removeAll(excludeList); bindList.removeAll(excludeList);
return bindList; return bindList;
} }
...@@ -310,6 +313,33 @@ public class CommonServiceImpl implements CommonService { ...@@ -310,6 +313,33 @@ public class CommonServiceImpl implements CommonService {
return set; return set;
} }
@Override
public void downloadTemplate(HttpServletResponse response, String path) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
byte[] bytes = obsUtil.getObjectByte(path);
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
try {
OutputStream outs = response.getOutputStream();
bos = new BufferedOutputStream(outs);
bis = new BufferedInputStream(inputStream);
int i;
while ((i = bis.read(bytes)) != -1) {
bos.write(bytes, 0, i);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
bos.flush();
bos.close();
bis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
//获取树状结构 //获取树状结构
private List<ModelVO> getTreeList(List<ModelVO> authTypeList){ private List<ModelVO> getTreeList(List<ModelVO> authTypeList){
List<ModelVO> topList = new ArrayList<>(); List<ModelVO> topList = new ArrayList<>();
......
...@@ -93,7 +93,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -93,7 +93,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Resource @Resource
private RestHighLevelClient client; private RestHighLevelClient client;
@Autowired @Autowired
private EsService esService; private CommonService commonService;
@Override @Override
...@@ -472,15 +472,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -472,15 +472,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
subjectModelMapService.saveBatch(modelMaps); subjectModelMapService.saveBatch(modelMaps);
} }
//专题实际绑定信息源的集合
private List<SubjectSourceVO> subjectBindSourceList(List<String> subjectIds) {
List<SubjectSourceVO> bindList = baseMapper.bindSourceList(subjectIds);
List<SubjectSourceVO> excludeList = baseMapper.excludeSourceList(subjectIds);
bindList.removeAll(excludeList);
return bindList;
}
//查询每个专题的数量 //查询每个专题的数量
private Map<String, Integer> subjectInfoCountMap(List<String> subjectIdList, List<Integer> checkStatusList) { private Map<String, Integer> subjectInfoCountMap(List<String> subjectIdList, List<Integer> checkStatusList) {
Map<String, Integer> map = new HashMap<>(subjectIdList.size()); Map<String, Integer> map = new HashMap<>(subjectIdList.size());
...@@ -525,10 +516,10 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -525,10 +516,10 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
List<String> idList = pageList.stream().map(EventNewPlatVO::getId).collect(Collectors.toList()); List<String> idList = pageList.stream().map(EventNewPlatVO::getId).collect(Collectors.toList());
Map<String, Integer> infoSourceNumMap = new HashMap<>(); Map<String, Integer> infoSourceNumMap = new HashMap<>();
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
Map<String, Integer> keyWordsNumMap = baseMapper.bindKeywordCountList(idList).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum)); Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(idList).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum));
long t2 = System.currentTimeMillis(); long t2 = System.currentTimeMillis();
log.info("关键词数量查询耗时==={}",t2-t1); log.info("关键词数量查询耗时==={}",t2-t1);
Map<String, List<SubjectSourceVO>> collect = subjectBindSourceList(idList).stream().collect(Collectors.groupingBy(SubjectSourceVO::getSubjectId)); Map<String, List<SubjectSourceVO>> collect = commonService.bindSourceList(idList).stream().collect(Collectors.groupingBy(SubjectSourceVO::getSubjectId));
long t3 = System.currentTimeMillis(); long t3 = System.currentTimeMillis();
log.info("信息源数量查询耗时==={}",t3-t2); log.info("信息源数量查询耗时==={}",t3-t2);
for (Map.Entry<String, List<SubjectSourceVO>> entry : collect.entrySet()) { for (Map.Entry<String, List<SubjectSourceVO>> entry : collect.entrySet()) {
......
...@@ -10,6 +10,7 @@ import com.zzsn.event.entity.InfoSource; ...@@ -10,6 +10,7 @@ import com.zzsn.event.entity.InfoSource;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
import com.zzsn.event.mapper.InfoSourceMapper; import com.zzsn.event.mapper.InfoSourceMapper;
import com.zzsn.event.service.IInfoSourceService; import com.zzsn.event.service.IInfoSourceService;
import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.vo.InfoSourceCondition; import com.zzsn.event.vo.InfoSourceCondition;
import com.zzsn.event.vo.InfoSourceVo; import com.zzsn.event.vo.InfoSourceVo;
import com.zzsn.event.vo.NumVO; import com.zzsn.event.vo.NumVO;
...@@ -105,4 +106,21 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou ...@@ -105,4 +106,21 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
Long count = baseMapper.bindSourceIdCount(null, subjectIds); Long count = baseMapper.bindSourceIdCount(null, subjectIds);
return count.intValue(); return count.intValue();
} }
@Override
public IPage<String> directSourcePageList(String searchWord, Integer pageNo, Integer pageSize) {
Page<String> page = new Page<>(pageNo, pageSize);
return baseMapper.directSourceList(searchWord, page);
}
@Override
public IPage<InfoSource> directSourceColumnPageList(String webSiteName, Integer pageNo, Integer pageSize) {
Page<InfoSource> page = new Page<>(pageNo, pageSize);
return baseMapper.directSourceColumnList(webSiteName, page);
}
@Override
public List<InfoSource> directSourceColumnList(String webSiteName) {
return baseMapper.directSourceColumnList(webSiteName);
}
} }
...@@ -20,10 +20,7 @@ import com.zzsn.event.util.*; ...@@ -20,10 +20,7 @@ import com.zzsn.event.util.*;
import com.zzsn.event.util.user.AuthUtil; import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.DisplayInfo; import com.zzsn.event.vo.es.*;
import com.zzsn.event.vo.es.ESData;
import com.zzsn.event.vo.es.SpecialInformation;
import com.zzsn.event.vo.es.Subjectdatabase;
import com.zzsn.event.vo.log.DataLifecycleLog; import com.zzsn.event.vo.log.DataLifecycleLog;
import com.zzsn.event.entity.InfoSource; import com.zzsn.event.entity.InfoSource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -96,17 +93,60 @@ public class InformationServiceImpl implements InformationService { ...@@ -96,17 +93,60 @@ public class InformationServiceImpl implements InformationService {
} }
@Override @Override
public IPage<DisplayInfo> subjectPageList(UserVo userVo,EventDataCondition subjectInfo) { public IPage<DisplayInfo> subjectPageList(UserVo userVo,EventDataCondition searchCondition) {
IPage<DisplayInfo> page = new Page<>(subjectInfo.getPageNo(), subjectInfo.getPageSize()); IPage<DisplayInfo> page = new Page<>(searchCondition.getPageNo(), searchCondition.getPageSize());
List<String> relationIds = subjectInfo.getLabelIds(); List<String> subjectIdList = new ArrayList<>();
List<String> labelTypeIds = subjectInfo.getLabelTypeIds(); //判断是否是专题
if ("1".equals(searchCondition.getIsSubject())) {
if (StringUtils.isNotEmpty(searchCondition.getSubjectId())) {
subjectIdList.add(searchCondition.getSubjectId());
}
} else {
//该id其实是专题类别id
//查询类别id的所有明细id
String subjectTypeId = searchCondition.getSubjectId();
Integer category = searchCondition.getCategory();
List<String> typeIds = subjectTypeService.belowIdList(subjectTypeId, category);
if (category == 1) {
subjectIdList = subjectTypeMapService.selectSubjectByTypeIds(typeIds);
} else if (category == 2) {
subjectIdList = subjectTypeMapService.selectEventByTypeIds(typeIds);
}
}
List<String> relationIds = searchCondition.getLabelIds();
List<String> labelTypeIds = searchCondition.getLabelTypeIds();
if (CollectionUtils.isNotEmpty(labelTypeIds)) { if (CollectionUtils.isNotEmpty(labelTypeIds)) {
List<String> socialCreditCodeList = commonService.codesByLabels(labelTypeIds); List<String> socialCreditCodeList = commonService.codesByLabels(labelTypeIds);
relationIds.addAll(socialCreditCodeList); relationIds.addAll(socialCreditCodeList);
} }
subjectInfo.setLabelIds(relationIds); searchCondition.setLabelIds(relationIds);
try { try {
page = esService.subjectPageList(userVo.getId(),subjectInfo); IPage<SpecialInformation> specialInformationIPage = esService.pageListByCondtion(searchCondition,subjectIdList);
long total = specialInformationIPage.getTotal();
if (total > 0) {
List<DisplayInfo> dataList = new ArrayList<>();
List<LabelModelVo> labelModelVos = commonService.subjectModelBindLabels(subjectIdList);
Map<String, List<LabelModelVo>> modelMap = labelModelVos.stream().collect(Collectors.groupingBy(LabelModelVo::getSubjectId));
List<SpecialInformation> records = specialInformationIPage.getRecords();
for (SpecialInformation specialInformation : records) {
DisplayInfo info = new DisplayInfo();
BeanUtils.copyProperties(specialInformation,info);
info.setPublishDate(EsDateUtil.esFieldDateMapping(info.getPublishDate()));
LambdaQueryWrapper<CollectionMap> query = Wrappers.lambdaQuery();
query.eq(CollectionMap::getUserId, userVo.getId());
query.eq(CollectionMap::getArticleId, info.getId());
int count = collectionMapService.count(query);
if (count > 0) {
info.setYnCollect(true);
}
//标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId());
formatLabel(modelVoList, info);
dataList.add(info);
}
page.setRecords(dataList);
page.setTotal(total);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -604,6 +644,36 @@ public class InformationServiceImpl implements InformationService { ...@@ -604,6 +644,36 @@ public class InformationServiceImpl implements InformationService {
clbFileOperationLogService.saveEntity(clbFileOperationLog); clbFileOperationLogService.saveEntity(clbFileOperationLog);
} }
private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) {
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(labelModelVos)) {
List<Label> list = info.getLabels();
List<LabelInfo> labelInfos = new ArrayList<>();
//获取专题打的标签
for (LabelModelVo labelModelVo : labelModelVos) {
LabelInfo labelInfo = new LabelInfo();
labelInfo.setLabelId(labelModelVo.getLabelId());
labelInfo.setLabelName(labelModelVo.getLabelName());
labelInfo.setLabelType(labelModelVo.getLabelType());
labelInfo.setLabelMark(labelModelVo.getLabelMark());
List<Label> labelList = new ArrayList<>();
if (list != null && !list.isEmpty()) {
for (Label label : list) {
if (StringUtils.isNotBlank(label.getLabelMark()) &&
(label.getLabelMark().contains(labelModelVo.getLabelMark()) || ("company_label".equals(labelModelVo.getLabelType()) && "company_label".equals(label.getLabelRemarks())))) {
labelList.add(label);
}
}
}
labelInfo.setLabelList(labelList);
labelInfos.add(labelInfo);
}
info.setLabelInfos(labelInfos);
}
}
private void addReadNum(DisplayInfo displayInfo, String index) { private void addReadNum(DisplayInfo displayInfo, String index) {
if (displayInfo != null) { if (displayInfo != null) {
Long readNum = displayInfo.getReadNum(); Long readNum = displayInfo.getReadNum();
...@@ -662,7 +732,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -662,7 +732,7 @@ public class InformationServiceImpl implements InformationService {
//信息加上分类 //信息加上分类
public void setInfoSourceType(SpecialInformation data) { public void setInfoSourceType(SpecialInformation data) {
String url = domainURL(data.getSourceAddress()); String url = Utility.domainURL(data.getSourceAddress());
String typeNum = null; String typeNum = null;
if (StringUtils.isNotEmpty(url)) { if (StringUtils.isNotEmpty(url)) {
if (redisUtil.get(Constants.SITE_NAME_KEY + url) != null) { if (redisUtil.get(Constants.SITE_NAME_KEY + url) != null) {
...@@ -675,29 +745,4 @@ public class InformationServiceImpl implements InformationService { ...@@ -675,29 +745,4 @@ public class InformationServiceImpl implements InformationService {
} }
data.setInfoSourceType(typeNum); data.setInfoSourceType(typeNum);
} }
/**
* 返回匹配的域名。例如:www.baidu.com
*
* @param sourceAddress 原链接
* @author lkg
* @date 2024/12/19
*/
public static String domainURL(String sourceAddress){
if (sourceAddress==null || sourceAddress.trim().length()==0) {
return "";
}
String result = "";
try {
String regex = "(?<=//|)((\\w)+\\.)+[\\s\\S]+?(?=\\/|\\:|\\?)" ;
Pattern p = Pattern.compile(regex,Pattern.CASE_INSENSITIVE);
Matcher matcher = p.matcher(sourceAddress);
matcher.find();
result = matcher.group();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
} }
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectInfoSourceMiddleMap;
import com.zzsn.event.mapper.SubjectInfoSourceMiddleMapMapper;
import com.zzsn.event.service.SubjectInfoSourceMiddleMapService;
import org.springframework.stereotype.Service;
/**
* 专题-信息源绑定中间表
*
* @author lkg
* @date 2025/1/2
*/
@Service
public class SubjectInfoSourceMiddleMapServiceImpl extends ServiceImpl<SubjectInfoSourceMiddleMapMapper, SubjectInfoSourceMiddleMap>
implements SubjectInfoSourceMiddleMapService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectSampleFile;
import com.zzsn.event.mapper.SubjectSampleFileMapper;
import com.zzsn.event.service.SubjectSampleFileService;
import org.springframework.stereotype.Service;
/**
* @Description: 专题样例文章表
* @Author: jeecg-boot
* @Date: 2025-01-03
* @Version: V1.0
*/
@Service
public class SubjectSampleFileServiceImpl extends ServiceImpl<SubjectSampleFileMapper, SubjectSampleFile> implements SubjectSampleFileService {
}
...@@ -113,10 +113,10 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -113,10 +113,10 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
List<String> idList = records.stream().map(SubjectPage::getId).collect(Collectors.toList()); List<String> idList = records.stream().map(SubjectPage::getId).collect(Collectors.toList());
Map<String, Integer> infoSourceNumMap = new HashMap<>(); Map<String, Integer> infoSourceNumMap = new HashMap<>();
Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(idList).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum)); Map<String, Integer> keyWordsNumMap = commonService.bindKeyWordsCountList(idList).stream().collect(Collectors.toMap(SubjectPage::getId, SubjectPage::getKeyWordsNum));
Map<String, List<SubjectInfoSourceLabelTypeVo>> collect = commonService.bindSourceList(idList).stream().collect(Collectors.groupingBy(SubjectInfoSourceLabelTypeVo::getSubjectId)); Map<String, List<SubjectSourceVO>> collect = commonService.bindSourceList(idList).stream().collect(Collectors.groupingBy(SubjectSourceVO::getSubjectId));
for (Map.Entry<String, List<SubjectInfoSourceLabelTypeVo>> entry : collect.entrySet()) { for (Map.Entry<String, List<SubjectSourceVO>> entry : collect.entrySet()) {
String subjectId = entry.getKey(); String subjectId = entry.getKey();
List<SubjectInfoSourceLabelTypeVo> value = entry.getValue(); List<SubjectSourceVO> value = entry.getValue();
infoSourceNumMap.put(subjectId, value.size()); infoSourceNumMap.put(subjectId, value.size());
} }
List<Integer> checkStatus = new ArrayList<>(); List<Integer> checkStatus = new ArrayList<>();
......
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysDictItem;
import com.zzsn.event.mapper.SysDictItemMapper;
import com.zzsn.event.service.SysDictItemService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
@Service
public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDictItem> implements SysDictItemService {
@Override
public List<SysDictItem> listByDictCode(String dictCode) {
return this.baseMapper.listByDictCode(dictCode);
}
}
...@@ -2,7 +2,7 @@ package com.zzsn.event.util; ...@@ -2,7 +2,7 @@ package com.zzsn.event.util;
import com.hankcs.hanlp.HanLP; import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term; import com.hankcs.hanlp.seg.common.Term;
import org.springframework.util.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
......
...@@ -890,26 +890,26 @@ public class Utility { ...@@ -890,26 +890,26 @@ public class Utility {
text = text.replaceAll(" +\r\n", "\n"); text = text.replaceAll(" +\r\n", "\n");
text = text.replaceAll("\r\n", "\n"); text = text.replaceAll("\r\n", "\n");
text = text.replaceAll(" +", " "); text = text.replaceAll(" +", " ");
// text = text.replaceAll("[\\u00A0\\u3000]", ""); // text = text.replaceAll("[\\u00A0\\u3000]", "");
// text = text.replaceAll(" ", ""); // text = text.replaceAll(" ", "");
text = text.replaceAll(" \n", "\n"); text = text.replaceAll(" \n", "\n");
text = text.replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n"); text = text.replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n").replaceAll("\n\n", "\n");
//如果遇到table,则不加处理 //如果遇到table,则不加处理
if (text.contains("<table")) { if (text.contains("<table")) {
String[] textArr = text.split("\n"); String[] textArr = text.split("\n");
String result =""; String result = "";
for (String tex : textArr) { for (String tex : textArr) {
if (!tex.contains("<table") && !tex.contains("<td") && !tex.contains("<tr") if (!tex.contains("<table") && !tex.contains("<td") && !tex.contains("<tr")
&& !tex.contains("table>") && !tex.contains("td>") && !tex.contains("tr>")) { && !tex.contains("table>") && !tex.contains("td>") && !tex.contains("tr>")) {
result += "<p style='text-indent:2em;'>" + tex + "</p><br/>"; result += "<p style='text-indent:2em;'>" + tex + "</p><br/>";
} else { } else {
result += tex; result += tex;
} }
} }
text = result; text = result;
} else { } else {
text = text.replaceAll("\n\\s+", "</p>"+"<br/>" + "<p style='text-indent:2em;'>"); text = text.replaceAll("\n\\s+", "</p>" + "<br/>" + "<p style='text-indent:2em;'>");
text = text.replaceAll("\n", "</p>"+"<br/>" + "<p style='text-indent:2em;'>"); text = text.replaceAll("\n", "</p>" + "<br/>" + "<p style='text-indent:2em;'>");
text = "<p style='text-indent:2em;'>" + text + "</p>"; text = "<p style='text-indent:2em;'>" + text + "</p>";
} }
return text; return text;
...@@ -1466,25 +1466,26 @@ public class Utility { ...@@ -1466,25 +1466,26 @@ public class Utility {
} }
} }
return htmlEscape(document.outerHtml()).replace("</p>","").replaceAll("<html>\\n <head></head>\\n <body> \\n ",""); return htmlEscape(document.outerHtml()).replace("</p>", "").replaceAll("<html>\\n <head></head>\\n <body> \\n ", "");
} }
//对带标签的内容进行进一步处理 //对带标签的内容进行进一步处理
public static String htmlEscape(String content){ public static String htmlEscape(String content) {
if(content.indexOf("\r\n") > -1){ if (content.indexOf("\r\n") > -1) {
content = content.replaceAll("\r\n", "<br/>"); content = content.replaceAll("\r\n", "<br/>");
} }
if(content.indexOf('\n') > -1){ if (content.indexOf('\n') > -1) {
content = content.replaceAll("\n", "<br/>"); content = content.replaceAll("\n", "<br/>");
} }
while (content.replaceAll("\\s*", "").indexOf("<br/><br/>") > -1) { while (content.replaceAll("\\s*", "").indexOf("<br/><br/>") > -1) {
content = content.replaceAll("<br/>\\s*<br/>", "<br/>"); content = content.replaceAll("<br/>\\s*<br/>", "<br/>");
} }
//兼容已按老逻辑处理过的数据 //兼容已按老逻辑处理过的数据
content = content.replaceAll("</p ><p","</p ><br/><p").replace("  ",""); content = content.replaceAll("</p ><p", "</p ><br/><p").replace("  ", "");
String[] page = content.split("<br/>"); String[] page = content.split("<br/>");
String convertContent = ""; String convertContent = "";
if(page != null && page.length > 0 ) { if (page != null && page.length > 0) {
for (String section : page) { for (String section : page) {
if (StringUtils.isNotBlank(section)) { if (StringUtils.isNotBlank(section)) {
section = section.trim(); section = section.trim();
...@@ -1499,7 +1500,7 @@ public class Utility { ...@@ -1499,7 +1500,7 @@ public class Utility {
section = section.substring(1).trim(); section = section.substring(1).trim();
} }
} }
convertContent+=section; convertContent += section;
} }
} }
} }
...@@ -1529,4 +1530,29 @@ public class Utility { ...@@ -1529,4 +1530,29 @@ public class Utility {
return result.toString(); return result.toString();
} }
/**
* 返回匹配的域名。例如:www.baidu.com
*
* @param sourceAddress 原链接
* @author lkg
* @date 2024/12/19
*/
public static String domainURL(String sourceAddress) {
String domain = null;
if (StringUtils.isNotBlank(sourceAddress)) {
try {
//String regex = "(?<=//|)((\\w)+\\.)+[\\s\\S]+?(?=\\/|\\:|\\?)" ;
String regex = "\\b(?:[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*\\.)+[a-zA-Z]{2,}\\b";
Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher matcher = p.matcher(sourceAddress);
if (matcher.find()) {
domain = matcher.group();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return domain;
}
} }
...@@ -69,6 +69,10 @@ public class EventDataCondition { ...@@ -69,6 +69,10 @@ public class EventDataCondition {
//搜索词信息集合 //搜索词信息集合
private List<SearchWordVO> searchWordList; private List<SearchWordVO> searchWordList;
//关键词信息;推荐信息源时使用
private List<String> wordsList;
//是否免审核(1-是;0-否) //是否免审核(1-是;0-否)
private Integer isFreeCheck; private Integer isFreeCheck;
...@@ -77,6 +81,7 @@ public class EventDataCondition { ...@@ -77,6 +81,7 @@ public class EventDataCondition {
private Integer minScore; private Integer minScore;
//最大得分 //最大得分
private Integer maxScore; private Integer maxScore;
//es查询字段数组 //es查询字段数组
private String[] fetchFields; private String[] fetchFields;
...@@ -92,16 +97,25 @@ public class EventDataCondition { ...@@ -92,16 +97,25 @@ public class EventDataCondition {
//每页返回条数 //每页返回条数
private Integer pageSize = 10; private Integer pageSize = 10;
//资讯id集合,导出使用 //资讯id集合,导出/专题分析时 使用
private List<String> ids; private List<String> ids;
/*------资讯导出类参数---start-------------------*/
//导出方式(1-摘要;2-正文) //导出方式(1-摘要;2-正文)
private Integer exportType; private Integer exportType;
/*------资讯导出类参数---end-------------------*/
/*------专题分析类参数---start-------------------*/
//聚合分组类型-按日期集合分析时使用 //聚合分组类型-按日期集合分析时使用
private String groupType; private String groupType;
//选择的前num条数据-专题分析时使用 //选择的前num条数据-专题分析时使用
private Integer num; private Integer num;
//信息源id集合-统计分析资讯量最多的信息源时使用 //信息源id集合-统计分析资讯量最多的信息源时使用
private List<String> sourceIdList; private List<String> sourceIdList;
//聚合包含的字段值的集合
private String[] includeValues;
//聚合排除的字段值的集合
private String[] excludeValues;
/*------专题分析类参数---end-------------------*/
} }
package com.zzsn.event.vo;
import lombok.Data;
/**
* 信息源标签值对象信息
*
* @author lkg
* @date 2025/1/2
*/
@Data
public class InfoSourceLabelItemVO {
/**信息源标签值编码*/
private String labelItemCode;
/**信息源标签值名称*/
private String labelItemName;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 信息源标签对象信息
*
* @author lkg
* @date 2025/1/2
*/
@Data
public class InfoSourceLabelVO {
/**信息源标签编码*/
private String labelCode;
/**信息源标签名称*/
private String labelName;
/**信息源标签下的标签值列表*/
private List<InfoSourceLabelItemVO> infoSourceLabelItemList;
}
...@@ -14,7 +14,7 @@ import lombok.Setter; ...@@ -14,7 +14,7 @@ import lombok.Setter;
public class SearchWordVO { public class SearchWordVO {
/** /**
* 关键词检索范围(1-标题;2-全文;3-来源) * 关键词检索范围(1-标题;2-全文;3-来源;4-正文)
*/ */
private Integer searchScope; private Integer searchScope;
......
package com.zzsn.event.vo;
import lombok.Data;
/**
* @Description: 3
* @Author: jeecg-boot
* @Date: 2023-08-01
* @Version: V1.0
*/
@Data
public class SubjectInfoSourceLabelTypeVo {
/**信息源组id*/
private String sourceId;
/**专题id*/
private String subjectId;
}
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 专题信息源标签
*
* @author lkg
* @date 2025/1/3
*/
@Data
public class SubjectSourceTagVO {
/**专题id*/
private String subjectId;
/**标签编码集合*/
private List<String> labelCodes;
/**标签值编码集合*/
private List<String> labelItemCodes;
}
...@@ -12,4 +12,7 @@ import lombok.Data; ...@@ -12,4 +12,7 @@ import lombok.Data;
public class SubjectSourceVO { public class SubjectSourceVO {
private String subjectId; private String subjectId;
private String sourceId; private String sourceId;
//绑定定向信息源时使用(研究中心)
private String webSiteName;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论