提交 54e28629 作者: 925993793@qq.com

事件服务和平台事件合并

上级 76d0108e
package com.zzsn.event.config.interceptor;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* 拦截token,获取用户信息
*
* @author lkg
* @date 2024/4/29
*/
public class UserInfoInterceptor implements HandlerInterceptor {
@Value("${checkToken.url:}")
private String checkTokenUrl;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
String token = request.getHeader(Constants.HEADER_KEY);
Result<?> result = getUserInfo(token);
Integer code = result.getCode();
if (code == 500) {
returnJson(response, JSON.toJSONString(Result.FAIL(500, "第三方用户验证未通过,请检查令牌是否正确")));
return false;
}
UserVo userVo = JSONObject.parseObject(JSON.toJSONString(result.getResult()), UserVo.class);
UserUtil.setLoginUser(userVo);
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
UserUtil.removeUser();
}
private Result<?> getUserInfo(String token){
Result<?> bean;
try {
String body = HttpRequest.post(checkTokenUrl)
.header(Constants.HEADER_KEY,token)
.execute().body();
bean = JSONObject.parseObject(body, Result.class);
} catch (Exception e) {
bean = Result.FAIL();
}
return bean;
}
private void returnJson(HttpServletResponse response, String json) {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=utf-8");
try (PrintWriter writer = response.getWriter()) {
writer.println(json);
} catch (Exception ignored) {
}
}
}
package com.zzsn.event.config.interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @Description:
* @Author: obcy
* @Date: 2024/4/5
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Bean
public UserInfoInterceptor userInfoInterceptor() {
return new UserInfoInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 添加自定义拦截器,拦截所有路径
registry.addInterceptor(userInfoInterceptor()).addPathPatterns("/**");
}
}
package com.zzsn.event.constant;
public class Constants {
private Constants() { }
//事件专题-redis缓存key前缀
public static final String SUBJECT_ANALYSIS_PRE = "SUBJECT_ANALYSIS::";
//传播路径
......@@ -46,5 +49,14 @@ public class Constants {
//处理后的专题资讯信息存储索引。
public final static String ES_DATA_FOR_SUBJECT = "subjectdatabase_2023";
private Constants() { }
public final static String HEADER_KEY = "X-Access-Token";
//用户-普通用户
public static final Integer COMMON_USER = 2;
//用户-管理员用户
public static final Integer ADMIN_USER = 3;
/*数据权限类型*/
public final static String PERMISSION_SUBJECT = "subject";
}
......@@ -3,25 +3,31 @@ package com.zzsn.event.controller;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventTag;
import com.zzsn.event.entity.SubjectInfoSourceMap;
import com.zzsn.event.entity.*;
import com.zzsn.event.service.*;
import com.zzsn.event.util.HttpUtil;
import com.zzsn.event.util.ObjectUtil;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.*;
import com.zzsn.event.xxljob.entity.KeyWords;
import com.zzsn.event.xxljob.service.IXxlJobInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* 事件后台管理
......@@ -47,6 +53,12 @@ public class EventManageController {
private ISubjectInfoSourceMapService subjectInfoSourceMapService;
@Autowired
private EventRegionMapService eventRegionMapService;
@Autowired
private ISubjectTypeService subjectTypeService;
@Autowired
private ICustomerDataPermissionMapService customerDataPermissionMapService;
@Autowired
private ISysUserDataPermissionService sysUserDataPermissionService;
@Value(("${serviceProject.url:}"))
private String SERVICE_PROJECT_URL;
......@@ -80,6 +92,107 @@ public class EventManageController {
}
/**
* 事件页左侧树
*
* @author lkg
* @date 2024/4/29
*/
@GetMapping("/leftTypeTree")
public Result<?> leftTree() {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
String userId = null;
String customerId = null;
if (category.equals(Constants.COMMON_USER)) {
userId = currentUser.getUserId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = currentUser.getCustomerId();
}
List<SubjectTreeVO> tree = subjectTypeService.subjectAndTypeTree(userId, customerId);
return Result.OK(tree);
}
/**
* 事件页左侧树
*
* @author lkg
* @date 2024/4/29
*/
@GetMapping("/leftCustomerTree")
public Result<?> leftCustomerTree() {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
String userId = null;
String customerId = null;
if (category.equals(Constants.COMMON_USER)) {
userId = currentUser.getUserId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = currentUser.getCustomerId();
}
List<SubjectTreeVO> tree = subjectTypeService.subjectAndCustomerTree(userId,customerId);
return Result.OK(tree);
}
/**
* 分页列表-新平台管理
*
* @param subjectCondition 筛选条件
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
@GetMapping("/newPlatPageList")
public Result<?> newPlatPageList(SubjectCondition subjectCondition,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
if (category.equals(Constants.COMMON_USER)) {
subjectCondition.setUserId(currentUser.getUserId());
} else if (category.equals(Constants.ADMIN_USER)) {
subjectCondition.setCustomerId(currentUser.getCustomerId());
}
IPage<EventNewPlatVO> pageList = eventService.newPlatPageList(subjectCondition, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 分页列表-新平台管理
*
* @param subjectCondition 筛选条件
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
@GetMapping("/newPlatCustomerPageList")
public Result<?> newPlatCustomerPageList(SubjectCondition subjectCondition,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
if (category.equals(Constants.COMMON_USER)) {
subjectCondition.setUserId(currentUser.getUserId());
subjectCondition.setCustomerId(currentUser.getCustomerId());
} else if (category.equals(Constants.ADMIN_USER)) {
if (StringUtils.isEmpty(subjectCondition.getCustomerId()) || "0".equals(subjectCondition.getCustomerId())) {
subjectCondition.setCustomerId(currentUser.getCustomerId());
}
}
if ("0".equals(subjectCondition.getCustomerId())) {
subjectCondition.setCustomerId(null);
}
IPage<EventNewPlatVO> pageList = eventService.newPlatCustomerPageList(subjectCondition, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 地域信息-树型结构
*
* @param type 类别(1-国际;2-国内)
......@@ -102,9 +215,18 @@ public class EventManageController {
@ApiOperation(value = "事件-添加", notes = "事件-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody AddEventParam eventParam) {
UserVo currentUser = UserUtil.getLoginUser();
eventParam.setCreateTime(new Date());
eventParam.setUpdateTime(new Date());
Event event = eventService.saveMain(eventParam);
//新建的专题授权给自己和客户
if (currentUser.getCategory().equals(Constants.ADMIN_USER)) {
customerDataPermissionMapService.save(new CustomerDataPermissionMap().setCustomerId(currentUser.getCustomerId()).setPermissionId(event.getId()).setCategory(Constants.PERMISSION_SUBJECT));
}
if (currentUser.getCategory().equals(Constants.COMMON_USER)) {
sysUserDataPermissionService.save(new SysUserDataPermission().setUserId(currentUser.getUserId()).setPermissionId(event.getId()).setCategory(Constants.PERMISSION_SUBJECT));
customerDataPermissionMapService.save(new CustomerDataPermissionMap().setCustomerId(currentUser.getCustomerId()).setPermissionId(event.getId()).setCategory(Constants.PERMISSION_SUBJECT));
}
//插入xxlJob
iXxlJobInfoService.subjectInsert(event);
return Result.OK();
......@@ -139,6 +261,9 @@ public class EventManageController {
public Result<?> delete(@RequestParam(name = "id") String id) {
Event event = eventService.getById(id);
iXxlJobInfoService.deleteByInfosourceCode(event.getEventCode());
//删除数据权限关系
customerDataPermissionMapService.remove(Wrappers.<CustomerDataPermissionMap>lambdaQuery().eq(CustomerDataPermissionMap::getPermissionId, id));
sysUserDataPermissionService.remove(Wrappers.<SysUserDataPermission>lambdaQuery().eq(SysUserDataPermission::getPermissionId, id));
eventService.deleteMain(id);
return Result.OK();
}
......@@ -198,6 +323,28 @@ public class EventManageController {
/**
* 项目列表
*
* @author lkg
* @date 2024/4/29
*/
@GetMapping("/projectList")
public Result<?> projectList() {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
String userId = null;
String customerId = null;
if (category.equals(Constants.COMMON_USER)) {
userId = currentUser.getUserId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = currentUser.getCustomerId();
}
List<Node> projectList = eventService.projectList(userId, customerId);
return Result.OK(projectList);
}
/**
* 2.1 专题信息源绑定
*/
@PostMapping("/infoSourceBind")
......
package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.CustomerDataPermissionMap;
import com.zzsn.event.entity.SubjectType;
import com.zzsn.event.entity.SubjectTypeMap;
import com.zzsn.event.entity.SysUserDataPermission;
import com.zzsn.event.service.ICustomerDataPermissionMapService;
import com.zzsn.event.service.ISubjectTypeMapService;
import com.zzsn.event.service.ISubjectTypeService;
import com.zzsn.event.service.ISysUserDataPermissionService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 事件后台管理-事件分类
*
* @author lkg
* @date 2024/4/29
*/
@Slf4j
@Api(tags = "-事件分类")
@RestController
@RequestMapping("/manage/subjectType")
public class EventTypeController {
@Autowired
private ISubjectTypeService subjectTypeService;
@Autowired
private ISubjectTypeMapService subjectTypeMapService;
@Autowired
private ICustomerDataPermissionMapService customerDataPermissionMapService;
@Autowired
private ISysUserDataPermissionService sysUserDataPermissionService;
/**
* 事件分类列表-树型结构
*
* @author lkg
* @date 2024/4/28
*/
@GetMapping("/list")
public Result<?> typeList() {
//获取当前登录用户
UserVo currentUser = UserUtil.getLoginUser();
Integer category = currentUser.getCategory();
String userId = null;
String customerId = null;
if (category.equals(Constants.COMMON_USER)) {
userId = currentUser.getUserId();
} else if (category.equals(Constants.ADMIN_USER)) {
customerId = currentUser.getCustomerId();
}
List<Node> nodes = subjectTypeService.enableList(userId,customerId);
List<Node> tree = TreeUtil.tree(nodes, "0");
return Result.OK(tree);
}
/**
* 新增专题分类
*
* @param subjectType 专题分类
* @author lkg
* @date 2024/4/29
*/
@PostMapping("/add")
public Result<?> addSubjectType(@RequestBody SubjectType subjectType) {
UserVo currentUser = UserUtil.getLoginUser();
String pid = subjectType.getPid();
if (!"0".equals(pid)) {
int count = subjectTypeMapService.count(new LambdaQueryWrapper<SubjectTypeMap>().eq(SubjectTypeMap::getTypeId, pid));
if (count > 0) {
return Result.FAIL(501, "当前分类下存在专题");
}
}
subjectType.setCustomerId(currentUser.getCustomerId());
subjectTypeService.add(subjectType);
//权限
if (currentUser.getCategory().equals(Constants.ADMIN_USER)) {
customerDataPermissionMapService.save(new CustomerDataPermissionMap().setCustomerId(currentUser.getCustomerId()).setPermissionId(subjectType.getId()).setCategory(Constants.PERMISSION_SUBJECT));
}
if (currentUser.getCategory().equals(Constants.COMMON_USER)) {
sysUserDataPermissionService.save(new SysUserDataPermission().setUserId(currentUser.getUserId()).setPermissionId(subjectType.getId()).setCategory(Constants.PERMISSION_SUBJECT));
customerDataPermissionMapService.save(new CustomerDataPermissionMap().setCustomerId(currentUser.getCustomerId()).setPermissionId(subjectType.getId()).setCategory(Constants.PERMISSION_SUBJECT));
}
return Result.OK();
}
/**
* 编辑
*
* @param subjectType 专题分类
* @author lkg
* @date 2024/4/29
*/
@PostMapping("/edit")
public Result<?> edit(@RequestBody SubjectType subjectType){
subjectTypeService.edit(subjectType);
return Result.OK();
}
/**
* 删除
*
* @param id 专题分类id
* @author lkg
* @date 2024/4/29
*/
@GetMapping("/delete")
public Result<?> delete(@RequestParam String id){
int count = subjectTypeMapService.count(new LambdaQueryWrapper<SubjectTypeMap>().eq(SubjectTypeMap::getTypeId, id));
if (count > 0) {
return Result.FAIL(501, "当前分类下存在专题");
}
//删除数据权限关系
customerDataPermissionMapService.remove(Wrappers.<CustomerDataPermissionMap>lambdaQuery().eq(CustomerDataPermissionMap::getPermissionId, id));
sysUserDataPermissionService.remove(Wrappers.<SysUserDataPermission>lambdaQuery().eq(SysUserDataPermission::getPermissionId, id));
subjectTypeService.delete(id);
return Result.OK();
}
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* Description: 客户-数据权限关系表
* Author: EDY
* Date: 2023/8/1
*/
@Data
@TableName("customer_data_permission_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="customer_data_permission_map-客户-数据权限关系表", description="客户-数据权限关系表")
public class CustomerDataPermissionMap {
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键id")
private String id;
@ApiModelProperty(value = "客户id")
private String customerId;
@ApiModelProperty(value = "数据权限id")
private String permissionId;
@ApiModelProperty(value = "数据权限类型(project-项目;subject-专题;group-信息源组;keyword-关键词组;channel-栏目)")
private String category;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -33,6 +33,10 @@ public class Event {
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "ID")
private String id;
/**编码*/
@Excel(name = "编码", width = 15)
@ApiModelProperty(value = "编码")
private String eventCode;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
......@@ -57,20 +61,10 @@ public class Event {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束时间")
private Date endTime;
/**事件地域*/
@Excel(name = "事件地域", width = 15)
@ApiModelProperty(value = "事件地域")
private String eventArea;
private String eventAreaId;
/**标签*/
@Excel(name = "标签", width = 15)
@ApiModelProperty(value = "标签")
private String eventLabel;
private String eventLabelIds;
/**关键词*/
@Excel(name = "关键词", width = 15)
@ApiModelProperty(value = "关键词")
private String eventKeywords;
/**是否公开*/
@Excel(name = "是否公开", width = 15)
@ApiModelProperty(value = "是否公开")
......@@ -99,18 +93,34 @@ public class Event {
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private String updateBy;
/**状态(0-禁用;1-启用)*/
private Integer status=1;
/**
* 分析事件脉络-最新资讯的时间
* 专题最近一次分析时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date analysisTime;
/**
* 分析事件脉络-最新资讯的时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date eventTime;
@TableField(exist = false)
private String typeName;
private String eventCode;
/**划分专题库*/
@Excel(name = "划分专题库", width = 15, dicCode = "Thematic_Library")
@ApiModelProperty(value = "划分专题库")
private String library;
/**定时单位(1分;2小时;3日;4月)*/
@ApiModelProperty(value = "定时单位")
private String unit;
/**定时数值*/
@ApiModelProperty(value = "定时数值")
private Integer space;
/**cron表达式*/
@ApiModelProperty(value = "cron表达式")
private String cron;
/**是否提取热词*/
@ApiModelProperty(value = "是否提取热词")
private String ynExtractHotWords;
/**事件专题增量分析规则*/
@ApiModelProperty(value = "事件专题增量分析规则")
private Integer increAnaRule;
......@@ -120,16 +130,28 @@ public class Event {
/**事件专题时间间隔分析规则(天)*/
@ApiModelProperty(value = "事件专题时间间隔分析规则(天)")
private Integer timeAnaRule;
/**总热度*/
private Integer totalHot;
/**媒体热度*/
private Integer mediaHot;
/**微信热度*/
private Integer wechatHot;
/**其他热度*/
private Integer otherHot;
/**发布状态(0-未发布;1-已发布)*/
private Integer publishStatus;
/**发布状态(0-未发布;1-已发布)*/
private String relationEvents;
/**发布时间*/
private String publishDate;
/**排序号*/
private Integer sortOrder;
@TableField(exist = false)
private String typeName;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
......
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 项目专题关联表
* @Author: jeecg-boot
* @Date: 2021-12-20
* @Version: V1.0
*/
@Data
@TableName("project_subject_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="project_subject_map对象", description="项目专题关联表")
public class ProjectSubjectMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**项目id*/
@Excel(name = "项目id", width = 15)
@ApiModelProperty(value = "项目id")
private String projectId;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 专题类别
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Data
@TableName("subject_type")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="subject_type对象", description="专题类别")
public class SubjectType implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**类别名称*/
@Excel(name = "类别名称", width = 15)
@ApiModelProperty(value = "类别名称")
private String typeName;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**父级节点*/
@Excel(name = "父级节点", width = 15)
@ApiModelProperty(value = "父级节点")
private String pid;
/**是否有子节点*/
@Excel(name = "是否有子节点", width = 15, dicCode = "yn")
@ApiModelProperty(value = "是否有子节点")
private String hasChild;
/**专题分类类型(1:通用专题 2:事件专题)*/
@Excel(name = "专题分类类型(1:通用专题 2:事件专题)", width = 15)
@ApiModelProperty(value = "专题分类类型(1:通用专题 2:事件专题)")
private Integer category;
/**所属客户*/
@ApiModelProperty(value = "所属客户")
private String customerId;
/**
* 状态(1启用 0不启用)
*/
private Integer status;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 专题与类别关联表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Data
@TableName("subject_type_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="subject_type_map对象", description="专题与类别关联表")
public class SubjectTypeMap implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**专题id*/
@Excel(name = "专题id", width = 15)
@ApiModelProperty(value = "专题id")
private String subjectId;
/**类别id*/
@Excel(name = "类别id", width = 15)
@ApiModelProperty(value = "类别id")
private String typeId;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
}
package com.zzsn.event.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @author lkg
* @description: 用户数据权限
* @date 2022/6/20 11:59
*/
@Data
@TableName("sys_user_data_permission")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="sys_user_data_permission对象", description="用户数据权限表")
public class SysUserDataPermission implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**用户id*/
@Excel(name = "用户id", width = 15)
@ApiModelProperty(value = "用户id")
private String userId;
/**权限id*/
@Excel(name = "权限id", width = 15)
@ApiModelProperty(value = "权限id")
private String permissionId;
/**权限类别*/
@Excel(name = "权限类别", width = 15)
@ApiModelProperty(value = "权限类别")
private String category;
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.CustomerDataPermissionMap;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerDataPermissionMapMapper extends BaseMapper<CustomerDataPermissionMap> {
}
......@@ -2,6 +2,7 @@ package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.Event;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -98,6 +99,45 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("type") Integer type);
/**
* 分页列表(专题分类)-新平台管理
*
* @param subjectCondition 筛选条件
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
List<EventNewPlatVO> newPlatPageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量(专题分类)-新平台管理
*
* @param subjectCondition 筛选条件
* @author lkg
* @date 2024/4/28
*/
Integer newPlatCount(@Param("subjectCondition") SubjectCondition subjectCondition);
/**
* 分页列表(客户)-新平台管理
*
* @param subjectCondition 筛选条件
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/30
*/
List<EventNewPlatVO> newPlatCustomerPageList(@Param("subjectCondition") SubjectCondition subjectCondition, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量(客户)-新平台管理
*
* @param subjectCondition 筛选条件
* @author lkg
* @date 2024/4/28
*/
Integer newPlatCustomerCount(@Param("subjectCondition") SubjectCondition subjectCondition);
/**
* 热点事件列表-前10
*
* @param startTime 开始时间
......@@ -149,4 +189,42 @@ public interface EventMapper extends BaseMapper<Event> {
* @date 2024/4/12
*/
List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList);
/**
* 专题绑定关键词数量
*
* @param idList 专题id集合
* @author lkg
* @date 2024/4/28
*/
List<SubjectPage> bindKeywordCountList(@Param("idList") List<String> idList);
/**
* 专题绑定的信息源集合
*
* @param subjectIds 专题id
* @author lkg
* @date 2024/4/24
*/
List<SubjectSourceVO> bindSourceList(@Param("subjectIds") List<String> subjectIds);
/**
* 专题绑定的信息源集合
*
* @param subjectIds 专题id
* @author lkg
* @date 2024/4/24
*/
List<SubjectSourceVO> excludeSourceList(@Param("subjectIds") List<String> subjectIds);
/**
* 项目列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<Node> projectList(@Param("userId") String userId, @Param("customerId") String customerId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.ProjectSubjectMap;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 项目专题关联表
* @Author: jeecg-boot
* @Date: 2021-12-20
* @Version: V1.0
*/
@Mapper
public interface ProjectSubjectMapMapper extends BaseMapper<ProjectSubjectMap> {
void deleteBySubjectId (@Param("subjectId") String subjectId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectTypeMap;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 专题与类别关联表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Mapper
public interface SubjectTypeMapMapper extends BaseMapper<SubjectTypeMap> {
void deleteBySubjectId (@Param("subjectId") String subjectId);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SubjectType;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.SubjectTreeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 专题类别
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Mapper
public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
/**
* 可用的专题分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<Node> enableList(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 可用的专题和专题分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<SubjectTreeVO> subjectAndTypeTree(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 可用的专题和客户列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/30
*/
List<SubjectTreeVO> subjectAndCustomerTree(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 可用客户信息列表
*
* @param customerId 客户id
* @author lkg
* @date 2024/4/30
*/
List<SubjectTreeVO> enableCustomerList(@Param("customerId") String customerId);
/**
* 更新分类是否有子节点状态
*
* @param id 分类id
* @param hasChild 是否有子节点
* @author lkg
* @date 2024/4/29
*/
void updateTreeNodeStatus(@Param("id") String id, @Param("hasChild") Integer hasChild);
}
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.SysUserDataPermission;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lkg
* @description:
* @date 2022/6/20 14:10
*/
@Mapper
public interface SysUserDataPermissionMapper extends BaseMapper<SysUserDataPermission> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.ProjectSubjectMapMapper">
<delete id="deleteBySubjectId" >
delete from project_subject_map WHERE subject_id = #{subjectId}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectTypeMapMapper">
<delete id="deleteBySubjectId" >
delete from subject_type_map WHERE subject_id = #{subjectId}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsn.event.mapper.SubjectTypeMapper">
<select id="enableList" resultType="com.zzsn.event.util.tree.Node">
select s.id,s.type_name as name,s.pid from subject_type s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.category = 2 and s.status = 1
</select>
<select id="subjectAndTypeTree" resultType="com.zzsn.event.vo.SubjectTreeVO">
select s.id,s.type_name as name,s.pid,'false' as ynSubject from subject_type s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.category = 2 and s.status = 1
union
select n.id,n.name,m.id as pid,'true' as ynSubject from
(
select s.id,s.type_name as name,s.pid from subject_type s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.category = 2 and s.status = 1
) m
inner join subject_type_map stm on m.id = stm.type_id
inner join
(
select s.id,s.event_name as name from event s
<if test="userId !=null and userId != ''">
inner join sys_user_data_permission dp on s.id=dp.permission_id and dp.user_id = #{userId}
</if>
<if test="customerId !=null and customerId != ''">
inner join customer_data_permission_map mp on s.id=mp.permission_id and mp.customer_id = #{customerId}
</if>
where s.status = 1
) n on stm.subject_id = n.id
</select>
<select id="subjectAndCustomerTree" resultType="com.zzsn.event.vo.SubjectTreeVO">
select c.id, c.event_name as name, m.id as pid, 'true' as ynSubject
from event c inner join
(
select a.id, b.permission_id
from customer_data_permission_map b
inner join customer a on b.customer_id = a.id and a.status = 1
and a.is_delete = 0 and b.category = 'subject'
<if test="userId !=null and userId != ''">
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
where user_id = #{userId}
)
</if>
) m
on c.id = m.permission_id
where c.status = 1
<if test="customerId !=null and customerId != ''">
and m.id = #{customerId}
</if>
</select>
<select id="enableCustomerList" resultType="com.zzsn.event.vo.SubjectTreeVO">
select id,customer_name as name,'0' as pid,'false' as ynSubject from customer where status = 1 and is_delete = 0
<if test="customerId!=null and customerId != ''">
and id = #{customerId}
</if>
</select>
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
update subject_type
set has_child = #{hasChild}
where id = #{id}
</update>
</mapper>
\ No newline at end of file
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.CustomerDataPermissionMap;
/**
* @Description: 客户表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
public interface ICustomerDataPermissionMapService extends IService<CustomerDataPermissionMap> {
}
......@@ -3,8 +3,8 @@ package com.zzsn.event.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.Event;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
......@@ -64,6 +64,28 @@ public interface IEventService extends IService<Event> {
IPage<EventFrontVO> frontPageList(String eventName, Integer eventType,String labelField, String labelName, String order, String orderType, Integer pageNo, Integer pageSize);
/**
* 分页列表(专题类别)-新平台管理
*
* @param subjectCondition 筛选条件
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
IPage<EventNewPlatVO> newPlatPageList(SubjectCondition subjectCondition,Integer pageNo, Integer pageSize);
/**
* 分页列表(客户)-新平台管理
*
* @param subjectCondition 筛选条件
* @param pageNo 当前页
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/28
*/
IPage<EventNewPlatVO> newPlatCustomerPageList(SubjectCondition subjectCondition,Integer pageNo, Integer pageSize);
/**
* 热点事件列表-前10
*
* @param startTime 开始时间
......@@ -119,4 +141,14 @@ public interface IEventService extends IService<Event> {
* @date 2024/4/12
*/
List<EventVO> eventList(List<String> eventIdList);
/**
* 项目列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<Node> projectList(String userId, String customerId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.ProjectSubjectMap;
/**
* @Description: 项目专题关联表
* @Author: jeecg-boot
* @Date: 2021-12-20
* @Version: V1.0
*/
public interface IProjectSubjectMapService extends IService<ProjectSubjectMap> {
/**根据专题id删除*/
void deleteBySubjectId (String subjectId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectTypeMap;
/**
* @Description: 专题与类别关联表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
public interface ISubjectTypeMapService extends IService<SubjectTypeMap> {
/**根据专题id删除*/
void deleteBySubjectId (String subjectId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SubjectType;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.SubjectTreeVO;
import java.util.List;
/**
* @Description: 专题类别
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
public interface ISubjectTypeService extends IService<SubjectType> {
/**
* 可用的专题分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<Node> enableList(String userId,String customerId);
/**
* 获取分类下的所有节点id集合
*
* @param typeId 分类id
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<String> belowIdList(String typeId,String userId,String customerId);
/**
* 新增专题分类
*
* @param subjectType 专题分类
* @author lkg
* @date 2024/4/29
*/
void add(SubjectType subjectType);
/**
* 编辑专题分类
*
* @param subjectType 专题分类
* @author lkg
* @date 2024/4/29
*/
void edit(SubjectType subjectType);
/**
* 删除专题分类
*
* @param typeId 专题分类id
* @author lkg
* @date 2024/4/29
*/
void delete(String typeId);
/**
* 可用的专题和专题分类列表
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/4/29
*/
List<SubjectTreeVO> subjectAndTypeTree(String userId, String customerId);
/**
* 可用的专题和客户列表
*
* @param customerId 客户id
* @author lkg
* @date 2024/4/30
*/
List<SubjectTreeVO> subjectAndCustomerTree(String userId,String customerId);
}
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.SysUserDataPermission;
/**
* @author lkg
* @description:
* @date 2022/6/20 14:10
*/
public interface ISysUserDataPermissionService extends IService<SysUserDataPermission> {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.CustomerDataPermissionMap;
import com.zzsn.event.mapper.CustomerDataPermissionMapMapper;
import com.zzsn.event.service.ICustomerDataPermissionMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 客户表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Service
public class CustomerDataPermissionMapImpl extends ServiceImpl<CustomerDataPermissionMapMapper, CustomerDataPermissionMap> implements ICustomerDataPermissionMapService {
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.ProjectSubjectMap;
import com.zzsn.event.mapper.ProjectSubjectMapMapper;
import com.zzsn.event.service.IProjectSubjectMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 项目专题关联表
* @Author: jeecg-boot
* @Date: 2021-12-20
* @Version: V1.0
*/
@Service
public class ProjectSubjectMapServiceImpl extends ServiceImpl<ProjectSubjectMapMapper, ProjectSubjectMap> implements IProjectSubjectMapService {
@Override
public void deleteBySubjectId (String subjectId){
baseMapper.deleteBySubjectId(subjectId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectTypeMap;
import com.zzsn.event.mapper.SubjectTypeMapMapper;
import com.zzsn.event.service.ISubjectTypeMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 专题与类别关联表
* @Author: jeecg-boot
* @Date: 2021-12-01
* @Version: V1.0
*/
@Service
public class SubjectTypeMapServiceImpl extends ServiceImpl<SubjectTypeMapMapper, SubjectTypeMap> implements ISubjectTypeMapService {
@Override
public void deleteBySubjectId(String subjectId) {
baseMapper.deleteBySubjectId(subjectId);
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SubjectType;
import com.zzsn.event.mapper.SubjectTypeMapper;
import com.zzsn.event.service.ISubjectTypeService;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.util.tree.TreeUtil;
import com.zzsn.event.vo.SubjectTreeVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
*
*
* @author lkg
* @date 2024/4/28
*/
@Service
public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, SubjectType> implements ISubjectTypeService {
@Override
public List<Node> enableList(String userId,String customerId) {
return baseMapper.enableList(userId,customerId);
}
@Override
public List<String> belowIdList(String typeId,String userId,String customerId) {
List<Node> nodes = this.enableList(userId,customerId);
return TreeUtil.belowList(nodes, typeId, true);
}
@Override
public void add(SubjectType subjectType) {
if (StringUtils.isEmpty(subjectType.getPid())) {
subjectType.setPid("0");
} else {
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
SubjectType parent = baseMapper.selectById(subjectType.getPid());
if (parent != null && !"1".equals(parent.getHasChild())) {
parent.setHasChild("1");
baseMapper.updateById(parent);
}
}
subjectType.setCreateTime(new Date());
baseMapper.insert(subjectType);
}
@Override
public void edit(SubjectType subjectType) {
SubjectType entity = this.getById(subjectType.getId());
String old_pid = entity.getPid();
String new_pid = subjectType.getPid();
if (!old_pid.equals(new_pid)) {
updateOldParentNode(old_pid);
if (StringUtils.isEmpty(new_pid)) {
subjectType.setPid("0");
}
if (!"0".equals(subjectType.getPid())) {
baseMapper.updateTreeNodeStatus(subjectType.getPid(), 0);
}
}
baseMapper.updateById(subjectType);
}
@Override
@Transactional
public void delete(String typeId) {
SubjectType byId = getById(typeId);
String pid = byId.getPid();
baseMapper.deleteById(typeId);
LambdaQueryWrapper<SubjectType> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectType::getPid,pid);
Integer count = baseMapper.selectCount(queryWrapper);
if (count == 0) {
baseMapper.updateTreeNodeStatus(pid,0);
}
}
@Override
public List<SubjectTreeVO> subjectAndTypeTree(String userId, String customerId) {
List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree(userId, customerId);
List<SubjectTreeVO> tree = TreeUtil.tree(subjectTreeVOS, "0");
tree.forEach(this::subjectNumCount);
return tree;
}
@Override
public List<SubjectTreeVO> subjectAndCustomerTree(String userId,String customerId) {
List<SubjectTreeVO> subjectTreeVOS = baseMapper.enableCustomerList(customerId);
List<SubjectTreeVO> list = baseMapper.subjectAndCustomerTree(userId,customerId);
subjectTreeVOS.addAll(list);
List<SubjectTreeVO> tree = TreeUtil.tree(subjectTreeVOS, "0");
tree.forEach(this::subjectNumCount);
return tree;
}
private void subjectNumCount(SubjectTreeVO subjectTreeVO) {
Boolean ynSubject = subjectTreeVO.getYnSubject();
if (!ynSubject) {
int num = 0;
List<? extends Node> children = subjectTreeVO.getChildren();
if (CollectionUtils.isNotEmpty(children)) {
for (Node node : children) {
SubjectTreeVO subjectTreeNode = (SubjectTreeVO)node;
subjectNumCount(subjectTreeNode);
num = num + 1;
}
subjectTreeVO.setSubjectCount(num);
}
}
}
private void updateOldParentNode(String pid) {
if (!"0".equals(pid)) {
Integer count = baseMapper.selectCount(new QueryWrapper<SubjectType>().eq("pid", pid));
if (count == null || count <= 1) {
baseMapper.updateTreeNodeStatus(pid, 0);
}
}
}
}
package com.zzsn.event.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.SysUserDataPermission;
import com.zzsn.event.mapper.SysUserDataPermissionMapper;
import com.zzsn.event.service.ISysUserDataPermissionService;
import org.springframework.stereotype.Service;
/**
* @author lkg
* @description:
* @date 2022/6/20 14:10
*/
@Service
public class SysUserDataPermissionServiceImpl extends ServiceImpl<SysUserDataPermissionMapper, SysUserDataPermission> implements ISysUserDataPermissionService {
}
......@@ -67,4 +67,31 @@ public class ObjectUtil {
}
return map;
}
/**
* 对象转map
*
* @param obj: 对象
* @author lkg
* @date 2023/2/17
*/
public static Map<String, Object> objectMap(Object obj) {
Map<String, Object> map = new HashMap<>();
if (obj == null) {
return map;
}
Class clazz = obj.getClass();
Field[] fields = clazz.getDeclaredFields();
try {
for (Field field : fields) {
field.setAccessible(true);
if(field.get(obj)!=null){
map.put(field.getName(), field.get(obj));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
}
package com.zzsn.event.util.user;
/**
* 用户信息
*
* @author lkg
* @date 2023/4/12
*/
public abstract class UserUtil {
private static final ThreadLocal<UserVo> USER_THREAD_LOCAL = new ThreadLocal<>();
public static UserVo getLoginUser(){
return USER_THREAD_LOCAL.get();
}
public static void setLoginUser(UserVo userVo) {
USER_THREAD_LOCAL.set(userVo);
}
public static void removeUser(){USER_THREAD_LOCAL.remove();}
}
package com.zzsn.event.util.user;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
public class UserVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
private String userId;
/**
* 账号名
*/
private String username;
/**
* 真实姓名
*/
private String name;
/**
* 1-超级用户;2-普通用户;3-管理员用户(租户下)
*/
private Integer category;
/**
* 客户id
*/
private String customerId;
}
......@@ -7,11 +7,10 @@ import java.util.List;
@Data
public class AddEventParam extends Event {
private String corn;
//0 do not 1 do 1
private Integer extractHotWords;
// time unit minute
private Integer period;
/**事件地域信息*/
List<RegionVO> regionList;
/**事件分类id*/
private String subjectTypeId;
/**项目id*/
private String projectId;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
*
*
* @author lkg
* @date 2024/4/28
*/
@Data
public class EventNewPlatVO {
private String id;
private String eventName;
private Integer subjectInfoNum;
private Integer unCheckNum;
private Integer infoSourceNum;
private Integer keyWordsNum;
private String subjectTypeName;
private String projectName;
}
......@@ -38,6 +38,24 @@ public class EventVO {
private String eventType;
/**事件分类名称*/
private String typeName;
/**划分专题库*/
private String library;
/**定时单位(1分;2小时;3日:4月)*/
private String unit;
/**定时数值*/
private Integer space;
/***cron表达式*/
private String cron;
/**是否提取热词*/
private String ynExtractHotWords;
/**专题分类id*/
private String subjectTypeId;
/**项目id*/
private String projectId;
/**排序号*/
private Integer sortOrder;
/**是否生成分析报告*/
private Boolean hasReport;
......
package com.zzsn.event.vo;
import lombok.Data;
import java.util.List;
/**
* @author lkg
* @description: 专题查询条件封装类
* @date 2022/6/21 20:00
*/
@Data
public class SubjectCondition {
/**专题id*/
private String id;
/**专题名称*/
private String subjectName;
/**项目id*/
private String projectId;
/**专题分类id(父节点)*/
private String subjectTypeId;
/**专题分类集合(父节点下子节点集合)*/
private List<String> typeIds;
/**状态*/
private Integer status;
/**开始时间*/
private String startTime;
/**结束时间*/
private String endTime;
/**用户id*/
private String userId;
/**客户id*/
private String customerId;
}
package com.zzsn.event.vo;
import lombok.Data;
/**
*
*
* @author lkg
* @date 2024/4/28
*/
@Data
public class SubjectSourceVO {
private String subjectId;
private String sourceId;
}
package com.zzsn.event.vo;
import com.zzsn.event.util.tree.Node;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author lkg
* @date 2024/4/29
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SubjectTreeVO extends Node {
private Boolean ynSubject;
private Integer subjectCount=0;
}
......@@ -123,6 +123,8 @@ scheduling:
enable: false
serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/
checkToken:
url: https://clb.ciglobal.cn/clb-api/sys/checkToken
scoreRule:
weekScore: 10
monthScore: 5
......
......@@ -120,6 +120,8 @@ scheduling:
enable: true
serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/
checkToken:
url: https://clb.ciglobal.cn/clb-api/sys/checkToken
scoreRule:
weekScore: 10
monthScore: 5
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论