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

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

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