提交 ce70b2fb 作者: obcy

【信息源组绑定解绑--信息源变动通知采集逻辑修改】

上级 6ba8a2c5
......@@ -23,6 +23,6 @@ public interface RemoteSystemService {
@GetMapping("/sys/api/listItemByDictCode")
Object getDictList(@RequestParam("dictCode") String dictCode);
String getDictList(@RequestParam("dictCode") String dictCode);
}
......@@ -28,4 +28,6 @@ public interface SubjectAdditionMapper extends BaseMapper<SubjectAddition> {
List<SubjectAddition> pageListBySubjectIdAndType(String subjectId, int type, int offset, Integer pageSize);
int count(String subjectId, int type);
List<String> getSubjectBindInfoSourceIds(@Param("subjectId") String subjectId);
}
......@@ -75,10 +75,10 @@
WHERE
b.id IS NOT NULL
<if test="infoSourceMain.infoAddress!=null and infoSourceMain.infoAddress != ''">
and a.infoAddress like CONCAT('%',#{infoSourceMain.infoAddress},'%')
and a.info_address like CONCAT('%',#{infoSourceMain.infoAddress},'%')
</if>
<if test="infoSourceMain.infoName!=null and infoSourceMain.infoName != ''">
and a.infoName like CONCAT('%',#{infoSourceMain.infoName},'%')
and a.info_name like CONCAT('%',#{infoSourceMain.infoName},'%')
</if>
<if test="infoSourceMain.code!=null and infoSourceMain.code != ''">
and a.code like CONCAT('%',#{infoSourceMain.code},'%')
......
......@@ -251,4 +251,131 @@
select count(1) from subject_addition where subject_id=#{subjectId} and addition_type=#{type}
</select>
<select id="getSubjectBindInfoSourceIds" resultType="java.lang.String">
SELECT
distinct x.id
FROM
(
SELECT
iso.id
FROM
subject_info_source_map sm
INNER JOIN info_source iso ON sm.source_id = iso.id
WHERE
sm.type IN ( 1, 6 )
AND sm.subject_id = #{subjectId} UNION
SELECT
iso.id
FROM
subject_info_source_map sm
INNER JOIN info_source_main im ON im.id = sm.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sm.type IN ( 31, 36 )
AND sm.subject_id = #{subjectId} UNION
SELECT
iso.id
FROM
subject_info_source_map sim
INNER JOIN info_source_group_map m ON m.group_id = sim.source_id
INNER JOIN info_source iso ON m.source_id = iso.id
WHERE
sim.type IN ( 2, 5 )
AND sim.subject_id = #{subjectId} UNION
SELECT
iso.id
FROM
subject_info_source_map sim
INNER JOIN info_source_main_group_map m ON m.group_id = sim.source_id
INNER JOIN info_source_main im ON im.id = m.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sim.type IN ( 32, 35 )
AND sim.subject_id = #{subjectId} UNION
SELECT
isoo.id
FROM
subject_info_source_map smm
INNER JOIN clb_label_info_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source isoo ON lam.entity_code = isoo.id
WHERE
smm.type IN ( 12, 15 )
AND smm.subject_id = #{subjectId} UNION
SELECT
isoo.id
FROM
subject_info_source_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type IN ( 312, 315 )
AND smm.subject_id = #{subjectId}
) x
WHERE
1 = 1
AND x.id NOT IN (
SELECT DISTINCT
y.source_id
FROM
(
SELECT
m.source_id
FROM
info_source_group_map m
WHERE
m.group_id IN ( SELECT source_id FROM subject_info_source_map WHERE type = 4 AND subject_id = #{subjectId} GROUP BY source_id ) UNION
SELECT
iso.id
FROM
subject_info_source_map sim
INNER JOIN info_source_main_group_map m ON m.group_id = sim.source_id
INNER JOIN info_source_main im ON im.id = m.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sim.type = 34
AND sim.subject_id = #{subjectId} UNION
SELECT
sm.source_id
FROM
subject_info_source_map sm
WHERE
type = 3
AND sm.subject_id = #{subjectId} UNION
SELECT
iso.id
FROM
subject_info_source_map sm
INNER JOIN info_source_main im ON im.id = sm.source_id
INNER JOIN info_source iso ON im.id = iso.info_source_id
WHERE
sm.type = 33
AND sm.subject_id = #{subjectId} UNION
SELECT
isoo.id
FROM
subject_info_source_map smm
INNER JOIN clb_label_info_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source isoo ON lam.entity_code = isoo.id
WHERE
smm.type = 14
AND smm.subject_id = #{subjectId} UNION
SELECT
isoo.id
FROM
subject_info_source_map smm
INNER JOIN clb_label_main_source_map lam ON smm.source_id = lam.label_code
AND smm.source_item_id = lam.label_item_code
INNER JOIN info_source_main im ON lam.entity_code = im.id
INNER JOIN info_source isoo ON im.id = isoo.info_source_id
WHERE
smm.type = 314
AND smm.subject_id = #{subjectId}
) y
)
</select>
</mapper>
\ No newline at end of file
......@@ -167,7 +167,7 @@ public class InfoSourceMainServiceImpl extends ServiceImpl<InfoSourceMainMapper,
return jsonObject;
}
private List<SysDictItem> getDictList(String dictCode){
Object dictList = remoteSystemService.getDictList(dictCode);
String dictList = remoteSystemService.getDictList(dictCode);
return JSONUtil.toList(JSONUtil.parseArray(dictList), SysDictItem.class);
}
}
......@@ -1021,6 +1021,18 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
unBindLabels(subjectPage);
}
//解绑信息源组
if (StrUtil.equals(subjectPage.getSourceType(),"4")) {
unBindInfoSourceMainGroup(subjectPage);
}
//解绑信息源
if (StrUtil.equals(subjectPage.getSourceType(),"5")) {
unBindInfoSourceMain(subjectPage);
}
//解绑标签
if (StrUtil.equals(subjectPage.getSourceType(),"6")) {
unBindLabelsMain(subjectPage);
}
configurationMessageService.bindInfoSourceSend(subjectPage.getId());
}
......@@ -1091,6 +1103,27 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
}
}
private void unBindInfoSourceMainGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.INFO_MAIN_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_MAIN_INFO_SOURCE_GROUP.getvalue());
}
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽信息源组
unbindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_MAIN_INFO_SOURCE_GROUP.getvalue());
}
}
private void unBindLabels(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
......@@ -1111,6 +1144,25 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
unBindLabel(subjectPage, BindTypeEnum.EXCLUDE_INFO_SOURCE_LABEL.getvalue());
}
}
private void unBindLabelsMain(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<BindLabelVo> bindLabels = subjectPage.getBindLabels();
if (CollectionUtil.isEmpty(bindLabels)) {
return;
}
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用标签
unBindLabel(subjectPage, BindTypeEnum.INFO_SOURCE_MAIN_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向标签
unBindLabel(subjectPage, BindTypeEnum.DIRECTIONA_INFO_MAIN_SOURCE_LABEL.getvalue());
}
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽标签
unBindLabel(subjectPage, BindTypeEnum.EXCLUDE_INFO_MAIN_SOURCE_LABEL.getvalue());
}
}
private void unBindLabel(SubjectPage subjectPage, Integer type) {
List<BindLabelVo> bindLabels = subjectPage.getBindLabels();
......@@ -1151,6 +1203,25 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
unbindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_INFO_SOURCE.getvalue());
}
}
private void unBindInfoSourceMain(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
List<String> idList = subjectPage.getBindIds();
if (CollectionUtil.isEmpty(idList)) {
return;
}
if (StrUtil.equals(sourceBindType, "1")) {
//解绑通用信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.INFO_MAIN_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType, "2")) {
//解绑定向信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.DIRECTIONA_MAIN_INFO_SOURCE.getvalue());
}
if (StrUtil.equals(sourceBindType, "3")) {
//解绑屏蔽信息源
unbindInfoSource(subjectPage, idList, BindTypeEnum.EXCLUDE_MAIN_INFO_SOURCE.getvalue());
}
}
private void unbindInfoSource(SubjectPage subjectPage, List<String> idList, Integer bindType) {
iSubjectInfoSourceMapService.deleteInfoSourceIds(subjectPage.getId(), idList, bindType);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论