提交 b3c4febe 作者: 925993793@qq.com

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

上级 b7bd8c2f
......@@ -99,7 +99,7 @@ public class SubjectManageController {
private KafkaTemplate<String, String> kafkaTemplate;
@Autowired
private PythonUtil pythonUtil;
@Autowired
@Autowired(required = false)
private RemoteModelService remoteModelService;
@Autowired
private ConfigurationMessageService configurationMessageService;
......
......@@ -222,6 +222,9 @@ public class InformationController {
if (StringUtils.isEmpty(searchCondition.getSubjectId())) {
return Result.FAIL("专题id/专题分类id不能为空");
}
if (searchCondition.getCategory() == null) {
return Result.FAIL("专题类型不能为空");
}
UserVo userVo = UserUtil.getLoginUser();
return informationService.subjectPageListGroupByLabel(userVo, searchCondition);
}
......
......@@ -1089,9 +1089,25 @@ public class EsService {
searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);
//创建查询对象
List<String> subjectIds = new ArrayList<>();
subjectIds.add(searchCondition.getSubjectId());
BoolQueryBuilder boolQuery = buildQuery(searchCondition, subjectIds);
List<String> subjectIdList = new ArrayList<>();
//判断是否是专题
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);
searchRequest.source(searchSourceBuilder);
try {
......@@ -1163,9 +1179,25 @@ public class EsService {
}
searchSourceBuilder.size(pageSize);
searchSourceBuilder.from((pageNo - 1) * pageSize);
List<String> subjectIds = new ArrayList<>();
subjectIds.add(searchCondition.getSubjectId());
boolQuery = buildQuery(searchCondition, subjectIds);
List<String> subjectIdList = new ArrayList<>();
//判断是否是专题
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);
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 {
}
for (SpecialInformation specialInformation : informationList) {
List<Label> labels = specialInformation.getLabels();
if (labels.size() == 1) {
removeList.add(specialInformation);
} else {
List<Label> newLabels = new ArrayList<>();
for (Label label : labels) {
String labelRelationId = label.getRelationId();
if (!themeIds.contains(labelRelationId)) {
newLabels.add(label);
List<Label> collect = labels.stream().filter(e -> "thematic_information_column".equals(e.getLabelMark())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
if (collect.size() == 1) {
removeList.add(specialInformation);
} else {
List<Label> newLabels = new ArrayList<>();
for (Label label : collect) {
String labelRelationId = label.getRelationId();
if (!themeIds.contains(labelRelationId)) {
newLabels.add(label);
}
}
specialInformation.setLabels(newLabels);
dataList.add(specialInformation);
}
specialInformation.setLabels(newLabels);
dataList.add(specialInformation);
} else {
removeList.add(specialInformation);
}
}
}
......
......@@ -80,7 +80,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
private CodeGenerateUtil codeGenerateUtil;
@Autowired
private PythonUtil pythonUtil;
@Autowired
@Autowired(required = false)
private RemoteModelService remoteModelService;
@Value("${clb.subject.default.processing.advanceMonth}")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论