提交 df3a629b 作者: 925993793@qq.com

自定义专题、事件分析、专题资讯报告整合

上级 c3a41750
......@@ -399,6 +399,13 @@ public class InformationController {
return Result.OK(recommendList);
}
/**
* 根据条件移除专题下数据-研究中心
*
* @param params 参数
* @author lkg
* @date 2025/2/20
*/
@PostMapping("/removeByCondition")
public Result<?> removeByCondition(@RequestBody JSONObject params){
String subjectId = params.getString("subjectId");
......@@ -407,9 +414,32 @@ public class InformationController {
}
JSONArray themeIds = params.getJSONArray("themeIds");
if (CollectionUtils.isEmpty(themeIds)) {
return Result.FAIL("主题id不能为空");
return Result.FAIL("移除的主题id集合不能为空");
}
informationService.removeByCondition(subjectId, JSONArray.parseArray(themeIds.toJSONString(), String.class));
return null;
return Result.OK();
}
/**
* 根据条件移除专题下数据-研究中心
*
* @param params 参数
* @author lkg
* @date 2025/2/20
*/
@PostMapping("/supplyByCondition")
public Result<?> supplyByCondition(@RequestBody JSONObject params){
String subjectId = params.getString("subjectId");
if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空");
}
JSONArray themeIds = params.getJSONArray("themeIds");
if (CollectionUtils.isEmpty(themeIds)) {
return Result.FAIL("新增的主题id集合不能为空");
}
//todo 新增 redis塞缓存,对接数据处理
//2025-01-21:123,123,123
return Result.OK();
}
}
......@@ -229,6 +229,32 @@ public class EventDataController {
}
/**
* 事件配置校验
*
* @param addEventParam 参数
* @author lkg
* @date 2025/2/5
*/
@PostMapping("/configVerification")
public Result<?> configVerification(@RequestBody AddEventParam addEventParam){
Boolean verification = eventService.configVerification(addEventParam);
return Result.OK(verification);
}
/**
* 清空专题数据
*
* @param eventId 专题id
* @author lkg
* @date 2025/2/6
*/
@GetMapping("/clearData")
public Result<?> clearData(@RequestParam String eventId){
eventService.clearSubjectData(eventId);
return Result.OK("正在清空数据");
}
/**
* 通过id删除
*
* @param id 事件id
......
......@@ -137,6 +137,9 @@ public class EventHomeController {
try{
String res = HttpUtil.get(checkToken + token);
JSONObject data = JSONObject.parseObject(res).getJSONObject("data");
if(data == null){
return Result.FAIL("token失效");
}
JSONArray powerCodeSet = data.getJSONArray("powerCodeSet");
return Result.OK(powerCodeSet.contains(key));
}catch (Exception e){
......
......@@ -124,7 +124,7 @@ public class Event {
/**
* 状态(0-禁用;1-启用)
*/
private Integer status = 1;
private Integer status;
/**
* 专题最近一次分析时间
*/
......
......@@ -226,7 +226,7 @@ public class EsService {
*/
public IPage<SubjectDataVo> frontListByPage(List<String> subjectIdList, String searchWord, String position, Integer category,
String labelId, String column, String order, int pageNo, int pageSize) {
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数
searchSourceBuilder.size(pageSize);
......@@ -340,7 +340,7 @@ public class EsService {
* @date 2024/4/10
*/
public List<SubjectDataVo> queryRecommendList(String subjectId, String id, String title, Integer pageNo, Integer pageSize) {
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数
int offset = (pageNo - 1) * pageSize;
......@@ -354,7 +354,7 @@ public class EsService {
searchSourceBuilder.fetchSource(fetchFields, null);
//创建查询对象
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termQuery("checkStatus", 1));
//boolQuery.must(QueryBuilders.termQuery("checkStatus", 1));
boolQuery.must(QueryBuilders.termQuery("subjectId.keyword", subjectId));
boolQuery.must(QueryBuilders.matchQuery("title", title));
boolQuery.mustNot(QueryBuilders.termQuery("id", id));
......@@ -526,7 +526,7 @@ public class EsService {
*/
public List<SubjectDataVo> exportDataList(List<String> subjectIdList, String searchWord, String position, Integer category,
List<String> articleIdList, String column, String order, Integer type, Integer pageSize) {
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
if (CollectionUtils.isNotEmpty(articleIdList)) {
pageSize = articleIdList.size();
......@@ -729,11 +729,10 @@ public class EsService {
//排序规则
String column = searchCondition.getColumn();
String order = searchCondition.getOrder();
switch (column) {
case "topNum":
if (searchCondition.getTopSortValid() == 1) {
searchSourceBuilder.sort("topNum", SortOrder.DESC);
searchSourceBuilder.sort("publishDate", SortOrder.DESC);
break;
}
switch (column) {
case "score":
if (order.equals("asc")) {
searchSourceBuilder.sort("score", SortOrder.ASC);
......@@ -793,7 +792,7 @@ public class EsService {
List<String> list = new ArrayList<>();
List<String> idList = Arrays.asList(ids.split(","));
List<String> beInStorageList = idList.stream().map(uniqueCode -> subjectId + uniqueCode).collect(Collectors.toList());
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
//创建查询对象
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termsQuery("id", beInStorageList));
......@@ -950,7 +949,7 @@ public class EsService {
*/
public List<EventViewVO> viewpointList(String eventId, String relationId) {
List<EventViewVO> dataList = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//排序方式 按发布时间升序
searchSourceBuilder.sort("publishDate", SortOrder.DESC);
......@@ -1004,11 +1003,9 @@ public class EsService {
int topNum = 0;
SearchRequest searchRequest;
if (StringUtils.isEmpty(index)) {
String[] indexArr = EsIndexUtil.getIndexLatelyTwoYear(Constants.SUBJECT_INDEX);
searchRequest = new SearchRequest(indexArr);
} else {
searchRequest = new SearchRequest(index);
index = Constants.SUBJECT_INDEX;
}
searchRequest = new SearchRequest(index);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置分页参数
searchSourceBuilder.size(1);
......@@ -1042,7 +1039,7 @@ public class EsService {
//调用判重接口
public boolean duplicationByTitleOrSourceAddress(DisplayInfo displayInfo) {
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
BoolQueryBuilder shouldBoolQuery = QueryBuilders.boolQuery();
......@@ -1209,7 +1206,7 @@ public class EsService {
regionIds.add(node.getId());
}
//根据地区的id从ES查询相关的记录
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1298,7 +1295,7 @@ public class EsService {
*/
public List<CountVO> groupByOrigin(String subjectId, String rangField, String startDate, String endDate, int size) {
List<CountVO> data = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1445,7 +1442,7 @@ public class EsService {
*/
public List<CountVO> overView(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1500,7 +1497,7 @@ public class EsService {
*/
public List<CountVO> groupByDate(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1588,7 +1585,7 @@ public class EsService {
*/
public List<CountVO> groupByInfoSourceTag(InfoDataSearchCondition searchCondition) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1634,7 +1631,7 @@ public class EsService {
*/
public List<CountVO> keywordsCount(String subjectId, List<String> excludeKeywords, Integer size) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......@@ -1681,7 +1678,7 @@ public class EsService {
*/
private List<CountVO> groupByTerm(InfoDataSearchCondition searchCondition, String groupName, String field, boolean sort) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexLatelyTwoYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
......
......@@ -122,5 +122,13 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
*/
Integer typeBindEventCount(@Param("typeIds") List<String> typeIds);
List<SubjectTreeVO> eventAndTypeTree();
/**
* 可用的事件和事件分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<SubjectTreeVO> eventAndTypeTree(@Param("userId") String userId, @Param("customerId") String customerId);
}
......@@ -34,6 +34,8 @@
t.relation_events,
t.event_type,
t.sort_order,
t.yn_collect,
t.first_open_time,
stm.type_id as subjectTypeId,
psm.project_id,
c.type_name,
......
......@@ -158,17 +158,35 @@
select x.* from (
select s.id,s.type_name as name,s.pid,'false' as ynSubject,null as startTime,null as endTime,s.create_time
from subject_type s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.category = 2 and s.status = 1
union
select n.id,n.name,m.id as pid,'true' as ynSubject,n.start_time,n.end_time,n.create_time from
(
select s.id,s.type_name as name,s.pid from subject_type s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.category = 2 and s.status = 1
) m
inner join subject_type_map stm on m.id = stm.type_id
inner join
(
select s.id,s.event_name as name,s.start_time,s.end_time,s.create_time from event s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.status = 1
) n on stm.subject_id = n.id
) x
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.util.CodeGenerateUtil;
......@@ -56,6 +57,7 @@ public class EventSimpleService {
Event event = new Event();
BeanUtils.copyProperties(addEventVO, event);
event.setStatus(1);
event.setFirstOpenTime(new Date());
Date endTime = event.getEndTime();
if (endTime == null) {
endTime = DateUtil.addDate(new Date(), 15);
......@@ -96,7 +98,8 @@ public class EventSimpleService {
BeanUtils.copyProperties(addEventVO, event);
eventService.updateById(event);
CompletableFuture.runAsync(()->{
//地域关系绑定
//地域绑定关系修改
eventRegionMapService.remove(Wrappers.<EventRegionMap>lambdaQuery().eq(EventRegionMap::getEventId, eventId));
List<RegionVO> regionList = addEventVO.getRegionList();
addRegionMap(eventId, regionList);
});
......
......@@ -120,5 +120,13 @@ public interface ISubjectTypeService extends IService<SubjectType> {
*/
List<SubjectTreeVO> subjectAndCustomerTree(String userId,String customerId);
List<SubjectTreeVO> eventAndTypeTree();
/**
* 可用的事件和事件分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<SubjectTreeVO> eventAndTypeTree(String userId, String customerId);
}
......@@ -194,6 +194,13 @@ public interface InformationService {
*/
void importDataInfo(List<List<String>> lists, String subjectId);
/**
* 移除专题下的数据-研究中心
*
* @param subjectId 专题id
* @param themeIds 主题(关联标签)id集合
* @author lkg
* @date 2025/2/20
*/
void removeByCondition(String subjectId, List<String> themeIds);
}
......@@ -55,7 +55,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
long totalCount = 0L;
long max = 0L;
String maxTime = null;
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(subjectId, null, startTime, endTime, false);
searchSourceBuilder.size(0);
searchSourceBuilder.trackTotalHits(true);
......@@ -103,7 +103,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
CountVO countVO = new CountVO();
countVO.setName(name);
long count = 0L;
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(subjectId, labelId, startTime, endTime, false);
searchSourceBuilder.size(0);
searchSourceBuilder.trackTotalHits(true);
......@@ -133,7 +133,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
LabelEntity labelEntity = labelEntityService.getById(labelId);
countVO.setLabelId(labelEntity.getId());
countVO.setName(labelEntity.getName());
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(subjectId, labelId, startTime, endTime, false);
searchSourceBuilder.size(0);
searchSourceBuilder.trackTotalHits(true);
......@@ -172,7 +172,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
public List<CountVO> origin(String subjectId, String startTime, String endTime) {
List<CountVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(subjectId, null, startTime, endTime, true);
searchSourceBuilder.size(0);
searchSourceBuilder.trackTotalHits(true);
......@@ -323,7 +323,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
public List<CountVO> flowData(String subjectId, String startTime, String endTime, Integer type) {
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(subjectId, null, startTime, endTime, false);
searchSourceBuilder.size(0);
searchSourceBuilder.trackTotalHits(true);
......@@ -359,7 +359,7 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
@Override
public long totalCount(List<String> eventIdList, String startTime, String endTime) {
long count = 0;
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
String eventIds = String.join(",", eventIdList);
SearchSourceBuilder searchSourceBuilder = formatSourceBuilder(eventIds, null, startTime, endTime, false);
searchSourceBuilder.size(0);
......
......@@ -76,8 +76,10 @@ public class EventExtractTaskServiceImpl extends ServiceImpl<EventExtractTaskMap
StringBuilder stringBuilder = new StringBuilder();
for (String s : columnId.split(",")) {
Node column = columnMap.get(s);
if (column != null) {
stringBuilder.append(",").append(column.getName());
}
}
taskVO.setColumnName(stringBuilder.substring(1));
}
pageData.setRecords(pageList);
......
......@@ -105,9 +105,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Resource
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private CommonService commonService;
@Autowired
private EsService esService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private PythonUtil pythonUtil;
......@@ -241,7 +240,9 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
long t1 = System.currentTimeMillis();
count(pageList);
log.info("数量统计总共耗时====" + (System.currentTimeMillis() - t1));
Page<EventNewPlatVO> pageData = new Page<>(pageNo, pageSize);
//获取总条数
Integer count = baseMapper.newPlatCount(subjectCondition);
Page<EventNewPlatVO> pageData = new Page<>(pageNo, pageSize,count);
pageData.setRecords(pageList);
return pageData;
}
......@@ -271,7 +272,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
Map<String, String> map = new HashMap<>();
List<String> eventIdList = new ArrayList<>();
pageList.forEach(e -> eventIdList.add(e.getId()));
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
//根据设备查询设备的相关信息
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.from(0);
......@@ -462,7 +463,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
this.update(updateWrapper);
CompletableFuture.runAsync(() -> {
//调用python接口
pythonUtil.clearDuplicateHistory(eventId);
pythonUtil.clearDuplicateHistory(Collections.singletonList(eventId));
//清空专题数据
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termQuery("subjectId.keyword", eventId));
......@@ -751,7 +752,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
//查询每个专题的数量
private Map<String, Integer> subjectInfoCountMap(List<String> subjectIdList, List<Integer> checkStatusList) {
Map<String, Integer> map = new HashMap<>(subjectIdList.size());
SearchRequest searchRequest = new SearchRequest(EsIndexUtil.getIndexYear(Constants.SUBJECT_INDEX));
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder.trackTotalHits(true);
......
......@@ -421,7 +421,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
subjectService.update(updateWrapper);
CompletableFuture.runAsync(() -> {
//调用python接口
pythonUtil.clearDuplicateHistory(subjectId);
pythonUtil.clearDuplicateHistory(Collections.singletonList(subjectId));
//清空专题数据
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termQuery("subjectId.keyword", subjectId));
......
......@@ -121,9 +121,9 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
}
@Override
public List<SubjectTreeVO> eventAndTypeTree() {
public List<SubjectTreeVO> eventAndTypeTree(String userId, String customerId) {
List<SubjectTreeVO> tree = new ArrayList<>();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.eventAndTypeTree();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.eventAndTypeTree(userId,customerId);
if (CollectionUtils.isNotEmpty(subjectTreeVOS)) {
tree = TreeUtil.tree(subjectTreeVOS, "0");
}
......
......@@ -550,6 +550,30 @@ public class EsOpUtil<T> {
}
}
/**
* 批量删除
*
* @param removeMap 删除参数
* @author lkg
* @date 2024/12/19
*/
public void docRemoveBulk(Map<String, List<SpecialInformation>> removeMap){
BulkRequest bulkRequest = new BulkRequest();
for (Map.Entry<String, List<SpecialInformation>> entry : removeMap.entrySet()) {
String index = entry.getKey();
for (SpecialInformation information : entry.getValue()) {
DeleteRequest deleteRequest = new DeleteRequest(index, information.getId());
bulkRequest.add(deleteRequest);
}
}
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
try {
client.bulk(bulkRequest, RequestOptions.DEFAULT);
} catch (Exception e) {
log.error("数据删除失败!",e);
}
}
/**
* @Description 判断该专题下的内容是否重复导入
......
......@@ -437,7 +437,8 @@ public class HttpUtil {
post(url,new ByteArrayInputStream(bytes),filename);
}
public static void post(String url,InputStream inputStream ,String filename) throws IOException {
public static byte[] post(String url,InputStream inputStream ,String filename) throws IOException {
byte[] result = null;
try {
//创建HttpClient
CloseableHttpClient httpClient = HttpClients.createDefault();
......@@ -455,14 +456,12 @@ public class HttpUtil {
HttpEntity responseEntity = response.getEntity();
if(responseEntity != null){
//将响应的内容转换成字符串
String result = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
//此处根据服务器返回的参数转换,这里返回的是JSON格式
JSONObject output = JSON.parseObject(result);
// System.out.println(output.toJSONString());
result = EntityUtils.toByteArray(responseEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static String sendPost(String url, Map<String, Object> params,String charset,int ExTime) {
String content = "";
......
......@@ -102,23 +102,23 @@ public class PythonUtil {
/**
* 清空去重服务历史数据
*
* @param subjectId 专题id
* @param subjectIds 专题id集合
* @author lkg
* @date 2025/2/10
*/
public void clearDuplicateHistory(String subjectId) {
Map<String, String> params = new HashMap<>();
params.put("subjectId", subjectId);
public void clearDuplicateHistory(List<String> subjectIds) {
JSONObject params = new JSONObject();
params.put("subjectId", subjectIds);
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)");
try {
String response = HttpUtil.doGet(clearDuplicateHistoryUrl, params, headers, "UTF-8");
String response = HttpUtil.doPostWithHeader(clearDuplicateHistoryUrl, params,30000 , headers);
JSONObject jsonObject = JSONObject.parseObject(response);
String isHandleSuccess = jsonObject.getString("isHandleSuccess");
if (isHandleSuccess.equals("true")) {
log.info("专题-{},清空数据,调用python接口清空去重服务历史数据请求发送成功",subjectId);
log.info("专题-{},清空数据,调用python接口清空去重服务历史数据请求发送成功",JSON.toJSONString(subjectIds));
} else {
log.info("python清空去重服务历史数据接口异常:{}",jsonObject.getString("logs"));
}
......
......@@ -41,6 +41,8 @@ public class AddEventVO {
private Integer facePublic;
/**事件创建方式(1-用户直接创建;2-基于挖掘的事件创建)*/
private Integer category;
/**是否开启采集(1-是;0-否)*/
private Integer ynCollect;
/**事件地域信息*/
List<RegionVO> regionList;
......
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzsn.event.entity.EventTag;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
......@@ -55,6 +57,11 @@ public class EventVO {
private String projectId;
/**排序号*/
private Integer sortOrder;
/**是否开启采集(1-是;0-否)*/
private Integer ynCollect;
/**第一次启用时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date firstOpenTime;
......
......@@ -102,9 +102,11 @@ public class InfoDataSearchCondition {
//排序参数
//排序字段
private String column = "common";
private String column;
//排序方式 asc/desc
private String order = "desc";
private String order;
//置顶排序是否起效(1-是;0-否)
private Integer topSortValid = 0;
//分页参数
//当前页
......
......@@ -69,8 +69,8 @@ spring:
stream:
kafka:
binder:
brokers: 1.95.78.131:9092
zkNodes: 1.95.78.131:2181
brokers: 1.95.78.131:17092
zkNodes: 1.95.78.131:12181
requiredAcks: 1
redis:
database: 7
......@@ -85,7 +85,7 @@ spring:
port: 6380
password: RPHZgkDQ4zGJ
kafka:
bootstrap-servers: 1.95.78.131:9092
bootstrap-servers: 1.95.78.131:17092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
......@@ -97,6 +97,12 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer
properties:
max.request.size: 335544324 #32M
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
consumer:
#用于标识此使用者所属的使用者组的唯一字符串
group-id: event-analysis-group-dev
......@@ -111,6 +117,13 @@ spring:
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
#值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
main:
allow-circular-references: true
mybatis-plus:
......
......@@ -66,8 +66,8 @@ spring:
stream:
kafka:
binder:
brokers: 1.95.78.131:9092
zkNodes: 1.95.78.131:2181
brokers: 192.168.0.180:7092
zkNodes: 192.168.0.180:12181
requiredAcks: 1
redis:
database: 0
......@@ -82,7 +82,7 @@ spring:
port: 6380
password: RPHZgkDQ4zGJ
kafka:
bootstrap-servers: 1.95.78.131:9092
bootstrap-servers: 192.168.0.180:7092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
......@@ -94,6 +94,12 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer
properties:
max.request.size: 335544324 #32M
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
consumer:
#用于标识此使用者所属的使用者组的唯一字符串
group-id: event-analysis-group
......@@ -108,6 +114,13 @@ spring:
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
#值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
main:
allow-circular-references: true
mybatis-plus:
......
......@@ -71,8 +71,8 @@ spring:
stream:
kafka:
binder:
brokers: 1.95.78.131:9092
zkNodes: 1.95.78.131:2181
brokers: 1.95.78.131:17092
zkNodes: 1.95.78.131:12181
requiredAcks: 1
redis:
database: 7
......@@ -87,7 +87,7 @@ spring:
port: 6379
password: zzsn9988
kafka:
bootstrap-servers: 1.95.78.131:9092
bootstrap-servers: 1.95.78.131:17092
producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384
......@@ -99,6 +99,12 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer
properties:
max.request.size: 335544324 #32M
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
consumer:
#用于标识此使用者所属的使用者组的唯一字符串
group-id: event-analysis-group-dev
......@@ -113,6 +119,13 @@ spring:
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
#值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
main:
allow-circular-references: true
mybatis-plus:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论