提交 92eacf11 作者: obcy

【添加事件专题全选信息源接口】

上级 1da1d77d
......@@ -910,6 +910,19 @@ public class SubjectManageController {
Subject subject = subjectService.subjectUpdateScope(subjectId, type, scop);
return Result.OK(subject);
}
/**
* 更新事件subject的数据范围
*
* @param subjectId 专题id
*/
@GetMapping("/eventUpdateScope")
public Result<?> eventUpdateScope(@RequestParam(name = "subjectId") String subjectId,
@RequestParam(name = "type") String type,
@RequestParam(name = "scop", defaultValue = "") String scop
) {
Event subject = subjectService.eventUpdateScope(subjectId, type, scop);
return Result.OK(subject);
}
/**
* 绑定信息源标签数据
......
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -115,6 +112,9 @@ public class Event {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**数据范围(是否是全库) - 采集库全库-1,企业库全库-2,政策库全库-3*/
@TableField(updateStrategy = FieldStrategy.IGNORED) // 忽略更新策略
private String dataScope;
/**
* 修改人id
*/
......@@ -215,6 +215,7 @@ public class Event {
* 是否开启采集(1-是;0-否)
*/
private Integer ynCollect;
/**
* 第一次开启时间
*/
......
......@@ -3,6 +3,7 @@ package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.Subject;
import com.zzsn.event.entity.SubjectStatisticInfo;
import com.zzsn.event.util.tree.Node;
......@@ -206,4 +207,5 @@ public interface SubjectService extends IService<Subject> {
Subject subjectUpdateScope(String subjectId, String type, String scop);
Event eventUpdateScope(String subjectId, String type, String scop);
}
......@@ -106,6 +106,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Autowired
private InfoSourceGroupService infoSourceGroupService;
@Autowired
private IEventService eventService;
@Autowired
private ISubjectInfoSourceMapService iSubjectInfoSourceMapService;
@Autowired
private ParamAop paramAop;
......@@ -1082,6 +1084,50 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
return byId;
}
@Override
public Event eventUpdateScope(String subjectId, String type, String scop) {
Event byId = eventService.getById(subjectId);
// Subject byId = super.getById(subjectId);
if (ObjectUtil.isNotNull(byId)){
String dataScope = byId.getDataScope();
if (StrUtil.isNotBlank(dataScope)){
List<String> scopeList = CollectionUtil.newArrayList(dataScope.split(","));
if (StrUtil.equals(type,"1") && "1".equals(scop)){
scopeList.add("1");
}else if (StrUtil.equals(type,"1") && "0".equals(scop)){
scopeList.remove("1");
}
if (StrUtil.equals(type,"2") && "1".equals(scop)){
scopeList.add("2");
}else if (StrUtil.equals(type,"2") && "0".equals(scop)){
scopeList.remove("2");
}
if (StrUtil.equals(type,"3") && "1".equals(scop)){
scopeList.add("3");
}else if (StrUtil.equals(type,"3") && "0".equals(scop)){
scopeList.remove("3");
}
if (CollectionUtil.isNotEmpty(scopeList)) {
scopeList = scopeList.stream().distinct().collect(Collectors.toList());
String join = StrUtil.join(",", scopeList);
byId.setDataScope(join);
}else {
byId.setDataScope(null);
}
eventService.updateById(byId);
}else {
if ("1".equals(scop)) {
byId.setDataScope(scop);
}
eventService.updateById(byId);
}
}
return byId;
}
private void unBindInfoSourceGroup(SubjectPage subjectPage) {
String sourceBindType = subjectPage.getSourceBindType();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论