提交 b3c4febe 作者: 925993793@qq.com

【fix】已入库资讯导出逻辑修改以及其他bug修改

上级 b7bd8c2f
...@@ -99,7 +99,7 @@ public class SubjectManageController { ...@@ -99,7 +99,7 @@ public class SubjectManageController {
private KafkaTemplate<String, String> kafkaTemplate; private KafkaTemplate<String, String> kafkaTemplate;
@Autowired @Autowired
private PythonUtil pythonUtil; private PythonUtil pythonUtil;
@Autowired @Autowired(required = false)
private RemoteModelService remoteModelService; private RemoteModelService remoteModelService;
@Autowired @Autowired
private ConfigurationMessageService configurationMessageService; private ConfigurationMessageService configurationMessageService;
......
...@@ -222,6 +222,9 @@ public class InformationController { ...@@ -222,6 +222,9 @@ public class InformationController {
if (StringUtils.isEmpty(searchCondition.getSubjectId())) { if (StringUtils.isEmpty(searchCondition.getSubjectId())) {
return Result.FAIL("专题id/专题分类id不能为空"); return Result.FAIL("专题id/专题分类id不能为空");
} }
if (searchCondition.getCategory() == null) {
return Result.FAIL("专题类型不能为空");
}
UserVo userVo = UserUtil.getLoginUser(); UserVo userVo = UserUtil.getLoginUser();
return informationService.subjectPageListGroupByLabel(userVo, searchCondition); return informationService.subjectPageListGroupByLabel(userVo, searchCondition);
} }
......
...@@ -1089,9 +1089,25 @@ public class EsService { ...@@ -1089,9 +1089,25 @@ public class EsService {
searchSourceBuilder.trackTotalHits(true); searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0); searchSourceBuilder.size(0);
//创建查询对象 //创建查询对象
List<String> subjectIds = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
subjectIds.add(searchCondition.getSubjectId()); //判断是否是专题
BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds); if ("1".equals(searchCondition.getIsSubject())) {
if (StringUtils.isNotEmpty(searchCondition.getSubjectId())) {
subjectIdList.add(searchCondition.getSubjectId());
}
} else {
//该id其实是专题类别id
//查询类别id的所有明细id
Integer category = searchCondition.getCategory();
String subjectTypeId = searchCondition.getSubjectId();
List<String> typeIds = subjectTypeService.belowIdList(subjectTypeId, category);
if (category == 1) {
subjectIdList = subjectTypeMapService.selectSubjectByTypeIds(typeIds);
} else if (category == 2) {
subjectIdList = subjectTypeMapService.selectEventByTypeIds(typeIds);
}
}
BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIdList);
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder); searchRequest.source(searchSourceBuilder);
try { try {
...@@ -1163,9 +1179,25 @@ public class EsService { ...@@ -1163,9 +1179,25 @@ public class EsService {
} }
searchSourceBuilder.size(pageSize); searchSourceBuilder.size(pageSize);
searchSourceBuilder.from((pageNo - 1) * pageSize); searchSourceBuilder.from((pageNo - 1) * pageSize);
List<String> subjectIds = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
subjectIds.add(searchCondition.getSubjectId()); //判断是否是专题
boolQuery = buildQuery(searchCondition, subjectIds); if ("1".equals(searchCondition.getIsSubject())) {
if (StringUtils.isNotEmpty(searchCondition.getSubjectId())) {
subjectIdList.add(searchCondition.getSubjectId());
}
} else {
//该id其实是专题类别id
//查询类别id的所有明细id
Integer category = searchCondition.getCategory();
String subjectTypeId = searchCondition.getSubjectId();
List<String> typeIds = subjectTypeService.belowIdList(subjectTypeId, category);
if (category == 1) {
subjectIdList = subjectTypeMapService.selectSubjectByTypeIds(typeIds);
} else if (category == 2) {
subjectIdList = subjectTypeMapService.selectEventByTypeIds(typeIds);
}
}
boolQuery = buildQuery(searchCondition, subjectIdList);
} }
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder); searchRequest.source(searchSourceBuilder);
......
package com.zzsn.event.exception;
import com.zzsn.event.constant.Result;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* 异常拦截
*
* @author lkg
* @date 2025/2/28
*/
@RestControllerAdvice
public class CustomExceptionHandler {
@ExceptionHandler(FileExportException.class)
public ResponseEntity<Object> handleFileExportException(FileExportException ex) {
return new ResponseEntity<>(Result.FAIL(ex.getMessage()), HttpStatus.valueOf(ex.getStatusCode()));
}
}
package com.zzsn.event.exception;
import lombok.Data;
/**
* 文件导出异常
*
* @author lkg
* @date 2025/2/28
*/
@Data
public class FileExportException extends RuntimeException{
private int statusCode = 500;
public FileExportException(String message) {
super(message);
}
}
...@@ -876,18 +876,23 @@ public class InformationServiceImpl implements InformationService { ...@@ -876,18 +876,23 @@ public class InformationServiceImpl implements InformationService {
} }
for (SpecialInformation specialInformation : informationList) { for (SpecialInformation specialInformation : informationList) {
List<Label> labels = specialInformation.getLabels(); List<Label> labels = specialInformation.getLabels();
if (labels.size() == 1) { List<Label> collect = labels.stream().filter(e -> "thematic_information_column".equals(e.getLabelMark())).collect(Collectors.toList());
removeList.add(specialInformation); if (CollectionUtils.isNotEmpty(collect)) {
} else { if (collect.size() == 1) {
List<Label> newLabels = new ArrayList<>(); removeList.add(specialInformation);
for (Label label : labels) { } else {
String labelRelationId = label.getRelationId(); List<Label> newLabels = new ArrayList<>();
if (!themeIds.contains(labelRelationId)) { for (Label label : collect) {
newLabels.add(label); String labelRelationId = label.getRelationId();
if (!themeIds.contains(labelRelationId)) {
newLabels.add(label);
}
} }
specialInformation.setLabels(newLabels);
dataList.add(specialInformation);
} }
specialInformation.setLabels(newLabels); } else {
dataList.add(specialInformation); removeList.add(specialInformation);
} }
} }
} }
......
...@@ -80,7 +80,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService { ...@@ -80,7 +80,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private CodeGenerateUtil codeGenerateUtil; private CodeGenerateUtil codeGenerateUtil;
@Autowired @Autowired
private PythonUtil pythonUtil; private PythonUtil pythonUtil;
@Autowired @Autowired(required = false)
private RemoteModelService remoteModelService; private RemoteModelService remoteModelService;
@Value("${clb.subject.default.processing.advanceMonth}") @Value("${clb.subject.default.processing.advanceMonth}")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论