提交 470b0563 作者: 925993793@qq.com

[fix] 研究中心-自定义专题参数校验bug修改

上级 c8ae44dc
......@@ -254,6 +254,7 @@
<result column="time_enable" property="timeEnable"/>
<result column="time_disable" property="timeDisable"/>
<result column="library" property="library"/>
<result column="data_scope" property="dataScope"/>
<result column="face_public" property="facePublic"/>
<result column="first_open_time" property="firstOpenTime"/>
<result column="estimate_status" property="estimateStatus"/>
......@@ -273,6 +274,7 @@
s.data_source,
s.face_public,
s.library,
s.data_scope,
s.estimate_status,
s.first_open_time,
c.id as subjectTypeId,
......
......@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.entity.*;
import com.zzsn.event.enums.BindTypeEnum;
import com.zzsn.event.enums.CodePrefixEnum;
import com.zzsn.event.feign.api.RemoteModelService;
import com.zzsn.event.service.*;
......@@ -252,7 +253,7 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
return false;
}
//判断信息源标签配置是否变化,变化则校验不通过;反之通过
boolean judgeInfoSourceLabel = judgeInfoSourceLabel(subjectId, subjectParamsCheckVO.getSubjectSourceTagVO());
boolean judgeInfoSourceLabel = judgeInfoSourceLabel(subjectId,subjectDetailVO.getDataScope(),subjectParamsCheckVO.getDataScope(), subjectParamsCheckVO.getInfoSourceMainLabelVO());
//判断定向信息源是否发生变化(前端传参),true 是;false 否
boolean directSourceChange = subjectParamsCheckVO.isDirectSourceChange();
return !judgeInfoSourceLabel && !directSourceChange;
......@@ -300,37 +301,39 @@ public class SubjectSimpleServiceImpl implements SubjectSimpleService {
* 判断信息源配置是否发生变化 true 是;false 否
*
* @param subjectId 专题id
* @param subjectSourceTagVO 信息源标签信息(编辑时前端传参)
* @param infoSourceMainLabelVO 信息源标签信息(编辑时前端传参)
* @author lkg
* @date 2025/2/5
*/
private boolean judgeInfoSourceLabel(String subjectId, SubjectSourceTagVO subjectSourceTagVO) {
private boolean judgeInfoSourceLabel(String subjectId, Integer oldDataScope,Integer newDataScope,InfoSourceMainLabelVO infoSourceMainLabelVO) {
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) {
flag = true;
}
if (oldDataScope == null) {
oldDataScope = 0;
}
//是否全选,判断绑定的信息源标签是否发生变化
if (!Objects.equals(newDataScope, oldDataScope)) {
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)) {
LambdaQueryWrapper<SubjectInfoSourceMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectInfoSourceMap::getSubjectId, subjectId);
List<SubjectInfoSourceMap> mapList = subjectInfoSourceMapService.list(queryWrapper);
//判断绑定的信息源标签是否发生变化
if (CollectionUtils.isEmpty(mapList)) {
if (infoSourceMainLabelVO != null && infoSourceMainLabelVO.getInfoSourceLabelItemList().size() > 0) {
flag = true;
}
} else {
//判断 是否绑定信息源标签
List<String> sourceLabelCodeList = mapList.stream().filter(e -> Objects.equals(e.getType(), BindTypeEnum.INFO_SOURCE_MAIN_LABEL.getvalue())).map(SubjectInfoSourceMap::getSourceItemId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceLabelCodeList)) {
if (infoSourceMainLabelVO != null) {
List<String> labelItemCodeSetAll = infoSourceMainLabelVO.getInfoSourceLabelItemList();
if (!sourceLabelCodeList.equals(labelItemCodeSetAll)) {
flag = true;
}
} else {
flag = true;
}
} else {
flag = true;
}
}
}
......
......@@ -37,6 +37,8 @@ public class SubjectDetailVO {
private Integer dataSource;
/**划分专题库*/
private String library;
/**是否全选(1-是;0-否)*/
private Integer dataScope;
/**第一次启用时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
......
......@@ -13,11 +13,14 @@ import java.util.List;
@Data
public class SubjectParamsCheckVO {
/**专题新增参数*/
/**专题基本信息参数*/
private SubjectSimpleVO subjectSimpleVO;
/**(信息源标签)是否全选(1-是;0-否)*/
private Integer dataScope;
/**信息源标签*/
private SubjectSourceTagVO subjectSourceTagVO;
private InfoSourceMainLabelVO infoSourceMainLabelVO;
/**定向信息源是否发生变化*/
private boolean directSourceChange;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论