提交 19ce910b 作者: 925993793@qq.com

专题配置修改后处理方案实现;平台接口替换调试修改

上级 6ed7c675
...@@ -100,4 +100,6 @@ public class Constants { ...@@ -100,4 +100,6 @@ public class Constants {
} }
return origin; return origin;
} }
public static final String HISTORY_DATE_QUEUE = "HISTORY_DATE_QUEUE:";
} }
...@@ -176,7 +176,12 @@ public class FileController { ...@@ -176,7 +176,12 @@ public class FileController {
clbFileOperationLog.setSubjectId(subjectId); clbFileOperationLog.setSubjectId(subjectId);
clbFileOperationLogService.updateById(clbFileOperationLog); clbFileOperationLogService.updateById(clbFileOperationLog);
//读取文件内容 //读取文件内容
List<List<String>> lists = ExcelExportUtil.readExcel(new ByteArrayInputStream(fileData), 1, 9); List<List<String>> lists;
if ("xls".equals(fileSuffix)) {
lists = ExcelExportUtil.readExcelXls(new ByteArrayInputStream(fileData), false,1, 9);
} else {
lists = ExcelExportUtil.readExcelXlsx(new ByteArrayInputStream(fileData), false,1, 9);
}
//存入es //存入es
informationService.importInfo(lists, subjectId, isTopping, isExamine, clbFileOperationLog, userVo); informationService.importInfo(lists, subjectId, isTopping, isExamine, clbFileOperationLog, userVo);
} catch (Exception e) { } catch (Exception e) {
...@@ -262,8 +267,60 @@ public class FileController { ...@@ -262,8 +267,60 @@ public class FileController {
} }
/**
* 专题资讯导入模板下载-研究中心
*
* @author lkg
* @date 2024/06/21
*/
@GetMapping("/downloadResearchTemplate")
public void downloadResearchTemplate(HttpServletResponse response) {
String filePath = "subjectDataImport/上传Excel模板.xls";
commonService.downloadTemplate(response, filePath);
}
/**
* 批量导入数据-研究中心
*
* @author lkg
* @date 2024/12/25
*/
@PostMapping("/importDataInfo")
public Result<?> importDataInfo(HttpServletRequest request){
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
if (fileMap.size() < 1) {
return Result.FAIL(500, "请上传excel文件");
}
MultipartFile multipartFile = fileMap.get(new ArrayList<>(fileMap.keySet()).get(0));
int index = multipartFile.getOriginalFilename().lastIndexOf(".");
String fileSuffix = multipartFile.getOriginalFilename().substring(index + 1);
if ("xls".equals(fileSuffix) || "xlsx".equals(fileSuffix)) {
CompletableFuture.runAsync(() -> {
String subjectId = request.getParameter("subjectId");
try {
byte[] fileData = multipartFile.getBytes();
//读取文件内容
List<List<String>> lists;
if ("xls".equals(fileSuffix)) {
lists = ExcelExportUtil.readExcelXls(new ByteArrayInputStream(fileData), true,1, 7);
} else {
lists = ExcelExportUtil.readExcelXlsx(new ByteArrayInputStream(fileData), true,1, 7);
}
informationService.importDataInfo(lists,subjectId);
} catch (IOException e) {
e.printStackTrace();
}
});
return Result.OK("正在进行处理");
} else {
return Result.FAIL(500, "不支持的文件类型");
}
}
/** /**
* 导出数据-word格式 * 导出数据-word格式-研究中心
* *
* @param searchCondition 筛选条件 * @param searchCondition 筛选条件
* @author lkg * @author lkg
......
...@@ -411,8 +411,8 @@ public class SubjectManageController { ...@@ -411,8 +411,8 @@ public class SubjectManageController {
*/ */
@GetMapping(value = "/bindKeyWordsList") @GetMapping(value = "/bindKeyWordsList")
public Result<?> bindKeyWordsList(@RequestParam String subjectId) { public Result<?> bindKeyWordsList(@RequestParam String subjectId) {
subjectKeywordsMapService.bindKeyWordsList(subjectId); List<KeyWordsPage> bindKeyWordsList = subjectKeywordsMapService.bindKeyWordsList(subjectId);
return Result.OK(); return Result.OK(bindKeyWordsList);
} }
/** /**
...@@ -860,8 +860,13 @@ public class SubjectManageController { ...@@ -860,8 +860,13 @@ public class SubjectManageController {
return Result.FAIL("请选择上传文件"); return Result.FAIL("请选择上传文件");
} }
String originalFilename = file.getOriginalFilename(); String originalFilename = file.getOriginalFilename();
if (!(originalFilename.endsWith(".xlsx") || originalFilename.endsWith(".xls"))) { if (originalFilename.endsWith(".xlsx") || originalFilename.endsWith(".xls")) {
List<List<String>> dataList = ExcelExportUtil.readExcel(file.getInputStream(), 1, 2); List<List<String>> dataList;
if (originalFilename.endsWith(".xls")) {
dataList = ExcelExportUtil.readExcelXls(file.getInputStream(), false,1, 2);
} else {
dataList = ExcelExportUtil.readExcelXlsx(file.getInputStream(), false,1, 2);
}
if (CollectionUtils.isNotEmpty(dataList)) { if (CollectionUtils.isNotEmpty(dataList)) {
boolean emptyFlag = false; boolean emptyFlag = false;
for (List<String> strings : dataList) { for (List<String> strings : dataList) {
......
package com.zzsn.event.controller; package com.zzsn.event.controller;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.service.SubjectService; import com.zzsn.event.service.SubjectService;
import com.zzsn.event.service.SubjectSimpleService; import com.zzsn.event.service.SubjectSimpleService;
import com.zzsn.event.vo.InfoDataSearchCondition; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectDetailVO;
import com.zzsn.event.vo.SubjectSimpleVO;
import com.zzsn.event.xxljob.service.IXxlJobInfoService; import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -56,6 +55,20 @@ public class SubjectSimpleController { ...@@ -56,6 +55,20 @@ public class SubjectSimpleController {
} }
/** /**
* 专题配置校验
*
* @param subjectParamsCheckVO 参数
* @author lkg
* @date 2025/2/5
*/
@PostMapping("/configVerification")
public Result<?> configVerification(@RequestBody SubjectParamsCheckVO subjectParamsCheckVO){
Boolean verification = subjectSimpleService.configVerification(subjectParamsCheckVO);
return Result.OK(verification);
}
/**
* 编辑专题 * 编辑专题
* *
* @param subjectSimpleVO 参数 * @param subjectSimpleVO 参数
...@@ -73,6 +86,19 @@ public class SubjectSimpleController { ...@@ -73,6 +86,19 @@ public class SubjectSimpleController {
} }
/** /**
* 清空专题数据
*
* @param subjectId 专题id
* @author lkg
* @date 2025/2/6
*/
@GetMapping("/clearData")
public Result<?> clearData(String subjectId){
subjectSimpleService.clearSubjectData(subjectId);
return Result.OK("正在清空数据");
}
/**
* 专题详情(包含样例文章以及关键词) * 专题详情(包含样例文章以及关键词)
* *
* @param subjectId 专题id * @param subjectId 专题id
......
...@@ -13,6 +13,7 @@ import com.zzsn.event.enums.LabelTypeEnum; ...@@ -13,6 +13,7 @@ import com.zzsn.event.enums.LabelTypeEnum;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.HttpUtil; import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.PythonUtil;
import com.zzsn.event.util.user.AuthUtil; import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
...@@ -51,9 +52,8 @@ public class InformationController { ...@@ -51,9 +52,8 @@ public class InformationController {
private LabelEntityService labelEntityService; private LabelEntityService labelEntityService;
@Autowired @Autowired
private SysBaseLabelTypeService sysBaseLabelTypeService; private SysBaseLabelTypeService sysBaseLabelTypeService;
@Autowired
@Value("${python.judgeDuplicateUrl:}") private PythonUtil pythonUtil;
private String judgeDuplicateUrl;
/** /**
...@@ -266,7 +266,7 @@ public class InformationController { ...@@ -266,7 +266,7 @@ public class InformationController {
UserVo userVo = UserUtil.getLoginUser(); UserVo userVo = UserUtil.getLoginUser();
DisplayInfo displayInfo = JSON.parseObject(JSON.toJSONString(jsonObject.get("data")), DisplayInfo.class); DisplayInfo displayInfo = JSON.parseObject(JSON.toJSONString(jsonObject.get("data")), DisplayInfo.class);
Integer category = (Integer) jsonObject.get("category"); Integer category = (Integer) jsonObject.get("category");
boolean modelFlag = judgeDuplicate(displayInfo); boolean modelFlag = pythonUtil.judgeDuplicate(displayInfo.getId(), displayInfo.getTitle(), displayInfo.getContent(), displayInfo.getSourceAddress(), displayInfo.getSubjectId());
if (modelFlag) { if (modelFlag) {
return Result.FAIL(210, "判重存在重复资讯!"); return Result.FAIL(210, "判重存在重复资讯!");
} else { } else {
...@@ -392,36 +392,4 @@ public class InformationController { ...@@ -392,36 +392,4 @@ public class InformationController {
List<SubjectDataVo> recommendList = informationService.recommendList(subjectId, id, title, pageNo, pageSize); List<SubjectDataVo> recommendList = informationService.recommendList(subjectId, id, title, pageNo, pageSize);
return Result.OK(recommendList); return Result.OK(recommendList);
} }
public boolean judgeDuplicate(DisplayInfo displayInfo) {
boolean repeat = false;
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json;charset=UTF-8");
headers.put("Accept", "application/json");
headers.put("Authorization", "!0gwY$5S@5V&A_+XEu)");
JSONObject jsonObjectParam = new JSONObject();
jsonObjectParam.put("id", displayInfo.getId());
jsonObjectParam.put("title", displayInfo.getTitle());
jsonObjectParam.put("content", displayInfo.getContent());
jsonObjectParam.put("sourceAddress", displayInfo.getSourceAddress());
JSONArray jsonArray = new JSONArray();
jsonArray.add(jsonObjectParam);
JSONObject paramObject = new JSONObject();
paramObject.put("data", jsonArray);
paramObject.put("hash_name", displayInfo.getSubjectId());
try {
String result = HttpUtil.doPostWithHeader(judgeDuplicateUrl, paramObject, 3000, headers);
if (StringUtils.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if (StringUtils.isNotEmpty(jsonObject.getString("resultData")) && !jsonObject.getJSONArray("resultData").isEmpty()) {
JSONObject resultObject = (JSONObject) jsonObject.getJSONArray("resultData").get(0);
repeat = resultObject.getBoolean("duplicated");
}
}
} catch (Exception e) {
e.printStackTrace();
}
return repeat;
}
} }
...@@ -197,8 +197,6 @@ public class RelationBindController { ...@@ -197,8 +197,6 @@ public class RelationBindController {
* @param category 类别(1-专题;2-事件) * @param category 类别(1-专题;2-事件)
* @param groupName 词组名称 * @param groupName 词组名称
* @param wordName 关键词 * @param wordName 关键词
* @param pageNo 当前页
* @param pageSize 每页返回条数
* @author lkg * @author lkg
* @date 2024/12/17 * @date 2024/12/17
*/ */
...@@ -206,9 +204,7 @@ public class RelationBindController { ...@@ -206,9 +204,7 @@ public class RelationBindController {
public Result<?> bindKeyWordsList(@RequestParam String id, public Result<?> bindKeyWordsList(@RequestParam String id,
@RequestParam Integer category, @RequestParam Integer category,
@RequestParam(required = false) String groupName, @RequestParam(required = false) String groupName,
@RequestParam(required = false) String wordName, @RequestParam(required = false) String wordName) {
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize) {
List<String> subjectIdList = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
if (!"0".equals(id)) { if (!"0".equals(id)) {
List<String> typeIds = subjectTypeService.belowIdList(id, category); List<String> typeIds = subjectTypeService.belowIdList(id, category);
...@@ -219,8 +215,8 @@ public class RelationBindController { ...@@ -219,8 +215,8 @@ public class RelationBindController {
} }
} }
subjectIdList.add(id); subjectIdList.add(id);
IPage<KeyWordsPage> page = keyWordsService.bindKeyWordsList(subjectIdList, groupName, wordName, pageNo, pageSize); List<KeyWordsPage> bindKeyWordsList = keyWordsService.bindKeyWordsList(subjectIdList, groupName, wordName);
return Result.OK(page); return Result.OK(bindKeyWordsList);
} }
......
...@@ -52,8 +52,6 @@ public class EventManageController { ...@@ -52,8 +52,6 @@ public class EventManageController {
private LabelEntityService labelEntityService; private LabelEntityService labelEntityService;
@Autowired @Autowired
private IXxlJobInfoService iXxlJobInfoService; private IXxlJobInfoService iXxlJobInfoService;
@Autowired
private ISubjectInfoSourceMapService subjectInfoSourceMapService;
@Autowired @Autowired
private IKeyWordsService keyWordsService; private IKeyWordsService keyWordsService;
......
...@@ -80,6 +80,10 @@ public class ClbLabelItem extends Model<ClbLabelItem> { ...@@ -80,6 +80,10 @@ public class ClbLabelItem extends Model<ClbLabelItem> {
@TableField("path_ids") @TableField("path_ids")
private String pathIds; private String pathIds;
/**所属标签编码*/
@TableField(exist = false)
private String labelCode;
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
......
...@@ -50,61 +50,9 @@ public class InfoSource implements Serializable { ...@@ -50,61 +50,9 @@ public class InfoSource implements Serializable {
/**地区*/ /**地区*/
@ApiModelProperty(value = "地区") @ApiModelProperty(value = "地区")
private String area; private String area;
/**是否需要登录*/
@ApiModelProperty(value = "是否需要登录")
private Integer ynLogin;
/**语种*/ /**语种*/
@ApiModelProperty(value = "语种") @ApiModelProperty(value = "语种")
private String language; private String language;
/**是否公共*/
@ApiModelProperty(value = "是否公共")
private String ynPublic;
/**是否需要翻墙*/
@ApiModelProperty(value = "是否需要翻墙")
private Integer ynAbroad;
/**是否需要代理*/
@ApiModelProperty(value = "是否需要代理")
private Integer ynAgent;
/**动态爬取*/
@ApiModelProperty(value = "动态爬取")
private Integer ynBrowser;
/**调度时间间隔*/
@ApiModelProperty(value = "调度时间间隔")
private String period;
/**调度周期(cron自动生成)*/
@ApiModelProperty(value = "调度周期(cron自动生成)")
private String cron;
/**调度周期说明*/
@ApiModelProperty(value = "调度周期说明")
private String remarkCron;
/**信息源状态*/
@ApiModelProperty(value = "信息源状态")
private Integer status;
/**网站可信度*/
@ApiModelProperty(value = "网站可信度")
private Integer siteReliability;
/**信息源综合评分*/
@ApiModelProperty(value = "信息源综合评分")
private Integer score;
/**爬取深度*/
@ApiModelProperty(value = "爬取深度")
private Integer crawlDepth;
/**爬取方式*/
@ApiModelProperty(value = "爬取方式")
private Integer crawlType;
/**历史数据URL*/
@ApiModelProperty(value = "历史数据URL")
private String hisUriExp;
/**历史数据开始时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "历史数据开始时间")
private Date hisDateStarttime;
/**历史数据结束时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "历史数据结束时间")
private Date hisDateEndtime;
/**创建人*/ /**创建人*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private String createBy;
...@@ -121,38 +69,7 @@ public class InfoSource implements Serializable { ...@@ -121,38 +69,7 @@ public class InfoSource implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private Date updateTime; private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**验证结果*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String verification;
/**验证失败原因*/
private String verificationFailureCause;
/**所属单位*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String company;
/**所属行业*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String industry;
/**权威性*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String authority;
/**可信度*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String reliability;
/**原创度*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String originality;
/**父网站*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String parentSite;
/**是否保存快照(1:保存 0:不保存)*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String ynSnapshot;
/**是否启动原创性校验(1:启动 0:不启动)*/
private String ynVerification;
/**原创来源(中文逗号隔开)*/ /**原创来源(中文逗号隔开)*/
private String originalSource; private String originalSource;
} }
...@@ -103,7 +103,13 @@ public class Subject implements Serializable { ...@@ -103,7 +103,13 @@ public class Subject implements Serializable {
private String remark; private String remark;
/**是否是平台创建的专题(0否--外部创建 1是--平台创建 )*/ /**是否是平台创建的专题(0否--外部创建 1是--平台创建 )*/
private String isPlatform; private String isPlatform;
/**第一次启用时间*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date firstOpenTime;
/**预估状态*/
private String estimateStatus;
/**专题分类id*/ /**专题分类id*/
@TableField(exist = false) @TableField(exist = false)
......
...@@ -1507,8 +1507,7 @@ public class EsService { ...@@ -1507,8 +1507,7 @@ public class EsService {
} }
if (aggregationBuilder != null) { if (aggregationBuilder != null) {
TermsAggregationBuilder groupLibraryType = AggregationBuilders.terms("groupLibraryType") TermsAggregationBuilder groupLibraryType = AggregationBuilders.terms("groupLibraryType")
.field("classificationType") .field("classificationType");
.size(searchCondition.getIncludeValues().length);
if (!Objects.isNull(searchCondition.getIncludeValues()) || !Objects.isNull(searchCondition.getExcludeValues())) { if (!Objects.isNull(searchCondition.getIncludeValues()) || !Objects.isNull(searchCondition.getExcludeValues())) {
if (!Objects.isNull(searchCondition.getIncludeValues())) { if (!Objects.isNull(searchCondition.getIncludeValues())) {
groupLibraryType.size(searchCondition.getIncludeValues().length); groupLibraryType.size(searchCondition.getIncludeValues().length);
...@@ -1742,15 +1741,21 @@ public class EsService { ...@@ -1742,15 +1741,21 @@ public class EsService {
boolQuery.mustNot(QueryBuilders.matchQuery("type", "video")); boolQuery.mustNot(QueryBuilders.matchQuery("type", "video"));
} }
//删除状态查询 //删除状态查询
if (searchCondition.getDeleteFlag() != 0) { if (searchCondition.getDeleteFlag() != null) {
boolQuery.must(QueryBuilders.termQuery("deleteFlag", "1")); if (searchCondition.getDeleteFlag() != 0) {
} else { boolQuery.must(QueryBuilders.termQuery("deleteFlag", "1"));
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1")); } else {
boolQuery.mustNot(QueryBuilders.termQuery("deleteFlag", "1"));
}
} }
//专题库类别筛选 //专题库类别筛选
if (CollectionUtils.isNotEmpty(searchCondition.getClassificationType())) { if (CollectionUtils.isNotEmpty(searchCondition.getClassificationType())) {
boolQuery.must(QueryBuilders.termsQuery("classificationType", searchCondition.getClassificationType())); boolQuery.must(QueryBuilders.termsQuery("classificationType", searchCondition.getClassificationType()));
} }
//是否原创
if (StringUtils.isNotEmpty(searchCondition.getOriginality())) {
boolQuery.must(QueryBuilders.matchQuery("originality", searchCondition.getOriginality()));
}
//得分范围筛选 //得分范围筛选
Integer minScore = searchCondition.getMinScore(); Integer minScore = searchCondition.getMinScore();
if (minScore != null) { if (minScore != null) {
......
package com.zzsn.event.mapper; package com.zzsn.event.mapper;
import com.zzsn.event.entity.ClbLabelItem;
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.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -92,4 +93,13 @@ public interface CommonMapper { ...@@ -92,4 +93,13 @@ public interface CommonMapper {
List<String> getExcludeKeywords(@Param("databaseIds") List<String> databaseIds); List<String> getExcludeKeywords(@Param("databaseIds") List<String> databaseIds);
/**
* 信息源绑定的标签信息集合
*
* @param sidList 信息源id集合
* @author lkg
* @date 2025/2/5
*/
List<LabelItemMapVO> infoSourceLabelsBySidList(@Param("sidList") List<String> sidList);
} }
...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @Description: 信息源表 * @Description: 信息源表
...@@ -36,7 +37,7 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -36,7 +37,7 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* @author lkg * @author lkg
* @date 2024/5/7 * @date 2024/5/7
*/ */
List<InfoSourceVo> queryInfoSource(@Param("sourceIdList") List<String> sourceIdList); List<InfoSourceVo> queryInfoSource(@Param("sourceIdList") List<String> sourceIdList,@Param("subjectIds") List<String> subjectIds);
/** /**
* 专题绑定的信息源集合 * 专题绑定的信息源集合
...@@ -61,6 +62,15 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -61,6 +62,15 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
Long bindSourceIdCount(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, @Param("subjectIds") List<String> subjectIds); Long bindSourceIdCount(@Param("infoSourceVo") InfoSourceCondition infoSourceCondition, @Param("subjectIds") List<String> subjectIds);
/** /**
*
*
* @param subjectIds 专题id集合
* @author lkg
* @date 2025/2/6
*/
List<InfoSourceVo> bindGroupSourceIdList(@Param("subjectIds") List<String> subjectIds);
/**
* 专题直接屏蔽的信息源列表(不包括专题屏蔽的信息源组下的信息源) * 专题直接屏蔽的信息源列表(不包括专题屏蔽的信息源组下的信息源)
* *
* @param infoSourceCondition 筛选条件 * @param infoSourceCondition 筛选条件
...@@ -109,4 +119,13 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> { ...@@ -109,4 +119,13 @@ public interface InfoSourceMapper extends BaseMapper<InfoSource> {
* @date 2025/1/4 * @date 2025/1/4
*/ */
List<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName); List<InfoSource> directSourceColumnList(@Param("webSiteName") String webSiteName);
/**
* 信息源下栏目id列表(校验专题配置时使用-研究中心)
*
* @param webSiteNames 信息源名称集合
* @author lkg
* @date 2025/1/4
*/
Set<String> directSourceColumnSet(@Param("webSiteNames") List<String> webSiteNames);
} }
...@@ -43,13 +43,10 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> { ...@@ -43,13 +43,10 @@ public interface KeyWordsMapper extends BaseMapper<KeyWords> {
* @param subjectIds 专题id集合 * @param subjectIds 专题id集合
* @param groupName 词组名称 * @param groupName 词组名称
* @param wordName 关键词名称 * @param wordName 关键词名称
* @param page 分页参数
* @author lkg * @author lkg
* @date 2024/5/7 * @date 2024/5/7
*/ */
Page<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds, List<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds,@Param("groupName") String groupName, @Param("wordName") String wordName);
@Param("groupName") String groupName, @Param("wordName") String wordName,
Page<KeyWordsPage> page);
/** /**
* 专题/事件绑定关键词组的数量 * 专题/事件绑定关键词组的数量
......
...@@ -19,4 +19,6 @@ import java.util.List; ...@@ -19,4 +19,6 @@ import java.util.List;
public interface SysDictItemMapper extends BaseMapper<SysDictItem> { public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
List<SysDictItem> listByDictCode(@Param("dictCode") String dictCode); List<SysDictItem> listByDictCode(@Param("dictCode") String dictCode);
SysDictItem dictItemInfoByName(@Param("dictCode") String dictCode,@Param("itemName") String itemName);
} }
...@@ -125,7 +125,8 @@ ...@@ -125,7 +125,8 @@
</select> </select>
<select id="modelList" resultType="com.zzsn.event.vo.ModelVO"> <select id="modelList" resultType="com.zzsn.event.vo.ModelVO">
select * from model select *
from model
</select> </select>
<select id="subjectModelBindLabels" resultType="com.zzsn.event.vo.LabelModelVo"> <select id="subjectModelBindLabels" resultType="com.zzsn.event.vo.LabelModelVo">
...@@ -169,4 +170,13 @@ ...@@ -169,4 +170,13 @@
</foreach>) </foreach>)
</if> </if>
</select> </select>
<select id="infoSourceLabelsBySidList" resultType="com.zzsn.event.vo.LabelItemMapVO">
select m.entity_code,m.label_code,m.label_item_code from clb_label_info_source_map m
inner join clb_label_item item on m.label_item_code = item.label_item_code
where m.entity_code in
<foreach collection="sidList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
</select> </select>
<select id="queryInfoSource" resultType="com.zzsn.event.vo.InfoSourceVo"> <select id="queryInfoSource" resultType="com.zzsn.event.vo.InfoSourceVo">
select t.*, g.infoSourceNatureIds as natureIds, g.infoSourceNatureNames, k.infoSourceGroupNames from ( select t.*, g.infoSourceNatureIds as natureIds, g.infoSourceNatureNames,
k.infoSourceGroupNames,sm.is_exempt_keyword,sm.is_free_check
from (
select y.* from ( select y.* from (
select a.*, c.type_name as infoSourceTypeName, c.id as infoSourceTypeId from info_source a select a.*, c.type_name as infoSourceTypeName, c.id as infoSourceTypeId from info_source a
LEFT JOIN info_source_type_map b ON b.source_id = a.id LEFT JOIN info_source_type_map b ON b.source_id = a.id
...@@ -47,6 +49,13 @@ ...@@ -47,6 +49,13 @@
SEPARATOR ',') as infoSourceGroupIds from info_source_group_map h SEPARATOR ',') as infoSourceGroupIds from info_source_group_map h
LEFT JOIN info_source_group j ON j.id = h.group_id LEFT JOIN info_source_group j ON j.id = h.group_id
GROUP BY h.source_id) k ON t.id = k.source_id GROUP BY h.source_id) k ON t.id = k.source_id
LEFT JOIN subject_info_source_map sm ON sm.source_id = t.id
<if test="subjectIds != null and subjectIds.size() > 0">
AND sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select> </select>
<select id="bindSourceIdList" resultType="String"> <select id="bindSourceIdList" resultType="String">
...@@ -181,7 +190,37 @@ ...@@ -181,7 +190,37 @@
) )
) q ) q
</select> </select>
<select id="bindGroupSourceIdList" resultType="com.zzsn.event.vo.InfoSourceVo">
SELECT
iso.id,
iso.web_site_name,
iso.site_name,
iso.site_uri,
iso.`status`,
iso.crawl_type,
iso.create_time,
sm.is_exempt_keyword,
sm.is_free_check
FROM
info_source_group_map m
INNER JOIN info_source iso ON m.source_id = iso.id
INNER JOIN subject_info_source_map sm ON sm.source_id = m.group_id
<if test="subjectIds != null and subjectIds.size() > 0">
AND sm.subject_id IN
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
WHERE
m.group_id IN ( SELECT source_id FROM subject_info_source_map WHERE type IN ( 2, 5 )
<if test="subjectIds != null and subjectIds.size() > 0">
and subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY source_id )
</select>
<select id="unBindSourcePageList" resultType="com.zzsn.event.vo.InfoSourceVo"> <select id="unBindSourcePageList" resultType="com.zzsn.event.vo.InfoSourceVo">
select s.id,s.info_source_code,s.web_site_name,s.site_name,s.site_uri,s.status,s.create_time from info_source s select s.id,s.info_source_code,s.web_site_name,s.site_name,s.site_uri,s.status,s.create_time from info_source s
inner join subject_info_source_map sm on s.id = sm.source_id inner join subject_info_source_map sm on s.id = sm.source_id
...@@ -238,4 +277,15 @@ ...@@ -238,4 +277,15 @@
from info_source iso from info_source iso
where iso.web_site_name = #{webSiteName} where iso.web_site_name = #{webSiteName}
</select> </select>
<select id="directSourceColumnSet" resultType="String">
select iso.id from info_source iso
where 1=1
<if test="webSiteNames != null and webSiteNames.size() > 0">
and iso.web_site_name in
<foreach collection="webSiteNames" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
and x.key_word like CONCAT('%',#{wordName},'%') and x.key_word like CONCAT('%',#{wordName},'%')
</if> </if>
order by x.create_time desc order by x.create_time desc
limit #{offset},#{pageSize}
</select> </select>
<select id="bindCount" resultType="Integer"> <select id="bindCount" resultType="Integer">
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
d.remark, d.remark,
d.create_time, d.create_time,
d.status, d.status,
d.estimate_status,
d.create_by, d.create_by,
c.type_name as subjectTypeName c.type_name as subjectTypeName
from subject d from subject d
...@@ -123,6 +124,7 @@ ...@@ -123,6 +124,7 @@
d.remark, d.remark,
d.create_time, d.create_time,
d.status, d.status,
d.estimate_status,
d.create_by, d.create_by,
c.type_name as subjectTypeName c.type_name as subjectTypeName
from subject d from subject d
...@@ -157,6 +159,7 @@ ...@@ -157,6 +159,7 @@
<result column="time_disable" property="timeDisable"/> <result column="time_disable" property="timeDisable"/>
<result column="library" property="library"/> <result column="library" property="library"/>
<result column="face_public" property="facePublic"/> <result column="face_public" property="facePublic"/>
<result column="first_open_time" property="firstOpenTime"/>
<collection property="sampleFileList" ofType="com.zzsn.event.entity.SubjectSampleFile"> <collection property="sampleFileList" ofType="com.zzsn.event.entity.SubjectSampleFile">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="file_name" property="fileName"/> <result column="file_name" property="fileName"/>
...@@ -173,6 +176,7 @@ ...@@ -173,6 +176,7 @@
s.data_source, s.data_source,
s.face_public, s.face_public,
s.library, s.library,
s.first_open_time,
c.id as subjectTypeId, c.id as subjectTypeId,
c.type_name as subjectTypeName, c.type_name as subjectTypeName,
f.id, f.id,
......
...@@ -6,4 +6,8 @@ ...@@ -6,4 +6,8 @@
select * from sys_dict_item item inner join sys_dict dict on item.dict_id = dict.id select * from sys_dict_item item inner join sys_dict dict on item.dict_id = dict.id
where dict.dict_code = #{dictCode} and item.status = 1 where dict.dict_code = #{dictCode} and item.status = 1
</select> </select>
<select id="dictItemInfoByName" 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} and item.item_text = #{itemName}
</select>
</mapper> </mapper>
\ No newline at end of file
package com.zzsn.event.service; package com.zzsn.event.service;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.entity.ClbLabelItem;
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.ibatis.annotations.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
...@@ -99,4 +99,13 @@ public interface CommonService { ...@@ -99,4 +99,13 @@ public interface CommonService {
* @date 2025/1/4 * @date 2025/1/4
*/ */
void downloadTemplate(HttpServletResponse response, String path); void downloadTemplate(HttpServletResponse response, String path);
/**
* 信息源绑定的标签信息集合
*
* @param sidList 信息源id集合
* @author lkg
* @date 2025/2/5
*/
List<LabelItemMapVO> infoSourceLabelsBySidList(List<String> sidList);
} }
...@@ -8,6 +8,7 @@ import com.zzsn.event.entity.InfoSource; ...@@ -8,6 +8,7 @@ import com.zzsn.event.entity.InfoSource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @Description: 信息源表 * @Description: 信息源表
...@@ -95,4 +96,14 @@ public interface IInfoSourceService extends IService<InfoSource> { ...@@ -95,4 +96,14 @@ public interface IInfoSourceService extends IService<InfoSource> {
* @date 2025/1/4 * @date 2025/1/4
*/ */
List<InfoSource> directSourceColumnList(String webSiteName); List<InfoSource> directSourceColumnList(String webSiteName);
/**
* 信息源下栏目id列表(校验专题配置时使用-研究中心)
*
* @param webSiteNames 信息源名称集合
* @author lkg
* @date 2025/1/4
*/
Set<String> directSourceColumnSet(List<String> webSiteNames);
} }
...@@ -69,12 +69,10 @@ public interface IKeyWordsService extends IService<KeyWords> { ...@@ -69,12 +69,10 @@ public interface IKeyWordsService extends IService<KeyWords> {
* @param subjectIds 专题id集合 * @param subjectIds 专题id集合
* @param groupName 词组名称 * @param groupName 词组名称
* @param wordName 关键词名称 * @param wordName 关键词名称
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg * @author lkg
* @date 2024/5/7 * @date 2024/5/7
*/ */
IPage<KeyWordsPage> bindKeyWordsList(List<String> subjectIds, String groupName, String wordName, Integer pageNo, Integer pageSize); List<KeyWordsPage> bindKeyWordsList(List<String> subjectIds, String groupName, String wordName);
/** /**
* 专题绑定关键词组的数量 * 专题绑定关键词组的数量
......
...@@ -180,5 +180,17 @@ public interface InformationService { ...@@ -180,5 +180,17 @@ public interface InformationService {
*/ */
List<SubjectDataVo> recommendList(String subjectId, String id, String title, Integer pageNo, Integer pageSize); List<SubjectDataVo> recommendList(String subjectId, String id, String title, Integer pageNo, Integer pageSize);
/**
* 批量导入数据到发布库
* @author lkg
* @date 2025/2/5
*/
void importInfo(List<List<String>> lists, String subjectId, String isTopping, String isExamine, ClbFileOperationLog clbFileOperationLog, UserVo userVo); void importInfo(List<List<String>> lists, String subjectId, String isTopping, String isExamine, ClbFileOperationLog clbFileOperationLog, UserVo userVo);
/**
* 批量导入数据到发布库-研究中心
* @author lkg
* @date 2025/2/5
*/
void importDataInfo(List<List<String>> lists, String subjectId);
} }
package com.zzsn.event.service; package com.zzsn.event.service;
import com.zzsn.event.entity.Subject; import com.zzsn.event.entity.Subject;
import com.zzsn.event.vo.InfoDataSearchCondition; import com.zzsn.event.vo.*;
import com.zzsn.event.vo.SearchWordVO;
import com.zzsn.event.vo.SubjectDetailVO;
import com.zzsn.event.vo.SubjectSimpleVO;
import java.util.List; import java.util.List;
...@@ -26,6 +23,15 @@ public interface SubjectSimpleService { ...@@ -26,6 +23,15 @@ public interface SubjectSimpleService {
Subject createSubject(SubjectSimpleVO subjectSimpleVO); Subject createSubject(SubjectSimpleVO subjectSimpleVO);
/** /**
* 专题配置校验
*
* @param subjectParamsCheckVO 参数
* @author lkg
* @date 2025/2/5
*/
Boolean configVerification(SubjectParamsCheckVO subjectParamsCheckVO);
/**
* 编辑专题 * 编辑专题
* *
* @param subjectSimpleVO 参数 * @param subjectSimpleVO 参数
...@@ -87,4 +93,13 @@ public interface SubjectSimpleService { ...@@ -87,4 +93,13 @@ public interface SubjectSimpleService {
* @date 2025/1/14 * @date 2025/1/14
*/ */
void batchRemove(InfoDataSearchCondition searchCondition); void batchRemove(InfoDataSearchCondition searchCondition);
/**
* 清空专题数据
*
* @param subjectId 专题id
* @author lkg
* @date 2025/2/6
*/
void clearSubjectData(String subjectId);
} }
...@@ -18,6 +18,8 @@ public interface SysDictItemService extends IService<SysDictItem> { ...@@ -18,6 +18,8 @@ public interface SysDictItemService extends IService<SysDictItem> {
List<SysDictItem> listByDictCode(String dictCode); List<SysDictItem> listByDictCode(String dictCode);
SysDictItem dictItemInfoByName(String dictCode, String itemName);
/** /**
* 改变key值(字典值码转为字典值) * 改变key值(字典值码转为字典值)
* *
......
...@@ -340,6 +340,15 @@ public class CommonServiceImpl implements CommonService { ...@@ -340,6 +340,15 @@ public class CommonServiceImpl implements CommonService {
} }
} }
@Override
public List<LabelItemMapVO> infoSourceLabelsBySidList(List<String> sidList) {
List<LabelItemMapVO> clbLabelItems = new ArrayList<>();
if (CollectionUtils.isEmpty(sidList)) {
clbLabelItems = commonMapper.infoSourceLabelsBySidList(sidList);
}
return clbLabelItems;
}
//获取树状结构 //获取树状结构
private List<ModelVO> getTreeList(List<ModelVO> authTypeList){ private List<ModelVO> getTreeList(List<ModelVO> authTypeList){
List<ModelVO> topList = new ArrayList<>(); List<ModelVO> topList = new ArrayList<>();
......
...@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl; ...@@ -3,6 +3,7 @@ package com.zzsn.event.service.impl;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -49,8 +51,23 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou ...@@ -49,8 +51,23 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
List<InfoSourceVo> pageList = new ArrayList<>(); List<InfoSourceVo> pageList = new ArrayList<>();
List<String> bindList = baseMapper.bindSourceIdList(infoSourceCondition,subjectIds,offset,pageSize); List<String> bindList = baseMapper.bindSourceIdList(infoSourceCondition,subjectIds,offset,pageSize);
if (CollectionUtils.isNotEmpty(bindList)) { if (CollectionUtils.isNotEmpty(bindList)) {
pageList = baseMapper.queryInfoSource(bindList); List<InfoSourceVo> infoSourceVos = baseMapper.bindGroupSourceIdList(subjectIds);
Map<String, InfoSourceVo> collect1 = infoSourceVos.stream().collect(Collectors.toMap(InfoSourceVo::getId, Function.identity(), (exist, replace) -> exist));
pageList = baseMapper.queryInfoSource(bindList,subjectIds);
for (InfoSourceVo infoSourceVo1 : pageList) { for (InfoSourceVo infoSourceVo1 : pageList) {
//数据配置
if (ObjectUtil.isEmpty(infoSourceVo1.getIsFreeCheck())){
InfoSourceVo infoSourceVo2 = collect1.get(infoSourceVo1.getId());
if (infoSourceVo2 != null) {
infoSourceVo1.setIsFreeCheck(infoSourceVo2.getIsFreeCheck());
}
}
if (ObjectUtil.isEmpty(infoSourceVo1.getIsExemptKeyword())){
InfoSourceVo infoSourceVo2 = collect1.get(infoSourceVo1.getId());
if (infoSourceVo2 != null) {
infoSourceVo1.setIsExemptKeyword(infoSourceVo2.getIsExemptKeyword());
}
}
//性质 //性质
if (StringUtils.isNotEmpty(infoSourceVo1.getNatureIds())) { if (StringUtils.isNotEmpty(infoSourceVo1.getNatureIds())) {
String natureIds = infoSourceVo1.getNatureIds(); String natureIds = infoSourceVo1.getNatureIds();
...@@ -129,4 +146,9 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou ...@@ -129,4 +146,9 @@ public class InfoSourceServiceImpl extends ServiceImpl<InfoSourceMapper, InfoSou
public List<InfoSource> directSourceColumnList(String webSiteName) { public List<InfoSource> directSourceColumnList(String webSiteName) {
return baseMapper.directSourceColumnList(webSiteName); return baseMapper.directSourceColumnList(webSiteName);
} }
@Override
public Set<String> directSourceColumnSet(List<String> webSiteNames) {
return baseMapper.directSourceColumnSet(webSiteNames);
}
} }
...@@ -2,6 +2,7 @@ package com.zzsn.event.service.impl; ...@@ -2,6 +2,7 @@ package com.zzsn.event.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
...@@ -84,6 +85,8 @@ public class InformationServiceImpl implements InformationService { ...@@ -84,6 +85,8 @@ public class InformationServiceImpl implements InformationService {
private IClbFileOperationLogDetailsService clbFileOperationLogDetailsService; private IClbFileOperationLogDetailsService clbFileOperationLogDetailsService;
@Autowired @Autowired
private ICollectionMapService collectionMapService; private ICollectionMapService collectionMapService;
@Autowired
private SysDictItemService sysDictItemService;
@Override @Override
...@@ -131,13 +134,13 @@ public class InformationServiceImpl implements InformationService { ...@@ -131,13 +134,13 @@ public class InformationServiceImpl implements InformationService {
DisplayInfo info = new DisplayInfo(); DisplayInfo info = new DisplayInfo();
BeanUtils.copyProperties(specialInformation,info); BeanUtils.copyProperties(specialInformation,info);
info.setPublishDate(EsDateUtil.esFieldDateMapping(info.getPublishDate())); info.setPublishDate(EsDateUtil.esFieldDateMapping(info.getPublishDate()));
LambdaQueryWrapper<CollectionMap> query = Wrappers.lambdaQuery(); /*LambdaQueryWrapper<CollectionMap> query = Wrappers.lambdaQuery();
query.eq(CollectionMap::getUserId, userVo.getId()); query.eq(CollectionMap::getUserId, userVo.getId());
query.eq(CollectionMap::getArticleId, info.getId()); query.eq(CollectionMap::getArticleId, info.getId());
int count = collectionMapService.count(query); int count = collectionMapService.count(query);
if (count > 0) { if (count > 0) {
info.setYnCollect(true); info.setYnCollect(true);
} }*/
//标签处理 //标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId()); List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId());
formatLabel(modelVoList, info); formatLabel(modelVoList, info);
...@@ -271,18 +274,16 @@ public class InformationServiceImpl implements InformationService { ...@@ -271,18 +274,16 @@ public class InformationServiceImpl implements InformationService {
String subjectId = manualAddVO.getSubjectId(); String subjectId = manualAddVO.getSubjectId();
String subjectName = manualAddVO.getSubjectName(); String subjectName = manualAddVO.getSubjectName();
String index = manualAddVO.getIndex(); String index = manualAddVO.getIndex();
Subjectdatabase subjectdatabase = (Subjectdatabase) esOpUtil.getInfoById(index, id, Subjectdatabase.class); SpecialInformation subjectdatabase = (SpecialInformation) esOpUtil.getInfoById(index, id, SpecialInformation.class);
String dataId = subjectId + id; String dataId = subjectId + id;
subjectdatabase.setId(dataId); subjectdatabase.setId(dataId);
LocalDateTime processDate = LocalDateTime.now(); subjectdatabase.setProcessDate(DateUtil.dateToString(new Date(), "yyyy-MM-dd'T'HH:mm:ss"));
subjectdatabase.setProcessDate(processDate);
subjectdatabase.setSubjectId(subjectId); subjectdatabase.setSubjectId(subjectId);
subjectdatabase.setSubjectName(subjectName); subjectdatabase.setSubjectName(subjectName);
subjectdatabase.setFlag("1"); subjectdatabase.setDeleteFlag(0);
subjectdatabase.setDeleteFlag(0L); subjectdatabase.setCheckStatus(0);
subjectdatabase.setCheckStatus(0L); subjectdatabase.setTopNum(0);
subjectdatabase.setTopNum(0L); esOpUtil.docSaveByJson(Constants.SUBJECT_INDEX + "_" + LocalDateTime.now().getYear(), dataId, JSON.toJSONString(subjectdatabase));
esOpUtil.docSaveByJson(Constants.SUBJECT_INDEX + "_" + processDate.getYear(), dataId, JSON.toJSONString(subjectdatabase));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -656,6 +657,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -656,6 +657,7 @@ public class InformationServiceImpl implements InformationService {
specialInformation.setSubjectId(subjectId); specialInformation.setSubjectId(subjectId);
specialInformation.setFlag("1"); specialInformation.setFlag("1");
specialInformation.setMasterEntryId(specialInformation.getId()); specialInformation.setMasterEntryId(specialInformation.getId());
specialInformation.setDataFrom(1);
//加上分类 //加上分类
setInfoSourceType(specialInformation); setInfoSourceType(specialInformation);
//判断是否需要审核 //判断是否需要审核
...@@ -680,6 +682,63 @@ public class InformationServiceImpl implements InformationService { ...@@ -680,6 +682,63 @@ public class InformationServiceImpl implements InformationService {
clbFileOperationLogService.saveEntity(clbFileOperationLog); clbFileOperationLogService.saveEntity(clbFileOperationLog);
} }
@Override
public void importDataInfo(List<List<String>> lists, String subjectId) {
if (CollectionUtil.isNotEmpty(lists)) {
String index = EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX);
List<SpecialInformation> dataList = new ArrayList<>();
for (List<String> info : lists) {
SpecialInformation specialInformation = new SpecialInformation();
specialInformation.setId(codeGenerateUtil.geneIdNo(Constants.DATA_ADD_ID, 8));
if (StringUtils.isNotEmpty(info.get(0))) {
specialInformation.setTitle(info.get(0));
}
if (StringUtils.isNotEmpty(info.get(1))) {
specialInformation.setAuthor(info.get(1));
}
if (StringUtils.isNotEmpty(info.get(2))) {
specialInformation.setOrigin(info.get(2));
specialInformation.setSid(info.get(2));
}
if (StringUtils.isNotEmpty(info.get(3))) {
String library = info.get(3);
SysDictItem dictItem = sysDictItemService.dictItemInfoByName("Thematic_Library", library);
if (dictItem != null) {
specialInformation.setClassificationType(Integer.parseInt(dictItem.getItemValue()));
} else {
specialInformation.setClassificationType(0);
}
} else {
specialInformation.setClassificationType(0);
}
if (StringUtils.isNotEmpty(info.get(4))) {
specialInformation.setSourceAddress(info.get(4));
}
if (StringUtils.isNotEmpty(info.get(5))) {
specialInformation.setPublishDate(EsDateUtil.esFieldDateFormat(info.get(5)));
}
if (StringUtils.isNotEmpty(info.get(6))) {
specialInformation.setContent(info.get(6));
}
specialInformation.setCheckStatus(1);
specialInformation.setDeleteFlag(0);
specialInformation.setTopNum(0);
specialInformation.setDataFrom(1);
specialInformation.setSubjectId(subjectId);
String format = DateUtil.dateToString(new Date(), "yyyy-MM-dd'T'HH:mm:ss");
specialInformation.setCreateDate(format);
specialInformation.setProcessDate(format);
//加上分类
setInfoSourceType(specialInformation);
//匹配标签
List<Label> labels = getInfoSourceLabel(specialInformation.getOrigin(), specialInformation.getSourceAddress());
specialInformation.setLabels(labels);
dataList.add(specialInformation);
}
esOpUtil.docSaveBulk(index, dataList);
}
}
private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) { private void formatLabel(List<LabelModelVo> labelModelVos, DisplayInfo info) {
if (CollectionUtils.isNotEmpty(labelModelVos)) { if (CollectionUtils.isNotEmpty(labelModelVos)) {
...@@ -768,7 +827,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -768,7 +827,7 @@ public class InformationServiceImpl implements InformationService {
//信息加上分类 //信息加上分类
public void setInfoSourceType(SpecialInformation data) { public void setInfoSourceType(SpecialInformation data) {
String url = Utility.domainURL(data.getSourceAddress()); String url = Utility.domainURL(data.getSourceAddress());
String typeNum = null; String typeNum;
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) {
typeNum = (String) redisUtil.get(Constants.SITE_NAME_KEY + url); typeNum = (String) redisUtil.get(Constants.SITE_NAME_KEY + url);
...@@ -780,4 +839,43 @@ public class InformationServiceImpl implements InformationService { ...@@ -780,4 +839,43 @@ public class InformationServiceImpl implements InformationService {
} }
data.setInfoSourceType(typeNum); data.setInfoSourceType(typeNum);
} }
private List<Label> getInfoSourceLabel(String origin,String sourceAddress){
List<String> sidList = new ArrayList<>();
if (StringUtils.isNotEmpty(origin)) {
LambdaQueryWrapper<InfoSource> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(InfoSource::getSiteName, origin);
InfoSource infoSource = infoSourceService.getOne(queryWrapper);
if (infoSource != null) {
String sid = infoSource.getId();
sidList.add(sid);
} else {
if (StringUtils.isNotEmpty(sourceAddress)) {
String url = Utility.domainURL(sourceAddress);
if (StringUtils.isNotEmpty(url)) {
LambdaQueryWrapper<InfoSource> query = Wrappers.lambdaQuery();
query.like(InfoSource::getSiteUri, url);
List<InfoSource> sourceList = infoSourceService.list(query);
if (CollectionUtils.isNotEmpty(sourceList)) {
sidList = sourceList.stream().map(InfoSource::getId).collect(Collectors.toList());
}
}
}
}
}
List<Label> labels = new ArrayList<>();
List<LabelItemMapVO> clbLabelItems = commonService.infoSourceLabelsBySidList(sidList);
Label label = new Label();
if (CollectionUtils.isNotEmpty(clbLabelItems)) {
LabelItemMapVO clbLabelItem = clbLabelItems.get(0);
label.setSourceId(clbLabelItem.getEntityCode());
label.setLabelMark(clbLabelItem.getLabelCode());
label.setRelationId(clbLabelItem.getLabelCode() + "-" +clbLabelItem.getLabelItemCode());
} else {//默认其他
label.setLabelMark("LABEL-20250102-0006");
label.setRelationId("LABEL-20250102-0006-LV-20250102-0026");
}
labels.add(label);
return labels;
}
} }
...@@ -239,9 +239,8 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -239,9 +239,8 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
@Override @Override
public IPage<KeyWordsPage> bindKeyWordsList(List<String> subjectIds, String groupName, String wordName, Integer pageNo, Integer pageSize) { public List<KeyWordsPage> bindKeyWordsList(List<String> subjectIds, String groupName, String wordName) {
Page<KeyWordsPage> page = new Page<>(pageNo, pageSize); return baseMapper.bindKeyWordsList(subjectIds, groupName, wordName);
return baseMapper.bindKeyWordsList(subjectIds, groupName, wordName, page);
} }
@Override @Override
......
...@@ -12,7 +12,6 @@ import com.zzsn.event.mapper.ScoreModelMapper; ...@@ -12,7 +12,6 @@ import com.zzsn.event.mapper.ScoreModelMapper;
import com.zzsn.event.service.CommonService; import com.zzsn.event.service.CommonService;
import com.zzsn.event.service.ISubjectInfoSourceMapService; import com.zzsn.event.service.ISubjectInfoSourceMapService;
import com.zzsn.event.service.ScoreModelService; import com.zzsn.event.service.ScoreModelService;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.vo.InfoSourceGroupPage; import com.zzsn.event.vo.InfoSourceGroupPage;
import com.zzsn.event.vo.ScoreModelVo; import com.zzsn.event.vo.ScoreModelVo;
import com.zzsn.event.vo.SubjectScoreModel; import com.zzsn.event.vo.SubjectScoreModel;
...@@ -21,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -51,7 +49,7 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo ...@@ -51,7 +49,7 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo
ScoreModel scoreModelNew = new ScoreModel(); ScoreModel scoreModelNew = new ScoreModel();
BeanUtils.copyProperties(scoreModel, scoreModelNew); BeanUtils.copyProperties(scoreModel, scoreModelNew);
baseMapper.insert(scoreModelNew); baseMapper.insert(scoreModelNew);
if (scoreModel.getChangeType() == 1) { /*if (scoreModel.getChangeType() == 1) {
JSONObject jsonObject = commonService.siteInfo(scoreModel.getSubjectId(), scoreModel.getType(),category); JSONObject jsonObject = commonService.siteInfo(scoreModel.getSubjectId(), scoreModel.getType(),category);
//调用python接口 //调用python接口
try { try {
...@@ -59,7 +57,7 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo ...@@ -59,7 +57,7 @@ public class ScoreModelServiceImpl extends ServiceImpl<ScoreModelMapper, ScoreMo
} catch (IOException e) { } catch (IOException e) {
log.error("传递专题配置信息异常!"); log.error("传递专题配置信息异常!");
} }
} }*/
} }
@Override @Override
......
...@@ -24,7 +24,6 @@ import com.zzsn.event.util.CodeGenerateUtil; ...@@ -24,7 +24,6 @@ import com.zzsn.event.util.CodeGenerateUtil;
import com.zzsn.event.util.CronUtil; import com.zzsn.event.util.CronUtil;
import com.zzsn.event.util.HttpUtil; import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.RedisUtil; import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.user.AuthUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*; import com.zzsn.event.vo.*;
...@@ -39,6 +38,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -39,6 +38,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -89,6 +91,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -89,6 +91,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Value("${python.subjectProcessorUrl}") @Value("${python.subjectProcessorUrl}")
private String subjectProcessorUrl; private String subjectProcessorUrl;
@Value("${clb.subject.default.processing.advanceMonth}")
private Integer defaultAdvanceMonth;
@Override @Override
...@@ -163,6 +167,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -163,6 +167,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
subject.setSubjectCode(subjectCode); subject.setSubjectCode(subjectCode);
String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace()); String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace());
subject.setCron(cron); subject.setCron(cron);
subject.setEstimateStatus("未启用");
baseMapper.insert(subject); baseMapper.insert(subject);
//插入专题-类别、项目的绑定关系 //插入专题-类别、项目的绑定关系
saveMapMain(subject, subjectPage); saveMapMain(subject, subjectPage);
...@@ -172,6 +177,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -172,6 +177,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Override @Override
@Transactional @Transactional
public void updateMain(SubjectPage subjectPage) { public void updateMain(SubjectPage subjectPage) {
Subject oldSubject = this.getById(subjectPage.getId());
Subject subject = new Subject(); Subject subject = new Subject();
BeanUtils.copyProperties(subjectPage, subject); BeanUtils.copyProperties(subjectPage, subject);
String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace()); String cron = CronUtil.generateCron(subject.getUnit(), subject.getSpace());
...@@ -183,28 +189,43 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -183,28 +189,43 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
projectSubjectMapService.deleteBySubjectId(subject.getId()); projectSubjectMapService.deleteBySubjectId(subject.getId());
//插入新的 //插入新的
saveMapMain(subject, subjectPage); saveMapMain(subject, subjectPage);
//修改redis缓存,,用于向专题里补充数据
updateRedisCache(subject, oldSubject);
} }
@Override @Override
public void updateStatus(Subject subject) { public void updateStatus(Subject subject) {
LambdaUpdateWrapper<Subject> updateWrapper = Wrappers.lambdaUpdate(); LambdaUpdateWrapper<Subject> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.set(Subject::getStatus,subject.getStatus()).eq(Subject::getId,subject.getId()); String subjectId = subject.getId();
Integer status = subject.getStatus();
updateWrapper.set(Subject::getStatus, status).eq(Subject::getId, subjectId);
if (subject.getStatus() == 1) {
//判断是否第一次启用
Subject byId = this.getById(subjectId);
if (byId.getFirstOpenTime() == null) {
updateWrapper.set(Subject::getFirstOpenTime, new Date());
updateWrapper.set(Subject::getEstimateStatus, "预估中");
//第一次启用时,添加redis缓存,,用于向专题里进数据
setRedisCache(subjectId);
}
}
this.update(updateWrapper); this.update(updateWrapper);
CompletableFuture.runAsync(()->{ //和python沟通,这块没用了
Integer status = subject.getStatus(); /*CompletableFuture.runAsync(()->{
if (status == 1) { if (status == 1) {
send(subject.getId(), "1"); send(subject.getId(), "1");
} else if (status == 0) { } else if (status == 0) {
//向python发起停止处理请求 //向python发起停止处理请求
send(subject.getId(), "0"); send(subject.getId(), "0");
} }
}); });*/
} }
@Override @Override
public void deleteMain(String subjectId) { public void deleteMain(String subjectId) {
baseMapper.deleteById(subjectId); baseMapper.deleteById(subjectId);
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(() -> {
//删除与类别的映射 //删除与类别的映射
subjectTypeMapService.deleteBySubjectId(subjectId); subjectTypeMapService.deleteBySubjectId(subjectId);
//删除与信息源的关联关系 //删除与信息源的关联关系
...@@ -220,7 +241,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -220,7 +241,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
//删除专题/事件-tpu流程关系 //删除专题/事件-tpu流程关系
clbModelArrangeSubjectMapService.remove(Wrappers.<ClbModelArrangeSubjectMap>lambdaQuery().eq(ClbModelArrangeSubjectMap::getSubjectId, subjectId)); clbModelArrangeSubjectMapService.remove(Wrappers.<ClbModelArrangeSubjectMap>lambdaQuery().eq(ClbModelArrangeSubjectMap::getSubjectId, subjectId));
//向python发送消息结束 //向python发送消息结束
send(subjectId, "-1"); //send(subjectId, "-1");
}); });
} }
...@@ -325,17 +346,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -325,17 +346,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
List<String> deleteKeyWordsIds = subjectPage.getKeyWordsIds(); List<String> deleteKeyWordsIds = subjectPage.getKeyWordsIds();
if (deleteKeyWordsIds != null && !deleteKeyWordsIds.isEmpty()) { if (deleteKeyWordsIds != null && !deleteKeyWordsIds.isEmpty()) {
subjectKeywordsMapService.remove(Wrappers.<SubjectKeywordsMap>lambdaQuery() subjectKeywordsMapService.remove(Wrappers.<SubjectKeywordsMap>lambdaQuery()
.eq(SubjectKeywordsMap::getSubjectId,subjectPage.getId()).in(SubjectKeywordsMap::getKeywordsId,deleteKeyWordsIds) .eq(SubjectKeywordsMap::getSubjectId, subjectPage.getId()).in(SubjectKeywordsMap::getKeywordsId, deleteKeyWordsIds)
.eq(StrUtil.isNotBlank(subjectPage.getBindingType()),SubjectKeywordsMap::getBindingType,subjectPage.getBindingType()) .eq(StrUtil.isNotBlank(subjectPage.getBindingType()), SubjectKeywordsMap::getBindingType, subjectPage.getBindingType())
); );
//清redis里面的绑定关系(包括专题信息,以及搜索引擎) //清redis里面的绑定关系(包括专题信息,以及搜索引擎)
for (String keyWordsId : deleteKeyWordsIds) { for (String keyWordsId : deleteKeyWordsIds) {
KeyWordsPage keyWordsPage = keyWordsService.getKeyWordsById(keyWordsId); KeyWordsPage keyWordsPage = keyWordsService.getKeyWordsById(keyWordsId);
KeyWordsDTO keyWordsDTO = (KeyWordsDTO) redisUtil.get(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWordsPage.getWordsCode()); redisUtil.del(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWordsPage.getWordsCode());
keyWordsDTO.setStartTime(null);
keyWordsDTO.setEndTime(null);
keyWordsDTO.setSearchEngines(null);
redisUtil.set(Constants.KEY_WORDS_TO_REDIS_PREFIX + keyWordsPage.getWordsCode(), keyWordsDTO);
} }
} }
} }
...@@ -355,12 +372,6 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -355,12 +372,6 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
subjectSearchEnginesMapService.saveBatch(mapList); subjectSearchEnginesMapService.saveBatch(mapList);
} }
//查询出该专题绑定的关键词组
List<KeyWordsPage> keyWordsPages = commonService.selectKeyWordsListById(subjectPage.getId());
List<String> keyWordIds = new ArrayList<>();
for (KeyWordsPage keyWordsPage : keyWordsPages) {
keyWordIds.add(keyWordsPage.getId());
}
} }
@Override @Override
...@@ -379,13 +390,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -379,13 +390,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
List<SubjectModelMap> mapList = new ArrayList<>(); List<SubjectModelMap> mapList = new ArrayList<>();
List<String> hisModelids = new ArrayList<>(); List<String> hisModelids = new ArrayList<>();
List<PythonModelVo> models = subjectPage.getModels(); List<PythonModelVo> models = subjectPage.getModels();
if (CollUtil.isEmpty(models)){ if (CollUtil.isEmpty(models)) {
return Result.FAIL(500,"请至少配置一个模型"); return Result.FAIL(500, "请至少配置一个模型");
} }
for (PythonModelVo model : models) { for (PythonModelVo model : models) {
Integer detailType = model.getDetailType(); Integer detailType = model.getDetailType();
if (cn.hutool.core.util.ObjectUtil.isEmpty(detailType)){ if (ObjectUtil.isEmpty(detailType)) {
return Result.FAIL(501,"请勾选"+model.getModelName()+"的作用范围"); return Result.FAIL(501, "请勾选" + model.getModelName() + "的作用范围");
} }
} }
if (CollUtil.isNotEmpty(models)) { if (CollUtil.isNotEmpty(models)) {
...@@ -396,13 +407,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -396,13 +407,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
.eq(ClbSubjectModelDetailTask::getSubjectId, subjectPage.getId()).eq(ClbSubjectModelDetailTask::getTaskStatus, 1) .eq(ClbSubjectModelDetailTask::getSubjectId, subjectPage.getId()).eq(ClbSubjectModelDetailTask::getTaskStatus, 1)
); );
if (CollUtil.isNotEmpty(list)){ if (CollUtil.isNotEmpty(list)) {
//有正在处理的任务 //有正在处理的任务
for (ClbSubjectModelDetailTask clbSubjectModelDetailTask : list) { for (ClbSubjectModelDetailTask clbSubjectModelDetailTask : list) {
String modelIds = clbSubjectModelDetailTask.getModelIds(); String modelIds = clbSubjectModelDetailTask.getModelIds();
List<String> list1 = Arrays.asList(modelIds.split(",")); List<String> list1 = Arrays.asList(modelIds.split(","));
for (PythonModelVo model : liShi) { for (PythonModelVo model : liShi) {
if (list1.contains(model.getId())){ if (list1.contains(model.getId())) {
return Result.FAIL(201, JSONUtil.toJsonStr(clbSubjectModelDetailTask)); return Result.FAIL(201, JSONUtil.toJsonStr(clbSubjectModelDetailTask));
} }
} }
...@@ -413,11 +424,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -413,11 +424,11 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
.eq(SubjectModelMap::getSubjectId, subjectPage.getId()) .eq(SubjectModelMap::getSubjectId, subjectPage.getId())
); );
//判断提取任务模型中的增量和全量数据,插入关系配置表 //判断提取任务模型中的增量和全量数据,插入关系配置表
if (CollectionUtil.isNotEmpty(zengLiang)){ if (CollectionUtil.isNotEmpty(zengLiang)) {
if (CollectionUtil.isNotEmpty(bind)){ if (CollectionUtil.isNotEmpty(bind)) {
List<PythonModelVo> saves = zengLiang.stream().filter(f -> !bind.stream().map(SubjectModelMap::getModelId).collect(Collectors.toList()).contains(f.getId())).collect(Collectors.toList()); List<PythonModelVo> saves = zengLiang.stream().filter(f -> !bind.stream().map(SubjectModelMap::getModelId).collect(Collectors.toList()).contains(f.getId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(saves)) { if (CollectionUtil.isNotEmpty(saves)) {
saves.forEach(e->{ saves.forEach(e -> {
SubjectModelMap subjectModelMap = new SubjectModelMap(); SubjectModelMap subjectModelMap = new SubjectModelMap();
subjectModelMap.setModelId(e.getId()); subjectModelMap.setModelId(e.getId());
subjectModelMap.setSubjectId(subjectPage.getId()); subjectModelMap.setSubjectId(subjectPage.getId());
...@@ -427,8 +438,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -427,8 +438,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}); });
subjectModelMapService.saveBatch(mapList); subjectModelMapService.saveBatch(mapList);
} }
}else { } else {
zengLiang.forEach(e->{ zengLiang.forEach(e -> {
SubjectModelMap subjectModelMap = new SubjectModelMap(); SubjectModelMap subjectModelMap = new SubjectModelMap();
subjectModelMap.setModelId(e.getId()); subjectModelMap.setModelId(e.getId());
subjectModelMap.setSubjectId(subjectPage.getId()); subjectModelMap.setSubjectId(subjectPage.getId());
...@@ -442,8 +453,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -442,8 +453,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
if (CollectionUtil.isNotEmpty(liShi)) { if (CollectionUtil.isNotEmpty(liShi)) {
liShi.forEach(e->{ liShi.forEach(e -> {
if (ObjectUtil.isNotEmpty(e.getDetailType()) && e.getDetailType() != 0){ if (ObjectUtil.isNotEmpty(e.getDetailType()) && e.getDetailType() != 0) {
hisModelids.add(e.getId()); hisModelids.add(e.getId());
} }
}); });
...@@ -451,9 +462,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -451,9 +462,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
//模型中如有历史数据处理任务则发起任务 //模型中如有历史数据处理任务则发起任务
if (CollectionUtil.isNotEmpty(hisModelids)){ if (CollectionUtil.isNotEmpty(hisModelids)) {
List<AlgorithmModel> modelInfos = modelService.list(Wrappers.<AlgorithmModel>lambdaQuery() List<AlgorithmModel> modelInfos = modelService.list(Wrappers.<AlgorithmModel>lambdaQuery()
.select(AlgorithmModel::getId,AlgorithmModel::getType,AlgorithmModel::getName,AlgorithmModel::getServiceName) .select(AlgorithmModel::getId, AlgorithmModel::getType, AlgorithmModel::getName, AlgorithmModel::getServiceName)
.in(AlgorithmModel::getId, hisModelids)); .in(AlgorithmModel::getId, hisModelids));
//处理历史 //处理历史
ClbSubjectModelDetailTask task = new ClbSubjectModelDetailTask(); ClbSubjectModelDetailTask task = new ClbSubjectModelDetailTask();
...@@ -479,24 +490,24 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -479,24 +490,24 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
task.setTaskParam(JSONUtil.toJsonStr(modelInfos)); task.setTaskParam(JSONUtil.toJsonStr(modelInfos));
task.setAllParam(JSONUtil.toJsonStr(subjectPage)); task.setAllParam(JSONUtil.toJsonStr(subjectPage));
subjectModelDetailTaskService.save(task); subjectModelDetailTaskService.save(task);
kafkaTemplate.send("subjectModelDetail",JSONUtil.toJsonStr(task)); kafkaTemplate.send("subjectModelDetail", JSONUtil.toJsonStr(task));
return Result.OK(task); return Result.OK(task);
} }
return Result.OK(); return Result.OK();
} }
private Map<String,Integer> codeMap = new HashMap<>(); private Map<String, Integer> codeMap = new HashMap<>();
@Override @Override
public Result<?> checkIsBreak(SubjectPage subjectPage) { public Result<?> checkIsBreak(SubjectPage subjectPage) {
List<PythonModelVo> models = subjectPage.getModels(); List<PythonModelVo> models = subjectPage.getModels();
if (CollectionUtil.isEmpty(models)) { if (CollectionUtil.isEmpty(models)) {
return Result.FAIL(500,"请至少配置一个模型"); return Result.FAIL(500, "请至少配置一个模型");
} }
for (PythonModelVo model : models) { for (PythonModelVo model : models) {
Integer detailType = model.getDetailType(); Integer detailType = model.getDetailType();
if (ObjectUtil.isEmpty(detailType)) { if (ObjectUtil.isEmpty(detailType)) {
return Result.FAIL(501,"请勾选" + model.getModelName() + "的作用范围"); return Result.FAIL(501, "请勾选" + model.getModelName() + "的作用范围");
} }
} }
List<PythonModelVo> liShi = models.stream().filter(f -> ObjectUtil.isNotEmpty(f.getDetailType()) && (f.getDetailType() == 1 || f.getDetailType() == 2)).collect(Collectors.toList()); List<PythonModelVo> liShi = models.stream().filter(f -> ObjectUtil.isNotEmpty(f.getDetailType()) && (f.getDetailType() == 1 || f.getDetailType() == 2)).collect(Collectors.toList());
...@@ -507,21 +518,21 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -507,21 +518,21 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
String code = ""; String code = "";
String s = cn.hutool.core.date.DateUtil.formatDate(new Date()); String s = cn.hutool.core.date.DateUtil.formatDate(new Date());
if (ObjectUtil.isEmpty(codeMap.get(s))){ if (ObjectUtil.isEmpty(codeMap.get(s))) {
codeMap = new HashMap<>(); codeMap = new HashMap<>();
codeMap.put(s,1); codeMap.put(s, 1);
code = s+" 00"+1; code = s + " 00" + 1;
}else { } else {
codeMap.put(s,codeMap.get(s)+1); codeMap.put(s, codeMap.get(s) + 1);
code = s +" 00" + +codeMap.get(s); code = s + " 00" + +codeMap.get(s);
} }
if (CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)) {
//有正在处理的任务 //有正在处理的任务
for (ClbSubjectModelDetailTask clbSubjectModelDetailTask : list) { for (ClbSubjectModelDetailTask clbSubjectModelDetailTask : list) {
String modelIds = clbSubjectModelDetailTask.getModelIds(); String modelIds = clbSubjectModelDetailTask.getModelIds();
List<String> list1 = Arrays.asList(modelIds.split(",")); List<String> list1 = Arrays.asList(modelIds.split(","));
for (PythonModelVo model : liShi) { for (PythonModelVo model : liShi) {
if (list1.contains(model.getId())){ if (list1.contains(model.getId())) {
Result<Object> error = Result.FAIL(201, "此次任务中的模型处理,有部分模型已经存在于其他任务中,并且未执行完毕"); Result<Object> error = Result.FAIL(201, "此次任务中的模型处理,有部分模型已经存在于其他任务中,并且未执行完毕");
error.setResult(clbSubjectModelDetailTask); error.setResult(clbSubjectModelDetailTask);
return error; return error;
...@@ -537,10 +548,10 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -537,10 +548,10 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Override @Override
public void send(String subjectId, String status) { public void send(String subjectId, String status) {
Subject subjectById = this.getById(subjectId); Subject subjectById = this.getById(subjectId);
if(ObjectUtil.isEmpty(subjectById) || subjectById.getCreateTime().after(DateTime.of("2023-11-30","yyyy-MM-dd"))){ if (ObjectUtil.isEmpty(subjectById) || subjectById.getCreateTime().after(DateTime.of("2023-11-30", "yyyy-MM-dd"))) {
return; return;
} }
JSONObject jsonObject = commonService.siteInfo(subjectId, null,1); JSONObject jsonObject = commonService.siteInfo(subjectId, null, 1);
if ("1".equals(status)) { if ("1".equals(status)) {
jsonObject.put("subjectStatus", "1"); jsonObject.put("subjectStatus", "1");
} else if ("0".equals(status)) { } else if ("0".equals(status)) {
...@@ -551,13 +562,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -551,13 +562,13 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
jsonObject.put("subjectStatusDetails", ""); jsonObject.put("subjectStatusDetails", "");
//调用python接口 //调用python接口
try { try {
Map<String,String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json;charset=UTF-8"); headers.put("Content-Type", "application/json;charset=UTF-8");
headers.put("Accept", "application/json"); headers.put("Accept", "application/json");
headers.put("Authorization", "!0gwY$5S@5V&A_+XEu)"); headers.put("Authorization", "!0gwY$5S@5V&A_+XEu)");
HttpUtil.doPostWithHeader(subjectProcessorUrl, jsonObject, 3000,headers); HttpUtil.doPostWithHeader(subjectProcessorUrl, jsonObject, 3000, headers);
} catch (IOException e) { } catch (IOException e) {
log.error("传递专题配置信息异常!{}",e.getMessage(),e); log.error("传递专题配置信息异常!{}", e.getMessage(), e);
} }
} }
...@@ -577,5 +588,95 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -577,5 +588,95 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
} }
/**
* 将专题的时间范围存入redis缓存(专题第一次启用时生效)
*
* @param subjectId 专题
* @author lkg
* @date 2025/2/7
*/
private void setRedisCache(String subjectId) {
Subject subject = this.getById(subjectId);
Date timeEnable = subject.getTimeEnable();
Date timeDisable = subject.getTimeDisable();
//date 转 localdate
LocalDate start;
LocalDate end;
if (ObjectUtil.isNull(timeEnable)) {
start = LocalDate.now().minusMonths(defaultAdvanceMonth);
} else {
start = timeEnable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
if (ObjectUtil.isNull(timeDisable)) {
end = LocalDate.now();
} else {
end = timeDisable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
//循环 start 到 end 的每一天
List<String> dateList = new ArrayList<>();
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
// 在这里处理每一天的逻辑
//格式化date成字符串
String format = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
dateList.add(format);
}
redisUtil.rpushMultipleValues(Constants.HISTORY_DATE_QUEUE + subject.getSubjectCode(), dateList.toArray(new String[0]));
}
/**
* 修改专题时间缓存,用于补充数据(只有启用过的专题才会起作用)
*
* @param subject 新专题信息
* @param oldSubject 旧专题信息
* @author lkg
* @date 2025/2/7
*/
private void updateRedisCache(Subject subject, Subject oldSubject) {
Date firstOpenTime = oldSubject.getFirstOpenTime();
if (firstOpenTime != null) {
Date oldTimeEnable = oldSubject.getTimeEnable();
Date oldTimeDisable = oldSubject.getTimeDisable();
LocalDate oldStart;
LocalDate oldEnd;
if (ObjectUtil.isNull(oldTimeEnable)) {
oldStart = firstOpenTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().minusMonths(defaultAdvanceMonth);
} else {
oldStart = oldTimeEnable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
if (ObjectUtil.isNull(oldTimeDisable)) {
oldEnd = LocalDate.now();
} else {
oldEnd = oldTimeDisable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
Date timeEnable = subject.getTimeEnable();
Date timeDisable = subject.getTimeDisable();
if (timeEnable != null || timeDisable != null) {
List<String> newDateList = new ArrayList<>();
if (timeEnable != null) {
LocalDate start = timeEnable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (start.isBefore(oldStart)) {
for (LocalDate date = start; date.isBefore(oldStart); date = date.plusDays(1)) {
// 在这里处理每一天的逻辑
//格式化date成字符串
String format = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
newDateList.add(format);
}
}
}
if (timeDisable != null) {
LocalDate end = timeDisable.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (end.isAfter(oldEnd)) {
for (LocalDate date = oldEnd.plusDays(1); !date.isAfter(end); date = date.plusDays(1)) {
// 在这里处理每一天的逻辑
//格式化date成字符串
String format = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
newDateList.add(format);
}
}
}
redisUtil.rpushMultipleValues(Constants.HISTORY_DATE_QUEUE + subject.getSubjectCode(), newDateList.toArray(new String[0]));
}
}
}
} }
...@@ -3,7 +3,9 @@ package com.zzsn.event.service.impl; ...@@ -3,7 +3,9 @@ package com.zzsn.event.service.impl;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
import com.zzsn.event.enums.CodePrefixEnum; import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.es.EsService; import com.zzsn.event.es.EsService;
...@@ -14,8 +16,11 @@ import com.zzsn.event.vo.*; ...@@ -14,8 +16,11 @@ import com.zzsn.event.vo.*;
import com.zzsn.event.vo.es.SpecialInformation; import com.zzsn.event.vo.es.SpecialInformation;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -56,6 +61,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -56,6 +61,8 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private ISubjectModelMapService subjectModelMapService; private ISubjectModelMapService subjectModelMapService;
@Autowired @Autowired
private ScoreModelService scoreModelService; private ScoreModelService scoreModelService;
@Autowired
private IInfoSourceService infoSourceService;
@Autowired @Autowired
private EsService esService; private EsService esService;
...@@ -65,9 +72,12 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -65,9 +72,12 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private CodeGenerateUtil codeGenerateUtil; private CodeGenerateUtil codeGenerateUtil;
//关键词默认分类 //关键词默认分类
private final static String KEYWORDS_TYPE_ID = "1476498704680194050"; private static final String KEYWORDS_TYPE_ID = "1476498704680194050";
//默认项目 //默认项目
private final static String PROJECT_ID = "1476527644425682945"; private static final String PROJECT_ID = "1476527644425682945";
//默认绑定TPU流程
private static final String[] DEFAULT_ARRANGE_ID = {"1877652205629173761","1887695061047672834"};
@Override @Override
@Transactional @Transactional
...@@ -81,11 +91,15 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -81,11 +91,15 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
List<SearchWordVO> keywords = subjectSimpleVO.getKeywords(); List<SearchWordVO> keywords = subjectSimpleVO.getKeywords();
modifyKeyword(subjectId, subject.getSubjectName(), keywords); modifyKeyword(subjectId, subject.getSubjectName(), keywords);
//默认绑定tpu流程 //默认绑定tpu流程
ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap(); List<ClbModelArrangeSubjectMap> tpuList = new ArrayList<>();
tpu.setSubjectId(subject.getId()); for (String arrangeId : DEFAULT_ARRANGE_ID) {
tpu.setArrangeId("1877652205629173761"); ClbModelArrangeSubjectMap tpu = new ClbModelArrangeSubjectMap();
tpu.setType("baseDateToSubject"); tpu.setSubjectId(subject.getId());
clbModelArrangeSubjectMapService.save(tpu); tpu.setArrangeId(arrangeId);
tpu.setType("baseDateToSubject");
tpuList.add(tpu);
}
clbModelArrangeSubjectMapService.saveBatch(tpuList);
//默认通用打分配置 //默认通用打分配置
String defaultConfig = "[{\"id\": \"1-1\", \"name\": \"信息源组\", \"children\": [], \"indexWeight\": 10}, {\"id\": \"1-2\", \"name\": \"文章长度\", \"indexWeight\": 15, \"keyWordsTopLimit\": 2500, \"keyWordsLowerLimit\": 500}, {\"id\": \"1-3\", \"name\": \"内容\", \"children\": [{\"id\": \"1-3-1\", \"name\": \"内容-关键词\", \"keyWords\": \"KEY_WORD\", \"indexWeight\": 75, \"titleWeight\": 10, \"keyWordsTopLimit\": 15, \"keyWordsLowerLimit\": 3}]}]"; String defaultConfig = "[{\"id\": \"1-1\", \"name\": \"信息源组\", \"children\": [], \"indexWeight\": 10}, {\"id\": \"1-2\", \"name\": \"文章长度\", \"indexWeight\": 15, \"keyWordsTopLimit\": 2500, \"keyWordsLowerLimit\": 500}, {\"id\": \"1-3\", \"name\": \"内容\", \"children\": [{\"id\": \"1-3-1\", \"name\": \"内容-关键词\", \"keyWords\": \"KEY_WORD\", \"indexWeight\": 75, \"titleWeight\": 10, \"keyWordsTopLimit\": 15, \"keyWordsLowerLimit\": 3}]}]";
List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList()); List<SearchWordVO> collect = keywords.stream().filter(searchWordVO -> !"NOT".equalsIgnoreCase(searchWordVO.getSearchLogicRelationship())).collect(Collectors.toList());
...@@ -101,6 +115,125 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -101,6 +115,125 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
} }
@Override @Override
public Boolean configVerification(SubjectParamsCheckVO subjectParamsCheckVO) {
SubjectSimpleVO subjectSimpleVO = subjectParamsCheckVO.getSubjectSimpleVO();
String subjectId = subjectSimpleVO.getId();
SubjectDetailVO subjectDetailVO = queryInfo(subjectId);
Date firstOpenTime = subjectDetailVO.getFirstOpenTime();
//未启用过的可以直接修改,校验通过
if (firstOpenTime == null) {
return true;
} else {
//判断数据来源和资讯类型是否变化,变化则校验不通过;反之不通过
if (!subjectSimpleVO.getDataSource().equals(subjectDetailVO.getDataSource()) || !subjectSimpleVO.getLibrary().equals(subjectDetailVO.getLibrary())) {
return false;
}
//判断时间范围是否增加(新时间范围完全包含旧时间范围 标识增加),增加则校验通过,反之不通过
if (!(subjectSimpleVO.getTimeEnable().before(subjectDetailVO.getTimeEnable()) && subjectSimpleVO.getTimeDisable().after(subjectDetailVO.getTimeDisable()))) {
return false;
}
//判断关键词配置是否变化
List<SearchWordVO> keywordsNew = subjectSimpleVO.getKeywords();
List<SearchWordVO> keywordsOld = subjectDetailVO.getKeywords();
boolean judgeKeyword = judgeKeyword(keywordsNew, keywordsOld);
if (judgeKeyword) {
return false;
}
//判断信息源配置是否变化
boolean judgeInfoSource = judgeInfoSource(subjectId, subjectParamsCheckVO.getSubjectSourceTagVO(), subjectParamsCheckVO.getInfoSourceWebSiteNames(), subjectParamsCheckVO.getInfoSourceIds());
return !judgeInfoSource;
}
}
/**
* 判断关键词是否发生变化 true 是;false 否
*
* @param keywordsNew 新词(编辑时前端传参)
* @param keywordsOld 旧词(已入库)
* @author lkg
* @date 2025/2/5
*/
public boolean judgeKeyword(List<SearchWordVO> keywordsNew, List<SearchWordVO> keywordsOld) {
boolean flag = false;
//判断是否存在词组id为空的数据,有的发生变化;无则继续判断内容
boolean present = keywordsNew.stream().anyMatch(searchWordVO -> StringUtils.isBlank(searchWordVO.getId()));
if (present) {
flag = true;
} else if (keywordsNew.size() == keywordsOld.size()) {
Map<String, SearchWordVO> oldMap = keywordsOld.stream().collect(Collectors.toMap(SearchWordVO::getId, searchWordVO -> searchWordVO));
for (SearchWordVO searchWordVO : keywordsNew) {
if (oldMap.containsKey(searchWordVO.getId())) {
SearchWordVO old = oldMap.get(searchWordVO.getId());
if (!(old.getSearchInfo().equals(searchWordVO.getSearchInfo())
&& old.getSearchLogicRelationship().equals(searchWordVO.getSearchLogicRelationship())
&& old.getSearchScope().equals(searchWordVO.getSearchScope()))) {
flag = true;
}
} else {
flag = true;
}
if (flag) {
break;
}
}
}
return flag;
}
/**
* 判断信息源配置是否发生变化 true 是;false 否
*
* @param subjectId 专题id
* @param subjectSourceTagVO 信息源标签信息(编辑时前端传参)
* @param infoSourceWebSiteNames 定向信息源名称集合(编辑时前端传参)
* @param infoSourceIds 推荐信息源id集合(编辑时前端传参)
* @author lkg
* @date 2025/2/5
*/
private boolean judgeInfoSource(String subjectId,SubjectSourceTagVO subjectSourceTagVO,List<String> infoSourceWebSiteNames,List<String> infoSourceIds){
boolean flag = false;
LambdaQueryWrapper<SubjectInfoSourceMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectInfoSourceMap::getSubjectId, subjectId);
List<SubjectInfoSourceMap> mapList = subjectInfoSourceMapService.list(queryWrapper);
//判断是否已存在信息源配置
if (CollectionUtils.isEmpty(mapList)) {
if (subjectSourceTagVO != null || CollectionUtils.isNotEmpty(infoSourceWebSiteNames) || CollectionUtils.isNotEmpty(infoSourceIds)) {
flag = true;
}
} else {
//判断 是否绑定信息源标签
Set<String> sourceLabelCodeSet = mapList.stream().filter(e -> e.getType() == 12).map(SubjectInfoSourceMap::getSourceItemId).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(sourceLabelCodeSet)) {
if (subjectSourceTagVO != null) {
Set<String> labelItemCodeSetAll = new HashSet<>();
List<InfoSourceLabelVO> labelList = subjectSourceTagVO.getLabelList();
for (InfoSourceLabelVO infoSourceLabelVO : labelList) {
List<InfoSourceLabelItemVO> infoSourceLabelItemList = infoSourceLabelVO.getInfoSourceLabelItemList();
Set<String> labelItemCodeSet = infoSourceLabelItemList.stream().map(InfoSourceLabelItemVO::getLabelItemCode).collect(Collectors.toSet());
labelItemCodeSetAll.addAll(labelItemCodeSet);
}
if (!sourceLabelCodeSet.equals(labelItemCodeSetAll)) {
flag = true;
}
} else {
flag = true;
}
} else {
//判断 信息源绑定是否变化
Set<String> sourceIdSet = mapList.stream().filter(e -> e.getType() == 1).map(SubjectInfoSourceMap::getSourceId).collect(Collectors.toSet());
Set<String> sourceColumnSet = infoSourceService.directSourceColumnSet(infoSourceWebSiteNames);
sourceColumnSet.addAll(infoSourceIds);
if (!sourceIdSet.equals(sourceColumnSet)) {
flag = true;
}
}
}
return flag;
}
@Override
@Transactional @Transactional
public void editSubject(SubjectSimpleVO subjectSimpleVO) { public void editSubject(SubjectSimpleVO subjectSimpleVO) {
SubjectPage subjectPage = new SubjectPage(); SubjectPage subjectPage = new SubjectPage();
...@@ -197,7 +330,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -197,7 +330,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
//删除专题/事件-tpu流程关系 //删除专题/事件-tpu流程关系
clbModelArrangeSubjectMapService.remove(Wrappers.<ClbModelArrangeSubjectMap>lambdaQuery().eq(ClbModelArrangeSubjectMap::getSubjectId, subjectId)); clbModelArrangeSubjectMapService.remove(Wrappers.<ClbModelArrangeSubjectMap>lambdaQuery().eq(ClbModelArrangeSubjectMap::getSubjectId, subjectId));
//向python发送消息结束 //向python发送消息结束
subjectService.send(subjectId, "-1"); //subjectService.send(subjectId, "-1");
}); });
} }
...@@ -261,6 +394,22 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -261,6 +394,22 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
updateMap.forEach((k, v) -> esOpUtil.docUpdateBulk(k, v)); updateMap.forEach((k, v) -> esOpUtil.docUpdateBulk(k, v));
} }
@Override
public void clearSubjectData(String subjectId) {
LambdaUpdateWrapper<Subject> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.eq(Subject::getId, subjectId)
.set(Subject::getStatus, 0)
.set(Subject::getFirstOpenTime, null)
.set(Subject::getEstimateStatus, null);
subjectService.update(updateWrapper);
//todo 调用python接口
CompletableFuture.runAsync(() -> {
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termQuery("subjectId.keyword", subjectId));
esOpUtil.docDeleteByQuery(Constants.SUBJECT_INDEX, boolQuery);
});
}
//目标集合按照另一个集合的顺序排序 //目标集合按照另一个集合的顺序排序
private void sortByAnotherList(List<SearchWordVO> list, List<String> anotherList) { private void sortByAnotherList(List<SearchWordVO> list, List<String> anotherList) {
list.sort((o1, o2) -> { list.sort((o1, o2) -> {
......
...@@ -127,7 +127,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje ...@@ -127,7 +127,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
queryWrapper.eq(SubjectType::getCategory, category).orderByAsc(SubjectType::getCreateTime); queryWrapper.eq(SubjectType::getCategory, category).orderByAsc(SubjectType::getCreateTime);
List<SubjectType> allList = list(queryWrapper); List<SubjectType> allList = list(queryWrapper);
if (CollectionUtils.isNotEmpty(allList)) { if (CollectionUtils.isNotEmpty(allList)) {
//绑定专题/事件的分类 //绑定专题/事件的分类
List<SubjectTypeTreeVO> subjectTypeTreeVOS = baseMapper.typeBindCountTreeList(category); List<SubjectTypeTreeVO> subjectTypeTreeVOS = baseMapper.typeBindCountTreeList(category);
if (CollectionUtils.isNotEmpty(subjectTypeTreeVOS)) { if (CollectionUtils.isNotEmpty(subjectTypeTreeVOS)) {
List<String> collect = subjectTypeTreeVOS.stream().map(SubjectTypeTreeVO::getId).collect(Collectors.toList()); List<String> collect = subjectTypeTreeVOS.stream().map(SubjectTypeTreeVO::getId).collect(Collectors.toList());
......
...@@ -31,8 +31,13 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi ...@@ -31,8 +31,13 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
return this.baseMapper.listByDictCode(dictCode); return this.baseMapper.listByDictCode(dictCode);
} }
@Override
public SysDictItem dictItemInfoByName(String dictCode, String itemName) {
return baseMapper.dictItemInfoByName(dictCode, itemName);
}
@Override
@Override
public void changeKey(List<CountVO> dataList, List<SysDictItem> dictItemList) { public void changeKey(List<CountVO> dataList, List<SysDictItem> dictItemList) {
if (CollectionUtils.isNotEmpty(dataList)) { if (CollectionUtils.isNotEmpty(dataList)) {
Map<String, List<SysDictItem>> map = dictItemList.stream().collect(Collectors.groupingBy(SysDictItem::getItemValue)); Map<String, List<SysDictItem>> map = dictItemList.stream().collect(Collectors.groupingBy(SysDictItem::getItemValue));
......
...@@ -232,7 +232,7 @@ public class EsOpUtil<T> { ...@@ -232,7 +232,7 @@ public class EsOpUtil<T> {
request.timeout(TimeValue.timeValueMinutes(10)); request.timeout(TimeValue.timeValueMinutes(10));
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
T b = list.get(i); T b = list.get(i);
String id = null; String id;
try { try {
Field field = b.getClass().getDeclaredField("id"); Field field = b.getClass().getDeclaredField("id");
field.setAccessible(true); field.setAccessible(true);
...@@ -251,9 +251,7 @@ public class EsOpUtil<T> { ...@@ -251,9 +251,7 @@ public class EsOpUtil<T> {
try { try {
BulkResponse bulk = client.bulk(request, RequestOptions.DEFAULT); BulkResponse bulk = client.bulk(request, RequestOptions.DEFAULT);
BulkItemResponse[] bulkItemResponses = bulk.getItems(); BulkItemResponse[] bulkItemResponses = bulk.getItems();
int length = bulkItemResponses.length; for (BulkItemResponse response : bulkItemResponses) {
for (int i = 0; i < length; ++i) {
BulkItemResponse response = bulkItemResponses[i];
if (response.isFailed()) { if (response.isFailed()) {
log.info("批量保存[{}]过程中,id为[{}]的保存失败,失败原因[{}]", response.getIndex(), response.getId(), response.getFailureMessage()); log.info("批量保存[{}]过程中,id为[{}]的保存失败,失败原因[{}]", response.getIndex(), response.getId(), response.getFailureMessage());
} else { } else {
...@@ -346,6 +344,7 @@ public class EsOpUtil<T> { ...@@ -346,6 +344,7 @@ public class EsOpUtil<T> {
IndexRequest request = new IndexRequest(index) IndexRequest request = new IndexRequest(index)
.id(id) .id(id)
.source(jsonStr, XContentType.JSON); .source(jsonStr, XContentType.JSON);
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT); IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT);
return indexResponse.getId(); return indexResponse.getId();
} catch (IOException e) { } catch (IOException e) {
...@@ -541,9 +540,9 @@ public class EsOpUtil<T> { ...@@ -541,9 +540,9 @@ public class EsOpUtil<T> {
String index = m.get("index").toString(); String index = m.get("index").toString();
String id = m.get("id").toString(); String id = m.get("id").toString();
DeleteRequest deleteRequest = new DeleteRequest(index, id); DeleteRequest deleteRequest = new DeleteRequest(index, id);
deleteRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
bulkRequest.add(deleteRequest); bulkRequest.add(deleteRequest);
} }
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
try { try {
client.bulk(bulkRequest, RequestOptions.DEFAULT); client.bulk(bulkRequest, RequestOptions.DEFAULT);
} catch (Exception e) { } catch (Exception e) {
...@@ -657,7 +656,7 @@ public class EsOpUtil<T> { ...@@ -657,7 +656,7 @@ public class EsOpUtil<T> {
* 调用client.updateByQuery方法,传入UpdateByQueryRequest对象和默认的RequestOptions,执行批量更新操作,并返回BulkByScrollResponse对象。 * 调用client.updateByQuery方法,传入UpdateByQueryRequest对象和默认的RequestOptions,执行批量更新操作,并返回BulkByScrollResponse对象。
* Collections.emptyMap()是setScript脚本的参数,此方法没有设置其他参数,使用一个空的map * Collections.emptyMap()是setScript脚本的参数,此方法没有设置其他参数,使用一个空的map
*/ */
public void updataMoreColumBatchByQuery(String index, BoolQueryBuilder boolQuery, Map<String, String> modifyColumValue) throws IOException, InterruptedException { public void updateMoreColumBatchByQuery(String index, BoolQueryBuilder boolQuery, Map<String, String> modifyColumValue) throws IOException, InterruptedException {
UpdateByQueryRequest request = new UpdateByQueryRequest(index); UpdateByQueryRequest request = new UpdateByQueryRequest(index);
request.setQuery(boolQuery); request.setQuery(boolQuery);
request.setScript(new Script(ScriptType.INLINE, "painless", getIdOrCode(modifyColumValue), Collections.emptyMap())); request.setScript(new Script(ScriptType.INLINE, "painless", getIdOrCode(modifyColumValue), Collections.emptyMap()));
......
...@@ -4,6 +4,7 @@ import org.apache.poi.hssf.usermodel.*; ...@@ -4,6 +4,7 @@ import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*; import org.apache.poi.xssf.usermodel.*;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -208,11 +209,52 @@ public class ExcelExportUtil { ...@@ -208,11 +209,52 @@ public class ExcelExportUtil {
* @param columnNum 有用数据的总列数 * @param columnNum 有用数据的总列数
* @return java.util.List<java.util.List < java.lang.String>> * @return java.util.List<java.util.List < java.lang.String>>
*/ */
public static List<List<String>> readExcel(InputStream inputStream, Integer firstRow, Integer columnNum) throws Exception { public static List<List<String>> readExcelXls(InputStream inputStream,boolean singleSheet, Integer firstRow, Integer columnNum) throws IOException {
List<List<String>> dataList = new ArrayList<>();
//获取整个excel
HSSFWorkbook hb = new HSSFWorkbook(inputStream);
int sheets = hb.getNumberOfSheets();
if (singleSheet) {
sheets = 1;
}
for (int i = 0; i < sheets; i++) {
HSSFSheet sheet = hb.getSheetAt(i);
//第一行
int firstRowNum = sheet.getFirstRowNum();
//最后一行
int lastRowNum = sheet.getPhysicalNumberOfRows();
for (int j = firstRowNum + firstRow; j < lastRowNum; j++) {
//获取行
HSSFRow row = sheet.getRow(j);
if (row != null) {
List<String> list = new ArrayList<>();
for (int m = 0; m < columnNum; m++) {
String data = getValue(row.getCell(m)).trim();
list.add(data);
}
dataList.add(list);
}
}
}
return dataList;
}
/**
* 读取excel数据
*
* @param firstRow 第一行有用数据(0表示第一行)
* @param columnNum 有用数据的总列数
* @return java.util.List<java.util.List < java.lang.String>>
*/
public static List<List<String>> readExcelXlsx(InputStream inputStream,boolean singleSheet, Integer firstRow, Integer columnNum) throws IOException {
List<List<String>> dataList = new ArrayList<>(); List<List<String>> dataList = new ArrayList<>();
//获取整个excel //获取整个excel
XSSFWorkbook hb = new XSSFWorkbook(inputStream); XSSFWorkbook hb = new XSSFWorkbook(inputStream);
int sheets = hb.getNumberOfSheets(); int sheets = hb.getNumberOfSheets();
if (singleSheet) {
sheets = 1;
}
for (int i = 0; i < sheets; i++) { for (int i = 0; i < sheets; i++) {
XSSFSheet sheet = hb.getSheetAt(i); XSSFSheet sheet = hb.getSheetAt(i);
//第一行 //第一行
...@@ -225,7 +267,7 @@ public class ExcelExportUtil { ...@@ -225,7 +267,7 @@ public class ExcelExportUtil {
if (row != null) { if (row != null) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
for (int m = 0; m < columnNum; m++) { for (int m = 0; m < columnNum; m++) {
String data = ExcelExportUtil.getValue(row.getCell(m)).trim(); String data = getValue(row.getCell(m)).trim();
list.add(data); list.add(data);
} }
dataList.add(list); dataList.add(list);
...@@ -380,6 +422,23 @@ public class ExcelExportUtil { ...@@ -380,6 +422,23 @@ public class ExcelExportUtil {
return style; return style;
} }
public static String getValue(HSSFCell hssfCell) {
if (hssfCell == null || hssfCell.toString().trim().equals("")) {
return "";
}
CellType cellTypeEnum = hssfCell.getCellTypeEnum();
if (cellTypeEnum == CellType.NUMERIC) {
if (HSSFDateUtil.isCellDateFormatted(hssfCell)) {
return DateUtil.dateToString(hssfCell.getDateCellValue());
} else {
//防止数字变成科学计数法的形式
DecimalFormat df = new DecimalFormat("0");
return df.format(hssfCell.getNumericCellValue());
}
} else {
return hssfCell.getStringCellValue();
}
}
public static String getValue(XSSFCell xssfCell) { public static String getValue(XSSFCell xssfCell) {
if (xssfCell == null || xssfCell.toString().trim().equals("")) { if (xssfCell == null || xssfCell.toString().trim().equals("")) {
return ""; return "";
......
...@@ -23,6 +23,8 @@ public class PythonUtil { ...@@ -23,6 +23,8 @@ public class PythonUtil {
@Value("${python.keyWordsExtractUrl}") @Value("${python.keyWordsExtractUrl}")
private String keywordExtractUrl; private String keywordExtractUrl;
@Value("${python.judgeDuplicateUrl:}")
private String judgeDuplicateUrl;
/** /**
* 提取关键词 * 提取关键词
...@@ -49,4 +51,46 @@ public class PythonUtil { ...@@ -49,4 +51,46 @@ public class PythonUtil {
} }
return wordsList; return wordsList;
} }
/**
* 判重
*
* @param id 资讯id
* @param title 资讯标题
* @param content 资讯内容
* @param sourceAddress 原文链接
* @param subjectId 专题id
* @author lkg
* @date 2025/2/7
*/
public Boolean judgeDuplicate(String id, String title, String content, String sourceAddress, String subjectId) {
boolean repeat = false;
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json;charset=UTF-8");
headers.put("Accept", "application/json");
headers.put("Authorization", "!0gwY$5S@5V&A_+XEu)");
JSONObject jsonObjectParam = new JSONObject();
jsonObjectParam.put("id", id);
jsonObjectParam.put("title", title);
jsonObjectParam.put("content", content);
jsonObjectParam.put("sourceAddress", sourceAddress);
JSONArray jsonArray = new JSONArray();
jsonArray.add(jsonObjectParam);
JSONObject paramObject = new JSONObject();
paramObject.put("data", jsonArray);
paramObject.put("hash_name", subjectId);
try {
String result = HttpUtil.doPostWithHeader(judgeDuplicateUrl, paramObject, 3000, headers);
if (StringUtils.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result);
if (StringUtils.isNotEmpty(jsonObject.getString("resultData")) && !jsonObject.getJSONArray("resultData").isEmpty()) {
JSONObject resultObject = (JSONObject) jsonObject.getJSONArray("resultData").get(0);
repeat = resultObject.getBoolean("duplicated");
}
}
} catch (Exception e) {
e.printStackTrace();
}
return repeat;
}
} }
...@@ -549,5 +549,8 @@ public class RedisUtil { ...@@ -549,5 +549,8 @@ public class RedisUtil {
} }
} }
public void rpushMultipleValues(String key, Object... values) {
redisTemplate.opsForList().rightPushAll(key, values);
}
} }
...@@ -38,6 +38,9 @@ public class InfoDataSearchCondition { ...@@ -38,6 +38,9 @@ public class InfoDataSearchCondition {
//专题库类型(对应字典编码为【Thematic_Library】的数据字典值) //专题库类型(对应字典编码为【Thematic_Library】的数据字典值)
private List<Integer> classificationType; private List<Integer> classificationType;
/**原创性(0-非原创;1-原创;2-疑似)*/
private String originality;
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0) //审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private Integer checkStatus; private Integer checkStatus;
......
...@@ -259,4 +259,9 @@ public class InfoSourceVo { ...@@ -259,4 +259,9 @@ public class InfoSourceVo {
private Long weekCount; private Long weekCount;
/**近一月采集量*/ /**近一月采集量*/
private Long monthCount; private Long monthCount;
/**是否免过关键词 0否 1是*/
private Integer isExemptKeyword;
/**是否免审核 0否 1是*/
private Integer isFreeCheck;
} }
...@@ -90,4 +90,5 @@ public class KeyWordsPage { ...@@ -90,4 +90,5 @@ public class KeyWordsPage {
/**专题绑定的关键词映射表主键id*/ /**专题绑定的关键词映射表主键id*/
private String subjectKeyWordId; private String subjectKeyWordId;
private String typeId; private String typeId;
private Integer bindingType;
} }
package com.zzsn.event.vo;
import lombok.Data;
/**
* 标签-实体关系
*
* @author lkg
* @date 2025/2/5
*/
@Data
public class LabelItemMapVO {
private String entityCode;
private String labelCode;
private String labelItemCode;
}
package com.zzsn.event.vo; package com.zzsn.event.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzsn.event.entity.SubjectSampleFile; import com.zzsn.event.entity.SubjectSampleFile;
import lombok.Data; import lombok.Data;
...@@ -35,6 +37,10 @@ public class SubjectDetailVO { ...@@ -35,6 +37,10 @@ public class SubjectDetailVO {
private Integer dataSource; private Integer dataSource;
/**划分专题库*/ /**划分专题库*/
private String library; private String library;
/**第一次启用时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date firstOpenTime;
/**专题分类id*/ /**专题分类id*/
private String subjectTypeId; private String subjectTypeId;
......
...@@ -155,5 +155,7 @@ public class SubjectPage { ...@@ -155,5 +155,7 @@ public class SubjectPage {
private String taskCode; private String taskCode;
/**分类(1-专题;2-事件)*/ /**分类(1-专题;2-事件)*/
private Integer category; private Integer category;
/**预估状态*/
private String estimateStatus;
} }
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* 专题参数校验
*
* @author lkg
* @date 2025/2/5
*/
@Data
public class SubjectParamsCheckVO {
/**专题新增参数*/
private SubjectSimpleVO subjectSimpleVO;
/**信息源标签*/
private SubjectSourceTagVO subjectSourceTagVO;
/**信息源名称列表*/
private List<String> infoSourceWebSiteNames;
/**信息源id列表-推荐信息源*/
private List<String> infoSourceIds;
}
...@@ -34,6 +34,6 @@ public class SubjectSimpleVO { ...@@ -34,6 +34,6 @@ public class SubjectSimpleVO {
private String library; private String library;
private Integer dataSource; private Integer dataSource;
private Integer facePublic; private Integer facePublic;
/**关键词*/
private List<SearchWordVO> keywords; private List<SearchWordVO> keywords;
} }
...@@ -7,6 +7,9 @@ import java.util.List; ...@@ -7,6 +7,9 @@ import java.util.List;
@Data @Data
public class DisplayInfo { public class DisplayInfo {
//es的索引名
private String dbIndex;
//说明:...Raw 表示原文,即原语言 //说明:...Raw 表示原文,即原语言
//作者 //作者
private String author; private String author;
...@@ -104,6 +107,7 @@ public class DisplayInfo { ...@@ -104,6 +107,7 @@ public class DisplayInfo {
private List<String> databaseIds; private List<String> databaseIds;
//是否风险 //是否风险
private Integer isRisk; private Integer isRisk;
private Integer isFreeCheck;
//风险类型 //风险类型
private List<String> riskTypes; private List<String> riskTypes;
//标签集合 //标签集合
...@@ -113,6 +117,8 @@ public class DisplayInfo { ...@@ -113,6 +117,8 @@ public class DisplayInfo {
//法规号 //法规号
private String contentNo; private String contentNo;
/**原创性*/
private String originality;
//来源 (政策发文机关) //来源 (政策发文机关)
private String organ; private String organ;
......
...@@ -74,6 +74,7 @@ public class SpecialInformation { ...@@ -74,6 +74,7 @@ public class SpecialInformation {
//删除标记(1:删除;0:保留) //删除标记(1:删除;0:保留)
private Integer deleteFlag; private Integer deleteFlag;
private String subjectId; private String subjectId;
private String subjectName;
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0) //审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private Integer checkStatus; private Integer checkStatus;
//阅读数 //阅读数
...@@ -106,6 +107,7 @@ public class SpecialInformation { ...@@ -106,6 +107,7 @@ public class SpecialInformation {
private List<String> databaseIds; private List<String> databaseIds;
//是否风险 //是否风险
private Integer isRisk; private Integer isRisk;
private Integer isFreeCheck;
//风险类型 //风险类型
private List<String> riskTypes; private List<String> riskTypes;
//资讯关联的附件id //资讯关联的附件id
...@@ -136,4 +138,7 @@ public class SpecialInformation { ...@@ -136,4 +138,7 @@ public class SpecialInformation {
private String originalSource; private String originalSource;
/**原创性*/ /**原创性*/
private String originality; private String originality;
/**数据来源(1-人工导入;空-正常采集)*/
private Integer dataFrom;
} }
...@@ -6,6 +6,7 @@ import lombok.Setter; ...@@ -6,6 +6,7 @@ import lombok.Setter;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -26,7 +27,7 @@ public class Subjectdatabase { ...@@ -26,7 +27,7 @@ public class Subjectdatabase {
private List<AttachmentInfo> attachmentInfos; private List<AttachmentInfo> attachmentInfos;
private String author; private String author;
private String authorRaw; private String authorRaw;
private LocalDateTime checkDate; private Date checkDate;
private Long checkStatus; private Long checkStatus;
private Long classificationType; private Long classificationType;
private Long classificationTypePre; private Long classificationTypePre;
...@@ -39,7 +40,7 @@ public class Subjectdatabase { ...@@ -39,7 +40,7 @@ public class Subjectdatabase {
private String contentWithTag; private String contentWithTag;
private String contentWithTagRaw; private String contentWithTagRaw;
private String country; private String country;
private LocalDateTime createDate; private Date createDate;
private String customLabel; private String customLabel;
private Long dataFrom; private Long dataFrom;
private String dataHash; private String dataHash;
...@@ -76,12 +77,12 @@ public class Subjectdatabase { ...@@ -76,12 +77,12 @@ public class Subjectdatabase {
private Long orientation; private Long orientation;
private String origin; private String origin;
private String originRaw; private String originRaw;
private LocalDateTime originalDate; private Date originalDate;
private String originalId; private String originalId;
private String originalTime; private String originalTime;
private LocalDateTime processDate; private Date processDate;
private List<String> programaIds; private List<String> programaIds;
private LocalDateTime publishDate; private Date publishDate;
private Long publishStatus; private Long publishStatus;
private Long readNum; private Long readNum;
private String repeatId; private String repeatId;
...@@ -108,7 +109,7 @@ public class Subjectdatabase { ...@@ -108,7 +109,7 @@ public class Subjectdatabase {
* 资讯唯一编码 * 资讯唯一编码
*/ */
private String uniqueCode; private String uniqueCode;
private LocalDateTime updateDate; private Date updateDate;
private String videoImg; private String videoImg;
private String videoPhoneUrl; private String videoPhoneUrl;
private Long videoTime; private Long videoTime;
......
...@@ -54,10 +54,17 @@ spring: ...@@ -54,10 +54,17 @@ spring:
username: ciglobal username: ciglobal
password: qwer@9988&zzsn password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource2:
url: jdbc:mysql://1.95.78.131:3306/clb_system_label?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal
password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver
elasticsearch: elasticsearch:
uris: ["1.95.69.2:9200"] uris: ["1.95.69.2:9200"]
# uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"]
username: elastic username: elastic
password: elastic password: elastic
# password: zzsn9988
connection-timeout: 300000 connection-timeout: 300000
socket-timeout: 300000 socket-timeout: 300000
cloud: cloud:
...@@ -111,7 +118,7 @@ spring: ...@@ -111,7 +118,7 @@ spring:
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:com/zzsn/event/**/xml/*.xml mapper-locations: classpath*:com/zzsn/event/**/xml/*.xml
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
obs: obs:
ak: VEHN7D0TJ9316H8AHCAV ak: VEHN7D0TJ9316H8AHCAV
...@@ -129,12 +136,23 @@ scoreRule: ...@@ -129,12 +136,23 @@ scoreRule:
translate: translate:
url: http://114.116.116.241:8018/translate/getTranslateInfoWithTag url: http://114.116.116.241:8018/translate/getTranslateInfoWithTag
python: python:
#python打分接口 #python打分接口-弃用
scoreModelUrl: http://114.116.36.231:8080/score scoreModelUrl: http://114.116.36.231:8080/score
#python开始执行接口 #python开始执行接口--弃用
subjectProcessorUrl: http://114.116.36.231:8085/subject/subject_processor subjectProcessorUrl: http://114.116.36.231:8085/subject/subject_processor
#判重 #判重
judgeDuplicateUrl: http://114.116.36.231:8080/subject/judg_duplicate judgeDuplicateUrl: http://1.95.13.40:8080/subject/judg_duplicate
#热词抽取地址 #抽取关键词
hotWords: keyWordsExtractUrl: http://1.95.91.200:7006/get_phrase/
extractUrl: http://114.116.99.6:8055/task/dispose/extractKeyword jeecg:
\ No newline at end of file shiro:
excludeUrls:
kafka:
topic:
subject:
run: subjectModelTest
clb:
subject:
default:
processing:
advanceMonth: 6
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论