提交 8745bf08 作者: 925993793@qq.com

Merge remote-tracking branch 'origin/test' into test

...@@ -25,7 +25,6 @@ target/ ...@@ -25,7 +25,6 @@ target/
/dist/ /dist/
/nbdist/ /nbdist/
/.nb-gradle/ /.nb-gradle/
build/
!**/src/main/**/build/ !**/src/main/**/build/
!**/src/test/**/build/ !**/src/test/**/build/
......
FROM swr.cn-southwest-2.myhuaweicloud.com/wd/maven:3.6.1-jdk-8-alpine AS builder
USER root
WORKDIR /workspace
COPY . .
RUN mvn clean install -DskipTests
FROM swr.cn-southwest-2.myhuaweicloud.com/wd/openjdk:8-jdk-alpine3.9
MAINTAINER lixingyu
USER root
WORKDIR /workspace
COPY --from=builder /workspace/target/*.jar /workspace/app.jar
ARG ENV_NAME
ARG PORT
ENV APP_OPTS1="-Dspring.profiles.active=${ENV_NAME}"
ENV APP_OPTS2="-Djasypt.encryptor.password=1@wdLkj90#chMsdzxA%2024"
ENV APP_OPTS3="-Dfile.encoding=utf-8"
ENV APP_OPTS4="-Duser.timezone=Asia/Shanghai"
ENV JVM_OPTS="-Xmx2024M -Xms256M"
EXPOSE ${PORT}
ENTRYPOINT ["sh","-c","java $APP_OPTS1 $APP_OPTS2 $APP_OPTS3 $APP_OPTS4 -jar $JVM_OPTS /workspace/app.jar"]
\ No newline at end of file
#!/bin/bash
# build.sh - 功能包括:镜像构建,推送镜像,处理none镜像。
# author: lixingyu
# 使用方法:
# $ ./build.sh <env_name> <build_timestamp>
# 参数:
# env_name:环境变量 build_timestamp:构建时间戳
set -eu
# 获取脚本的绝对路径(包括文件名)
script_path=$(readlink -f "$0")
# 获取脚本所在的目录的绝对路径
script_dir=$(dirname "$script_path")
# 函数定义
function print_usage {
# 打印使用说明
sed -n '2,7p' "$0"
}
function handle {
local env_name=$1
local build_timestamp=$2
echo "执行的环境变量: ${env_name}"
echo "执行的构建时间戳: ${build_timestamp}"
if [ ! -f "$script_dir/env/env.${env_name}" ]; then
echo "错误: 文件 'env.${env_name}' 不存在." >&2
exit 1
fi
. $script_dir/env/env.${env_name}
local username="${repo_username}"
local passwd="${repo_passwd}"
local dir="${root_dir}/${svc_name}/${svc_env}"
local name="${svc_name}-${svc_env}"
local version=${version}-${build_timestamp}
echo "构建名称: ${name}"
echo "构建端口: ${svc_port}"
echo "构建版本: ${version}"
echo "推送仓库: ${domain}/${namespace}"
echo "完整镜像: ${domain}/${namespace}/${name}:${version}"
echo "---构建镜像---"
docker build --build-arg ENV_NAME=${svc_env} --build-arg PORT=${svc_port} -f ./build/Dockerfile -t ${domain}/${namespace}/${name}:${version} .
echo "---推送镜像---"
docker login -u=$username -p=${passwd} ${domain}
docker push ${domain}/${namespace}/${name}:${version}
echo "---清理none镜像---"
docker image prune -af
}
# 主程序入口点
function main {
if [ "$#" -ne 2 ]; then
print_usage
echo "错误: 需要提供两个个参数 <env_name> <build_timestamp>" >&2
exit 1
fi
local env_name=$1
local build_timestamp=$2
handle "${env_name}" "${build_timestamp}"
}
# 错误处理
trap 'echo 发生了错误,脚本中断.' ERR
# 调用主函数
main "$@"
# 镜像仓库
# 版本 T1.0.0: T为测试版,R为稳定版
version="T1.0.0" # 可自定义
# 镜像仓库地址
domain="swr.cn-southwest-2.myhuaweicloud.com"
# 镜像分组,按部门区分
namespace="wd"
# 服务配置
# 数据挂载根目录
root_dir="/zzsn"
# 需根据日志配置填写,比如:logback-spring.xml
svc_logs="/workspace/logs"
# 环境变量 test or prod
svc_env="pro"
# 服务名
svc_name="event-analysis"
# 服务端口
svc_port="1688"
# 镜像仓库
# 版本 T1.0.0: T为测试版,R为稳定版
version="T1.0.0" # 可自定义
# 镜像仓库地址
domain="swr.cn-southwest-2.myhuaweicloud.com"
# 镜像分组,按部门区分
namespace="wd"
# 服务配置
# 数据挂载根目录
root_dir="/zzsn"
# 需根据日志配置填写,比如:logback-spring.xml
svc_logs="/workspace/logs"
# 环境变量 test or prod
svc_env="test"
# 服务名
svc_name="event-analysis"
# 服务端口
svc_port="1688"
#!/bin/bash
# run.sh - 功能包括:运行容器,处理none镜像。
# author: lixingyu
# 使用方法:
# $ ./run.sh <env_name> <build_timestamp>
# 参数:
# env_name:环境变量 build_timestamp:构建时间戳
set -eu
# 获取脚本的绝对路径(包括文件名)
script_path=$(readlink -f "$0")
# 获取脚本所在的目录的绝对路径
script_dir=$(dirname "$script_path")
# 函数定义
function print_usage {
# 打印使用说明
sed -n '2,7p' "$0"
}
function handle {
local env_name=$1
local build_timestamp=$2
echo "执行的环境变量: ${env_name}"
echo "执行的构建时间戳: ${build_timestamp}"
if [ ! -f "$script_dir/env/env.${env_name}" ]; then
echo "错误: 文件 'env.${env_name}' 不存在." >&2
exit 1
fi
. $script_dir/env/env.${env_name}
local dir="${root_dir}/${svc_name}/${svc_env}"
local name="${svc_name}-${svc_env}"
local version=${version}-${build_timestamp}
echo "---运行容器: ${name}:${version}---"
docker pull ${domain}/${namespace}/${name}:${version}
if [ "$(docker ps -aqf "name=^${name}")" ]; then
# 如果存在,则停止并删除容器
echo "停止并删除容器: ${name}"
docker rm -f "${name}"
else
echo "容器不存在直接运行: ${name}"
fi
docker run --restart always -d -p ${svc_port}:${svc_port} --name ${name} \
-v /etc/localtime:/etc/localtime:ro \
-v ${dir}/logs:${svc_logs} \
-v /zzsn/data/win/Fonts:/zzsn/data/win/Fonts \
-v /zzsn/enterprise-service:/zzsn/enterprise-service \
${domain}/${namespace}/${name}:${version}
echo "---清理none镜像---"
docker image prune -af
}
# 主程序入口点
function main {
if [ "$#" -ne 2 ]; then
print_usage
echo "错误: 需要提供两个个参数 <env_name> <build_timestamp>" >&2
exit 1
fi
local env_name=$1
local build_timestamp=$2
handle "${env_name}" "${build_timestamp}"
}
# 错误处理
trap 'echo 发生了错误,脚本中断.' ERR
# 调用主函数
main "$@"
...@@ -17,10 +17,12 @@ public class WebConfigure implements WebMvcConfigurer { ...@@ -17,10 +17,12 @@ public class WebConfigure implements WebMvcConfigurer {
@Value("${jeecg.shiro,excludeUrls:}") @Value("${jeecg.shiro,excludeUrls:}")
private String ALLOW_URL; private String ALLOW_URL;
//服务部署环境 clb:克虏宝 yjzx:研究中心
@Value("${server.profiles:clb}")
private String profiles;
@Bean @Bean
public LoginInterceptor loginInterceptor() { public LoginInterceptor loginInterceptor() {
return new LoginInterceptor(); return new LoginInterceptor(profiles);
} }
@Override @Override
......
...@@ -3,6 +3,7 @@ package com.zzsn.event.config.interceptor; ...@@ -3,6 +3,7 @@ package com.zzsn.event.config.interceptor;
import cn.hutool.core.net.URLDecoder; import cn.hutool.core.net.URLDecoder;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.util.RequestUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -27,6 +28,12 @@ public class LoginInterceptor implements HandlerInterceptor { ...@@ -27,6 +28,12 @@ public class LoginInterceptor implements HandlerInterceptor {
public final static String LOGIN_USER_HEADER = "loginUser"; public final static String LOGIN_USER_HEADER = "loginUser";
private final String profiles;
public LoginInterceptor(String profiles) {
this.profiles = profiles;
}
@Override @Override
public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) { public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) {
String userInfo = URLDecoder.decode(request.getHeader(LOGIN_USER_HEADER), StandardCharsets.UTF_8); String userInfo = URLDecoder.decode(request.getHeader(LOGIN_USER_HEADER), StandardCharsets.UTF_8);
...@@ -36,6 +43,9 @@ public class LoginInterceptor implements HandlerInterceptor { ...@@ -36,6 +43,9 @@ public class LoginInterceptor implements HandlerInterceptor {
return false; return false;
} }
UserVo userVo = JSON.parseObject(userInfo, UserVo.class); UserVo userVo = JSON.parseObject(userInfo, UserVo.class);
if("yjzx".equals(profiles)){
userVo.setTenant(RequestUtil.getTenantByRequest(request));
}
UserUtil.setLoginUser(userVo); UserUtil.setLoginUser(userVo);
return true; return true;
} }
......
...@@ -59,6 +59,8 @@ public class Constants { ...@@ -59,6 +59,8 @@ public class Constants {
/*数据权限类型*/ /*数据权限类型*/
public final static String PERMISSION_SUBJECT = "subject"; public final static String PERMISSION_SUBJECT = "subject";
public static final Integer SUCCESS_CODE = 200;
//事件默认绑定模型集合 //事件默认绑定模型集合
public static final Map<String, String> DEFAULT_MODEL = new HashMap<String, String>() {{ public static final Map<String, String> DEFAULT_MODEL = new HashMap<String, String>() {{
put("1706918153597943809","3"); put("1706918153597943809","3");
......
...@@ -33,11 +33,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -33,11 +33,9 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/** /**
...@@ -78,6 +76,15 @@ public class EventDataController { ...@@ -78,6 +76,15 @@ public class EventDataController {
@Value("${kafka.topic.event.run:}") @Value("${kafka.topic.event.run:}")
private String EVENT_MODEL_KAFKA_CHANNEL; private String EVENT_MODEL_KAFKA_CHANNEL;
@Value("${clb.eventAdd:}")
private String CLB_EVENT_ADD;
@Value("${clb.eventEdit:}")
private String CLB_EVENT_EDIT;
@Value("${clb.eventDelete:}")
private String CLB_EVENT_DELETE;
private static final String prefix = "http://obs.ciglobal.cn/"; private static final String prefix = "http://obs.ciglobal.cn/";
...@@ -170,6 +177,51 @@ public class EventDataController { ...@@ -170,6 +177,51 @@ public class EventDataController {
*/ */
@PostMapping("/simpleSaveEvent") @PostMapping("/simpleSaveEvent")
public Result<?> addEvent(@RequestBody AddEventVO addEventVO) { public Result<?> addEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_ADD)){
UserVo currentUser = UserUtil.getLoginUser();
KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
addEventVO.setTenant(currentUser.getTenant());
if (keywordsVO != null) {
// 调用克虏宝事件新增接口
JSONObject params = JSONObject.from(addEventVO);
params.put("username", currentUser.getUsername());
try {
String resultStr = HttpUtil.doPost(CLB_EVENT_ADD, params, 1000 * 30);
JSONObject jsonObject = JSONObject.parseObject(resultStr);
Integer code = jsonObject.getInteger("code");
if (code != null && code.equals(Constants.SUCCESS_CODE)) {
JSONObject resultMap = jsonObject.getJSONObject("result");
String id = resultMap.getString("id");
String eventCode = resultMap.getString("eventCode");
JSONObject clbKeyWords = resultMap.getJSONObject("keyWords");
// 事件id和code使用clb中生成的
addEventVO.setId(id);
addEventVO.setEventCode(eventCode);
Event event = eventSimpleService.simpleSave(addEventVO);
// 关键词使用clb中返回
KeyWords keyWords = new KeyWords();
keyWords.setId(clbKeyWords.getString("id"));
keyWords.setWordsCode(clbKeyWords.getString("wordsCode"));
keyWords.setWordsName(clbKeyWords.getString("wordsName"));
keyWords.setKeyWord(keywordsVO.getKeyword());
keyWords.setExclusionWord(keywordsVO.getExclusionWord());
keyWords.setStatus("1");
keyWords.setCreateTime(new Date());
keyWordsService.saveKeyword(event.getId(), keyWords);
return Result.OK();
} else {
log.error("调用克虏宝新增返回失败");
return Result.FAIL(500, "保存事件信息失败!");
}
} catch (Exception e) {
log.error("调用克虏宝新增事件异常:{}", e);
return Result.FAIL(500, "保存事件信息失败!");
}
} else {
return Result.FAIL(500, "关键词不能为空");
}
}else{
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
if (keywordsVO != null) { if (keywordsVO != null) {
Event event = eventSimpleService.simpleSave(addEventVO); Event event = eventSimpleService.simpleSave(addEventVO);
...@@ -194,6 +246,7 @@ public class EventDataController { ...@@ -194,6 +246,7 @@ public class EventDataController {
return Result.FAIL(500, "关键词不能为空"); return Result.FAIL(500, "关键词不能为空");
} }
} }
}
/** /**
* 编辑事件(页面简化版) * 编辑事件(页面简化版)
...@@ -204,6 +257,37 @@ public class EventDataController { ...@@ -204,6 +257,37 @@ public class EventDataController {
*/ */
@PostMapping("/simpleUpdateEvent") @PostMapping("/simpleUpdateEvent")
public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) { public Result<?> updateEvent(@RequestBody AddEventVO addEventVO) {
if(StringUtils.isNotEmpty(CLB_EVENT_EDIT)){
UserVo currentUser = UserUtil.getLoginUser();
KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
addEventVO.setTenant(currentUser.getTenant());
if (keywordsVO != null) {
// 调用克虏宝编辑接口
JSONObject params = JSONObject.from(addEventVO);
params.put("username", currentUser.getUsername());
try{
String resultStr = HttpUtil.doPost(CLB_EVENT_EDIT, params, 1000 * 30);
JSONObject jsonObject = JSONObject.parseObject(resultStr);
Integer code = jsonObject.getInteger("code");
if (code != null && code.equals(Constants.SUCCESS_CODE)) {
// 本地编辑接口
eventSimpleService.updateMain(addEventVO);
keyWordsService.update(Wrappers.<KeyWords>lambdaUpdate().eq(KeyWords::getId, keywordsVO.getId())
.set(KeyWords::getKeyWord, keywordsVO.getKeyword())
.set(KeyWords::getExclusionWord, keywordsVO.getExclusionWord()));
} else {
log.error("调用克虏宝编辑返回失败");
return Result.FAIL(500, "编辑事件信息失败!");
}
} catch (Exception e) {
log.error("调用克虏宝编辑事件异常:{}", e);
return Result.FAIL(500, "编辑事件信息失败!");
}
return Result.OK();
} else {
return Result.FAIL(500, "关键词不能为空");
}
}else{
KeywordsVO keywordsVO = addEventVO.getKeywordsVO(); KeywordsVO keywordsVO = addEventVO.getKeywordsVO();
if (keywordsVO != null) { if (keywordsVO != null) {
eventSimpleService.updateMain(addEventVO); eventSimpleService.updateMain(addEventVO);
...@@ -227,6 +311,7 @@ public class EventDataController { ...@@ -227,6 +311,7 @@ public class EventDataController {
return Result.FAIL(500, "关键词不能为空"); return Result.FAIL(500, "关键词不能为空");
} }
} }
}
/** /**
* 事件配置校验 * 事件配置校验
...@@ -257,12 +342,40 @@ public class EventDataController { ...@@ -257,12 +342,40 @@ public class EventDataController {
/** /**
* 通过id删除 * 通过id删除
* *
* @param id 事件id * @param param:id 事件id
* @return * @return
*/ */
@ApiOperation(value = "事件-通过id删除", notes = "事件-通过id删除") @ApiOperation(value = "事件-通过id删除", notes = "事件-通过id删除")
@GetMapping(value = "/simpleDeleteEvent") @PostMapping(value = "/simpleDeleteEvent")
public Result<?> delete(@RequestParam(name = "id") String id) { //public Result<?> delete(@RequestParam(name = "id") String id) {
public Result<?> delete(@RequestBody JSONObject param) {
if(StringUtils.isNotEmpty(CLB_EVENT_DELETE)){
try {
String id = param.getString("id");
if (StringUtils.isBlank(id)) {
return Result.FAIL(500, "删除事件信息失败,入参不完整!");
}
// 调用克虏宝删除接口
Map<String, String> params = new HashMap<>();
params.put("id", id);
String resultStr = HttpUtil.doGet(CLB_EVENT_DELETE, params, null,"utf-8");
// 调用本地删除
EventVO eventVO = eventService.queryInfo(id);
eventService.deleteMain(id);
CompletableFuture.runAsync(() -> {
KeywordsVO keywordsVO = eventVO.getKeywordsVO();
if (keywordsVO != null) {
String wordsCode = keywordsVO.getWordsCode();
keyWordsService.remove(Wrappers.<KeyWords>lambdaQuery().eq(KeyWords::getWordsCode, wordsCode));
}
});
} catch (Exception e) {
log.error("调用克虏宝删除事件异常:{}", e);
return Result.FAIL(500, "删除事件信息失败!");
}
return Result.OK();
}else{
String id = param.getString("id");
EventVO eventVO = eventService.queryInfo(id); EventVO eventVO = eventService.queryInfo(id);
eventService.deleteMain(id); eventService.deleteMain(id);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
...@@ -277,6 +390,7 @@ public class EventDataController { ...@@ -277,6 +390,7 @@ public class EventDataController {
}); });
return Result.OK(); return Result.OK();
} }
}
/** /**
...@@ -305,7 +419,8 @@ public class EventDataController { ...@@ -305,7 +419,8 @@ public class EventDataController {
@RequestParam(name = "column", defaultValue = "publishDate") String column, @RequestParam(name = "column", defaultValue = "publishDate") String column,
@RequestParam(name = "order", defaultValue = "desc") String order, @RequestParam(name = "order", defaultValue = "desc") String order,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest request) {
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
String username = currentUser.getUsername(); String username = currentUser.getUsername();
List<String> subjectIdList = new ArrayList<>(); List<String> subjectIdList = new ArrayList<>();
......
...@@ -12,6 +12,7 @@ import com.zzsn.event.vo.EventExcelVO; ...@@ -12,6 +12,7 @@ import com.zzsn.event.vo.EventExcelVO;
import com.zzsn.event.vo.EventRegionVO; import com.zzsn.event.vo.EventRegionVO;
import com.zzsn.event.vo.EventTopVO; import com.zzsn.event.vo.EventTopVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -63,6 +64,7 @@ public class EventHomeController { ...@@ -63,6 +64,7 @@ public class EventHomeController {
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
List<EventExcelVO> eventList = eventService.frontAllList(projectId, username, null, null,null,null,null,null); List<EventExcelVO> eventList = eventService.frontAllList(projectId, username, null, null,null,null,null,null);
map.put("eventCount", eventList.size()); map.put("eventCount", eventList.size());
if (!CollectionUtils.isEmpty(eventList)) {
List<String> eventIdList = eventList.stream().map(EventExcelVO::getId).collect(Collectors.toList()); List<String> eventIdList = eventList.stream().map(EventExcelVO::getId).collect(Collectors.toList());
long total = esStatisticsService.totalCount(eventIdList, null, null); long total = esStatisticsService.totalCount(eventIdList, null, null);
map.put("total", (int) total); map.put("total", (int) total);
...@@ -71,6 +73,10 @@ public class EventHomeController { ...@@ -71,6 +73,10 @@ public class EventHomeController {
LocalDateTime previousHour = now.minus(1, ChronoUnit.DAYS); LocalDateTime previousHour = now.minus(1, ChronoUnit.DAYS);
long totalAdd = esStatisticsService.totalCount(eventIdList, previousHour.format(formatter), now.format(formatter)); long totalAdd = esStatisticsService.totalCount(eventIdList, previousHour.format(formatter), now.format(formatter));
map.put("totalAdd", (int) totalAdd); map.put("totalAdd", (int) totalAdd);
} else {
map.put("total", 0);
map.put("totalAdd", 0);
}
return Result.OK(map); return Result.OK(map);
} }
......
...@@ -221,7 +221,10 @@ public class Event { ...@@ -221,7 +221,10 @@ public class Event {
@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")
private Date firstOpenTime; private Date firstOpenTime;
/**
* 访问环境,prod:正式环境 test:测试环境
*/
private String tenant;
/** /**
* 关键词信息 * 关键词信息
*/ */
......
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.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.util.Date;
import java.util.List;
/** 克虏宝事件表
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event对象", description="事件")
public class EventClb {
/**ID*/
//@TableId(type = IdType.ASSIGN_ID)
@TableId(type = IdType.INPUT)
@ApiModelProperty(value = "ID")
private String id;
/**编码*/
@Excel(name = "编码", width = 15)
@ApiModelProperty(value = "编码")
private String eventCode;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String eventName;
/**图标*/
@Excel(name = "图标", width = 15)
@ApiModelProperty(value = "图标")
private String eventIcon;
/**事件类型*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private String eventType;
/**开始时间*/
@Excel(name = "开始时间", width = 20, format = "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")
@ApiModelProperty(value = "开始时间")
private Date startTime;
/**结束时间*/
@Excel(name = "结束时间", width = 20, format = "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")
@ApiModelProperty(value = "结束时间")
private Date endTime;
/**标签*/
@Excel(name = "标签", width = 15)
@ApiModelProperty(value = "标签")
private String eventLabel;
/**是否公开*/
@Excel(name = "是否公开", width = 15)
@ApiModelProperty(value = "是否公开")
private Integer facePublic;
/**事件描述*/
@Excel(name = "事件描述", width = 15)
@ApiModelProperty(value = "事件描述")
private String eventDescribe;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "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")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "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")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**修改人id*/
@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;
/**划分专题库*/
@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;
/**事件专题总量分析规则*/
@ApiModelProperty(value = "事件专题总量分析规则")
private Integer totalAnaRule;
/**事件专题时间间隔分析规则(天)*/
@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;
/**事件创建方式(1-用户直接创建;2-基于挖掘的事件创建)*/
private Integer category;
@TableField(exist = false)
private String typeName;
@TableField(exist = false)
private String startDate;
@TableField(exist = false)
private String endDate;
@TableField(exist = false)
private List<EventClb> relatedEventList;
@TableField(exist = false)
private EventTag eventTag;
@TableField(exist = false)
private String extractIndustryTag;
@TableField(exist = false)
private String extractCompanyTag;
@TableField(exist = false)
private String extractPersonTag;
@TableField(exist = false)
private String extractSentimentTag;
@TableField(exist = false)
private String extractKeywordsTag;
@TableField(exist = false)
private String extractLocationTag;
@TableField(exist = false)
private String extractTimeTag;
}
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.*;
import lombok.experimental.Accessors;
/**
* 克虏宝中的事件标签数据库,因为python目前只更新克虏宝事件标签库,所以这里直接取克虏宝的事件标签库
* @Description: EventTag
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event_tag")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="EventTag对象", description="事件")
public class EventTagClb {
/**ID*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "ID")
private String id;
private String eventId;
private String extractIndustryTag;
private String extractCompanyTag;
private String extractPersonTag;
private String extractSentimentTag;
private String extractKeywordsTag;
private String extractLocationTag;
private String extractTimeTag;
}
package com.zzsn.event.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.EventClb;
import com.zzsn.event.util.tree.Node;
import com.zzsn.event.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 克虏宝事件
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
@DS("multi-datasource-clb")
public interface EventClbMapper extends BaseMapper<EventClb> {
List<SubjectKafkaVo> eventSubjectList();
/**
* 获取事件详情
*
* @param eventId 事件id
* @author lkg
* @date 2024/4/12
*/
EventVO queryInfo(@Param("eventId") String eventId);
/**
* 分页列表-后台管理
*
* @param eventName 事件名称
* @param eventType 事件分类id
* @param startTime 开始时间
* @param endTime 结束时间
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventManageVO> pageList(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-后台管理
*
* @param eventName 事件名称
* @param eventType 事件分类id
* @param startTime 开始时间
* @param endTime 结束时间
* @author lkg
* @date 2024/4/8
*/
Integer totalCount(@Param("eventName") String eventName, @Param("eventType") Integer eventType,
@Param("facePublic") Integer facePublic, @Param("publishStatus") Integer publishStatus,
@Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 分页列表-门户(全部)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventId 事件id
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventFrontVO> frontAllPageList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-门户(全部)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventId 事件id
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @author lkg
* @date 2024/4/8
*/
Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type);
/**
* 分页列表-门户(我的)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @param order 排序字段
* @param orderType 排序方式
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventFrontVO> frontOwnerPageList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 总数量-门户(我的)
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventName 事件名称
* @param eventTypes 事件分类id集合
* @param labelField 搜索字段
* @param labelName 搜索词
* @param type 类别(1-自定义标签;2-抽取标签)
* @author lkg
* @date 2024/4/8
*/
Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @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 projectId 项目id
* @param createBy 创建人
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 分类(1-按发布时间;2.按热度)
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/4/8
*/
List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("type") Integer type,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate);
/**
* 根据地域获取事件信息列表
*
* @param name 地域名称
* @author lkg
* @date 2024/4/10
*/
List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name);
/**
* 公开且发布的事件信息集合
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventIdList 事件id集合
* @param size 数量
* @author lkg
* @date 2024/4/10
*/
List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size);
/**
* 默认创建的,公开且发布的事件信息集合
*
* @param projectId 项目id
* @param createBy 创建人
* @param eventIdList 事件id集合
* @param size 数量
* @author lkg
* @date 2024/4/10
*/
List<EventExcelVO> frontOwnerList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size);
/**
* 模型信息列表
*
* @author lkg
* @date 2024/4/11
*/
List<ModelVO> modelList();
/**
* 获取事件信息集合
*
* @param eventIdList 事件id集合
* @author lkg
* @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);
/**
* 分类下的事件id集合
*
* @param userId 用户id
* @param typeIds 分类id集合
* @author lkg
* @date 2024/5/6
*/
List<String> selectSubjectByTypeIds(@Param("userId") String userId, @Param("typeIds") List<String> typeIds);
/**
* 用户下的事件id集合
*
* @param userId 用户id
* @param customerId 客户id
* @author lkg
* @date 2024/5/6
*/
List<String> selectSubjectWithCustomer(@Param("userId") String userId, @Param("customerId") String customerId);
/**
* 专题绑定关键词的id集合
*
* @param subjectIds 专题id集合
* @author lkg
* @date 2024/5/6
*/
List<String> bindKeyWordsIdList(@Param("subjectIds") List<String> subjectIds);
/**
* 专题绑定模型信息列表
*
* @param subjectIds 专题id集合
* @author lkg
* @date 2024/5/6
*/
List<LabelModelVo> selectLabelModelBySubjectId(@Param("subjectIds") List<String> subjectIds);
/**
* 企业标签下的企业信用代码集合
*
* @param labelIds 企业标签id集合
* @author lkg
* @date 2024/5/6
*/
List<String> codesByLabels(@Param("labelIds") List<String> labelIds);
/**
* 判断信息源是否在专题绑定的信息源组下
*
* @param subjectId 专题id
* @param sourceId 信息源id
* @author lkg
* @date 2024/4/24
*/
int ynBelowBindGroup(@Param("subjectId") String subjectId, @Param("sourceId") String sourceId);
/**
* 判断信息源是否在专题排除的信息源组下
*
* @param subjectId 专题id
* @param sourceId 信息源id
* @author lkg
* @date 2024/4/24
*/
int ynBelowExcludeGroup(@Param("subjectId") String subjectId, @Param("sourceId") String sourceId);
/**
* 专题绑定关键词信息-分页列表
*
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @param offset 偏移量
* @param pageSize 返回条数
* @author lkg
* @date 2024/5/7
*/
List<KeyWordsPage> bindKeyWordsList(@Param("subjectIds") List<String> subjectIds,
@Param("groupName") String groupName, @Param("wordName") String wordName,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
/**
* 专题绑定关键词信息-总数量
*
* @param subjectIds 专题id集合
* @param groupName 词组名称
* @param wordName 关键词名称
* @author lkg
* @date 2024/5/7
*/
Long bindKeyWordsCount(@Param("subjectIds") List<String> subjectIds, @Param("groupName") String groupName, @Param("wordName") String wordName);
}
...@@ -87,7 +87,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -87,7 +87,7 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant);
/** /**
* 总数量-门户(全部) * 总数量-门户(全部)
...@@ -106,7 +106,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -106,7 +106,7 @@ public interface EventMapper extends BaseMapper<Event> {
Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy, Integer frontAllCount(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("eventId") String eventId, @Param("eventName") String eventName, @Param("eventId") String eventId, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type); @Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant")String tenant);
/** /**
...@@ -130,7 +130,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -130,7 +130,7 @@ public interface EventMapper extends BaseMapper<Event> {
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type, @Param("labelName") String labelName, @Param("type") Integer type,
@Param("order") String order, @Param("orderType") String orderType, @Param("order") String order, @Param("orderType") String orderType,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant);
/** /**
* 总数量-门户(我的) * 总数量-门户(我的)
...@@ -147,7 +147,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -147,7 +147,7 @@ public interface EventMapper extends BaseMapper<Event> {
*/ */
Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName, Integer frontOwnerCount(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventName") String eventName,
@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type); @Param("labelName") String labelName, @Param("type") Integer type, @Param("tenant")String tenant);
/** /**
...@@ -206,7 +206,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -206,7 +206,7 @@ public interface EventMapper extends BaseMapper<Event> {
List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy, List<EventTopVO> topEventList(@Param("projectId") String projectId, @Param("createBy") String createBy,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("type") Integer type, @Param("type") Integer type,
@Param("offset") Integer offset, @Param("pageSize") Integer pageSize); @Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("tenant")String tenant);
List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate); List<SubjectKafkaVo> processList(@Param("disableDate") Date disableDate);
...@@ -217,7 +217,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -217,7 +217,7 @@ public interface EventMapper extends BaseMapper<Event> {
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name); List<EventRegionVO> listByRegion(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("type") Integer type, @Param("name") String name, @Param("tenant")String tenant);
/** /**
* 公开且发布的事件信息集合 * 公开且发布的事件信息集合
...@@ -226,12 +226,13 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -226,12 +226,13 @@ public interface EventMapper extends BaseMapper<Event> {
* @param createBy 创建人 * @param createBy 创建人
* @param eventIdList 事件id集合 * @param eventIdList 事件id集合
* @param size 数量 * @param size 数量
* @param tenant
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList, List<EventExcelVO> frontAllList(@Param("projectId") String projectId, @Param("createBy") String createBy, @Param("eventIdList") List<String> eventIdList,
@Param("eventName") String eventName,@Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField, @Param("eventName") String eventName, @Param("eventTypes") List<String> eventTypes, @Param("labelField") String labelField,
@Param("labelName") String labelName, @Param("type") Integer type,@Param("size") Integer size); @Param("labelName") String labelName, @Param("type") Integer type, @Param("size") Integer size, @Param("tenant")String tenant);
/** /**
* 默认创建的,公开且发布的事件信息集合 * 默认创建的,公开且发布的事件信息集合
...@@ -262,7 +263,7 @@ public interface EventMapper extends BaseMapper<Event> { ...@@ -262,7 +263,7 @@ public interface EventMapper extends BaseMapper<Event> {
* @author lkg * @author lkg
* @date 2024/4/12 * @date 2024/4/12
*/ */
List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList); List<EventVO> eventList(@Param("eventIdList") List<String> eventIdList, @Param("tenant")String tenant);
/** /**
* 专题绑定关键词数量 * 专题绑定关键词数量
......
package com.zzsn.event.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsn.event.entity.EventTagClb;
import org.apache.ibatis.annotations.Mapper;
/**
* 克虏宝中事件标签库
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Mapper
public interface EventTagClbMapper extends BaseMapper<EventTagClb> {
}
<?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.EventClbMapper">
<select id="eventSubjectList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,
s.event_name as subject_name,
s.start_time as time_enable,
s.end_time as time_disable,
s.incre_ana_rule,
s.total_ana_rule,
s.time_ana_rule,
s.analysis_time,
s.event_time
from event s
</select>
<select id="queryInfo" resultType="com.zzsn.event.vo.EventVO">
select t.id,
t.event_code,
t.event_name,
t.event_icon,
t.start_time,
t.end_time,
t.publish_date,
t.event_describe,
t.event_label,
t.library,
t.unit,
t.space,
t.cron,
t.yn_extract_hot_words,
t.face_public,
t.relation_events,
t.event_type,
t.sort_order,
stm.type_id as subjectTypeId,
psm.project_id,
c.type_name,
IFNULL(r.id, false) as hasReport
from event t
inner join event_category c on t.event_type = c.id
inner join subject_type_map stm on t.id = stm.subject_id
inner join project_subject_map psm on t.id = psm.subject_id
left join event_analysis_report r on t.id = r.event_id
where t.id = #{eventId}
</select>
<select id="pageList" resultType="com.zzsn.event.vo.EventManageVO">
select t2.type_name,t1.id,t1.event_icon,t1.event_name,t1.event_label,t1.status,
t1.face_public,t1.publish_status,t1.create_time,t1.publish_date,t1.start_time,t1.end_time,t1.create_by
from event t1
inner join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventType!=null and eventType != ''">
and t1.event_type = #{eventType}
</if>
<if test="facePublic!=null">
and t1.face_public = #{facePublic}
</if>
<if test="publishStatus!=null">
and t1.publish_status = #{publishStatus}
</if>
<if test="startTime!=null and startTime != ''">
and t1.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="order!=null and order != ''">
order by t1.${order}
<if test="orderType!=null and orderType != ''">
${orderType}
</if>
</if>
limit #{offset}, #{pageSize}
</select>
<select id="totalCount" resultType="java.lang.Integer">
select count(1) from event t1
inner join event_category t2 on t1.event_type =t2.id
where 1=1
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventType!=null and eventType != ''">
and t1.event_type = #{eventType}
</if>
<if test="facePublic!=null">
and t1.face_public = #{facePublic}
</if>
<if test="publishStatus!=null">
and t1.publish_status = #{publishStatus}
</if>
<if test="startTime!=null and startTime != ''">
and t1.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime}
</if>
</select>
<select id="frontAllPageList" resultType="com.zzsn.event.vo.EventFrontVO">
select distinct a.* from (select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1
union
select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
<if test="eventId!=null and eventId != ''">
and a.id = #{eventId}
</if>
<if test="eventName!=null and eventName != ''">
and a.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and a.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and a.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and a.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
<choose>
<when test="order != null and order != ''">
order by a.${order}
<if test="orderType != null and orderType != ''">
${orderType}
</if>
</when>
<otherwise>
order by a.publish_date desc
</otherwise>
</choose>
limit #{offset}, #{pageSize}
</select>
<select id="frontAllCount" resultType="java.lang.Integer">
select count(1) from (
select distinct a.*,m.project_id from (select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1
union
select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy}) a
inner join project_subject_map m on a.id = m.subject_id
) b
where b.project_id = #{projectId}
<if test="eventId!=null and eventId != ''">
and b.id = #{eventId}
</if>
<if test="eventName!=null and eventName != ''">
and b.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and b.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and b.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and b.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
</select>
<select id="frontOwnerPageList" resultType="com.zzsn.event.vo.EventFrontVO">
select
t1.id,t1.event_name,t1.event_icon,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
t1.total_hot,t1.create_by,t1.category,
t2.type_name,
t3.extract_industry_tag,t3.extract_company_tag,t3.extract_person_tag,t3.extract_sentiment_tag,
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id
inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and t1.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and t1.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
<choose>
<when test="order != null and order != ''">
order by t1.${order}
<if test="orderType != null and orderType != ''">
${orderType}
</if>
</when>
<otherwise>
order by t1.publish_date desc
</otherwise>
</choose>
limit #{offset}, #{pageSize}
</select>
<select id="frontOwnerCount" resultType="java.lang.Integer">
select count(1)
from event t1 inner join event_category t2 on t1.event_type =t2.id
inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and t1.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and t1.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
</select>
<select id="newPlatPageList" resultType="com.zzsn.event.vo.EventNewPlatVO">
SELECT distinct d.id,d.event_name,d.start_time,d.end_time,d.status, m.type_name as subjectTypeName,
n.project_name
from
<choose>
<when test="subjectCondition.userId !=null and subjectCondition.userId != ''">
( select s.* from event s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{subjectCondition.userId}
)
</when>
<when test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
( select s.* from event s inner join customer_data_permission_map m on s.id = m.permission_id
and m.customer_id = #{subjectCondition.customerId}
)
</when>
<otherwise>
event
</otherwise>
</choose>
d
INNER JOIN
(
select stm.subject_id,st.type_name from subject_type_map stm inner join subject_type st on stm.type_id = st.id
where 1=1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and stm.type_id in
<foreach collection="subjectCondition.typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on d.id = m.subject_id
INNER JOIN
(
select psm.subject_id,p.project_name from project_subject_map psm inner join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
) n
on d.id = n.subject_id
where 1 = 1
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and d.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and d.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and d.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
order by d.sort_order,d.create_time desc
limit #{offset}, #{pageSize}
</select>
<select id="newPlatCount" resultType="Integer">
select count(1) from (
SELECT distinct d.id
from
<choose>
<when test="subjectCondition.userId !=null and subjectCondition.userId != ''">
( select s.* from event s inner join sys_user_data_permission dp
on s.id=dp.permission_id and dp.user_id = #{subjectCondition.userId}
)
</when>
<when test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
( select s.* from event s inner join customer_data_permission_map m on s.id = m.permission_id
and m.customer_id = #{subjectCondition.customerId}
)
</when>
<otherwise>
event
</otherwise>
</choose>
d
INNER JOIN
(
select stm.subject_id from subject_type_map stm
where 1=1
<if test="subjectCondition.typeIds!=null and subjectCondition.typeIds.size()>0">
and stm.type_id in
<foreach collection="subjectCondition.typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) m
on d.id = m.subject_id
INNER JOIN
(
select psm.subject_id from project_subject_map psm
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and psm.id = #{subjectCondition.projectId}
</if>
) n
on d.id = n.subject_id
where 1 = 1
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and d.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and d.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and d.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and d.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
</select>
<select id="newPlatCustomerPageList" resultType="com.zzsn.event.vo.EventNewPlatVO">
select distinct x.id,x.event_name,x.start_time,x.end_time,st.type_name as subjectTypeName,p.project_name from (
select c.id, c.event_name,c.create_time,c.start_time,c.end_time,c.sort_order
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="subjectCondition.userId !=null and subjectCondition.userId != ''">
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
and user_id = #{subjectCondition.userId}
)
</if>
) m
on c.id = m.permission_id
where c.status = 1
<if test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
and m.id = #{subjectCondition.customerId}
</if>
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and c.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and c.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and c.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and c.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
left join subject_type_map stm on stm.subject_id = x.id
left join subject_type st on stm.type_id = st.id
left join project_subject_map psm on psm.subject_id = x.id
left join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
order by x.sort_order, x.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="newPlatCustomerCount" resultType="Integer">
select count(1) from (
select distinct x.id from (
select c.id, c.event_name,c.create_time
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="subjectCondition.userId !=null and subjectCondition.userId != ''">
and b.permission_id in
(
select permission_id from sys_user_data_permission where category = 'subject'
and user_id = #{subjectCondition.userId}
)
</if>
) m
on c.id = m.permission_id
where c.status = 1
<if test="subjectCondition.customerId !=null and subjectCondition.customerId != ''">
and m.id = #{subjectCondition.customerId}
</if>
<if test="subjectCondition.id !=null and subjectCondition.id !=''">
and c.id =#{subjectCondition.id}
</if>
<if test="subjectCondition.subjectName!=null and subjectCondition.subjectName != ''">
and c.event_name like CONCAT('%',#{subjectCondition.subjectName},'%')
</if>
<if test="subjectCondition.startTime != null and subjectCondition.startTime != ''">
and c.create_time >= #{subjectCondition.startTime}
</if>
<if test="subjectCondition.endTime != null and subjectCondition.endTime != ''">
and c.create_time <![CDATA[ <= ]]> #{subjectCondition.endTime}
</if>
) x
left join subject_type_map stm on stm.subject_id = x.id
left join subject_type st on stm.type_id = st.id
left join project_subject_map psm on psm.subject_id = x.id
left join project p on psm.project_id = p.id
where 1=1
<if test="subjectCondition.projectId!=null and subjectCondition.projectId != ''">
and p.id = #{subjectCondition.projectId}
</if>
) y
</select>
<select id="topEventList" resultType="com.zzsn.event.vo.EventTopVO">
select distinct a.* from(
select t.id,t.event_name,t.start_time,t.end_time,t.publish_date,t.total_hot,ec.type_name
from event t inner join event_category ec on t.event_type = ec.id
where t.publish_status = 1 and t.face_public = 1
union
select e.id,e.event_name,e.start_time,e.end_time,e.publish_date,e.total_hot,ec.type_name
from event e inner join event_category ec on e.event_type = ec.id
where e.publish_status = 1 and e.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
<if test="startTime!=null and startTime != ''">
and a.publish_date >= #{startTime}
</if>
<if test="endTime!=null and endTime != ''">
and a.publish_date <![CDATA[ <= ]]> #{endTime}
</if>
order by
<choose>
<when test="type == 1">
a.publish_date
</when>
<otherwise>
a.total_hot
</otherwise>
</choose>
desc
limit #{offset}, #{pageSize}
</select>
<select id="processList" resultType="com.zzsn.event.vo.SubjectKafkaVo">
select s.id,s.event_name as subject_name,s.start_time as time_enable,s.end_time as time_disable,
s.incre_ana_rule, s.total_ana_rule,s.time_ana_rule,s.analysis_time,s.event_time,s.face_public,
s.publish_status,s.event_describe
from event s
where 1=1
<if test="disableDate != null">
and (s.end_time is null or s.end_time <![CDATA[ >= ]]> #{disableDate})
</if>
</select>
<select id="listByRegion" resultType="com.zzsn.event.vo.EventRegionVO">
SELECT
b.id AS eventId,
b.event_name,
b.start_time,
b.end_time,
r.name_cn AS regionName
FROM
(
select distinct a.* from(
select t.id,t.event_name,t.start_time,t.end_time from event t where t.publish_status = 1 and t.face_public = 1
union
select e.id,e.event_name,e.start_time,e.end_time from event e where e.publish_status = 1 and e.create_by =
#{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId}
) b
INNER JOIN event_region_map m ON b.id = m.event_id
INNER JOIN sys_base_region r ON m.top_region_id = r.id
WHERE m.type = #{type}
<if test="name != null and name !=''">
and r.name_cn = #{name}
</if>
</select>
<select id="frontAllList" resultType="com.zzsn.event.vo.EventExcelVO">
select distinct a.* from (
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.face_public = 1
union
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.create_by = #{createBy}
) a inner join project_subject_map m on a.id = m.subject_id
left join event_tag t3 on a.id=t3.event_id
where m.project_id = #{projectId}
<if test="eventIdList != null and eventIdList.size() > 0">
and a.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
<if test="eventName!=null and eventName != ''">
and a.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and a.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and a.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
order by a.publish_date desc
<if test="size != null">
limit #{size}
</if>
</select>
<select id="frontOwnerList" resultType="com.zzsn.event.vo.EventExcelVO">
select e.id,e.event_name,e.event_describe,e.publish_date,e.total_hot from event e
inner join project_subject_map m on e.id = m.subject_id
left join event_tag t3 on e.id=t3.event_id
where e.publish_status = 1 and e.face_public = 1
and e.create_by = #{createBy} and m.project_id = #{projectId}
<if test="eventIdList != null and eventIdList.size() > 0">
and e.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
<if test="eventName!=null and eventName != ''">
and e.event_name like CONCAT('%',#{eventName},'%')
</if>
<if test="eventTypes != null and eventTypes.size() > 0">
and e.event_type in
<foreach collection="eventTypes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="labelName != null and labelName !=''">
<if test="labelField != null and labelField != ''">
<choose>
<when test="type == 1">
and e.event_label like concat('%',#{labelName},'%')
</when>
<otherwise>
and t3.${labelField} like concat('%',#{labelName},'%')
</otherwise>
</choose>
</if>
</if>
order by e.publish_date desc
<if test="size != null">
limit #{size}
</if>
</select>
<select id="modelList" resultType="com.zzsn.event.vo.ModelVO">
select id, model_name, type
from model
where pid = '0'
and type is not null
</select>
<select id="eventList" resultType="com.zzsn.event.vo.EventVO">
select t.id,t.event_name from event t where 1=1
<if test="eventIdList != null and eventIdList.size()>0">
and t.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</if>
</select>
<select id="bindKeywordCountList" resultType="com.zzsn.event.vo.SubjectPage">
select subject_id as id , count(1) keyWordsNum from subject_keywords_map where subject_id in
<foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group By subject_id
</select>
<select id="bindSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type in(2,5)
<if test="subjectIds != null and subjectIds.size() > 0">
and n.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.subject_id from subject_info_source_map sm where type = 1
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x
</select>
<select id="excludeSourceList" resultType="com.zzsn.event.vo.SubjectSourceVO">
select distinct x.source_id,x.subject_id from (
select m.source_id,n.subject_id from subject_info_source_map n
inner join info_source_group_map m on n.source_id = m.group_id
where n.type = 4
<if test="subjectIds != null and subjectIds.size() > 0">
and n.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
union
select sm.source_id,sm.subject_id from subject_info_source_map sm where type = 3
<if test="subjectIds != null and subjectIds.size() > 0">
and sm.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) x
</select>
<select id="projectList" resultType="com.zzsn.event.util.tree.Node">
select s.id,s.project_name as name from project 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.is_delete = 0 and s.status = 1
</select>
<select id="selectSubjectByTypeIds" resultType="String">
select distinct a.id from event a
<if test="userId!=null and userId != ''">
inner join sys_user_data_permission b on b.permission_id = a.id and b.category = 'subject' and b.user_id =
#{userId}
</if>
inner join subject_type_map c on c.subject_id = a.id
where 1=1
<if test="typeIds!=null and typeIds.size()>0">
and c.type_id in
<foreach collection="typeIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectSubjectWithCustomer" resultType="String">
select distinct a.id
<choose>
<when test="customerId!=null and customerId != ''">
from customer_data_permission_map b
inner join event a on b.permission_id = a.id
inner join subject_type_map c on c.subject_id = b.permission_id
inner join project_subject_map d on b.permission_id = d.subject_id
inner join customer_project_map e on d.project_id = e.project_id
where b.category = 'subject' and b.customer_id = #{customerId}
</when>
<when test="userId!=null and userId != ''">
from sys_user_data_permission b
inner join event a on b.permission_id = a.id
inner join subject_type_map c on c.subject_id = b.permission_id
inner join project_subject_map d on b.permission_id = d.subject_id
inner join customer_project_map e on d.project_id = e.project_id
where b.category = 'subject' and b.user_id = #{userId}
</when>
<otherwise>
from event a
</otherwise>
</choose>
</select>
<select id="bindKeyWordsIdList" resultType="String">
select distinct b.id from key_words b
left join subject_keywords_map a on a.keywords_id = b.id
left join keywords_type_map c on b.id = c.keywords_id
left join keywords_type d on d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectLabelModelBySubjectId" resultType="com.zzsn.event.vo.LabelModelVo">
SELECT distinct a.subject_id,b.id as modelId,b.service_name as modelServiceName,b.label_id as
labelId,c.label_mark,c.label_name,c.label_type
FROM subject_model_map a
inner JOIN clb_algorithm_model b ON a.model_id = b.id and a.sign = 1
LEFT JOIN sys_base_label_type c on c.id = b.label_id
WHERE b.service_name is not null and a.type = 3
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="codesByLabels" resultType="String">
select e.social_credit_code from sys_base_enterprise e
inner join sys_base_label_type_map m on e.social_credit_code = m.relation_id
where 1=1
<if test="labelIds!=null and labelIds.size()>0">
and m.label_id in
<foreach collection="labelIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by e.social_credit_code
</select>
<select id="ynBelowBindGroup" resultType="Integer">
select count(1)
from subject_info_source_map n
left join info_source_group_map m on n.source_id = m.group_id
where n.type in (2, 5)
and n.subject_id = #{subjectId}
and m.source_id = #{sourceId}
</select>
<select id="ynBelowExcludeGroup" resultType="Integer">
select count(1)
from subject_info_source_map n
left join info_source_group_map m on n.source_id = m.group_id
where n.type = 4
and n.subject_id = #{subjectId}
and m.source_id = #{sourceId}
</select>
<select id="bindKeyWordsList" resultType="com.zzsn.event.vo.KeyWordsPage">
select x.* from (
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by b.id
) x
where 1=1
<if test="groupName != null and groupName !=''">
and x.words_name like CONCAT('%',#{groupName},'%')
</if>
<if test="wordName != null and wordName !=''">
and x.key_word like CONCAT('%',#{wordName},'%')
</if>
order by x.create_time desc
limit #{offset},#{pageSize}
</select>
<select id="bindKeyWordsCount" resultType="Long">
select count(1) from (
SELECT b.*, d.id as keyWordsTypeId, d.type_name as keyWordTypeNames, a.type as type, a.id as subjectKeyWordId
FROM key_words b
LEFT JOIN subject_keywords_map a ON a.keywords_id = b.id
LEFT JOIN keywords_type_map c ON b.id = c.keywords_id
LEFT JOIN keywords_type d ON d.id = c.type_id
where 1=1
<if test="subjectIds != null and subjectIds.size() > 0">
and a.subject_id in
<foreach collection="subjectIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
group by b.id
) x
where 1=1
<if test="groupName != null and groupName !=''">
and x.words_name like CONCAT('%',#{groupName},'%')
</if>
<if test="wordName != null and wordName !=''">
and x.key_word like CONCAT('%',#{wordName},'%')
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,9 @@
from event t1 inner join event_category t2 on t1.event_type =t2.id from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1 where t1.publish_status = 1 and t1.face_public = 1
<if test="tenant!=null and tenant != ''">
and t1.tenant = #{tenant}
</if>
union union
select select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label, t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
...@@ -124,6 +127,9 @@ ...@@ -124,6 +127,9 @@
from event t1 inner join event_category t2 on t1.event_type =t2.id from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} where t1.publish_status = 1 and t1.create_by = #{createBy}
<if test="tenant!=null and tenant != ''">
and t1.tenant = #{tenant}
</if>
) a inner join project_subject_map m on a.id = m.subject_id ) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId} where m.project_id = #{projectId}
<if test="eventId!=null and eventId != ''"> <if test="eventId!=null and eventId != ''">
...@@ -174,6 +180,9 @@ ...@@ -174,6 +180,9 @@
from event t1 inner join event_category t2 on t1.event_type =t2.id from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.face_public = 1 where t1.publish_status = 1 and t1.face_public = 1
<if test="tenant!=null and tenant != ''">
and t1.tenant = #{tenant}
</if>
union union
select select
t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label, t1.id,t1.event_name,t1.event_icon,t1.event_type,t1.start_time,t1.end_time,t1.publish_date,t1.event_describe,t1.event_label,
...@@ -183,7 +192,10 @@ ...@@ -183,7 +192,10 @@
t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag t3.extract_keywords_tag,t3.extract_time_tag,t3.extract_location_tag
from event t1 inner join event_category t2 on t1.event_type =t2.id from event t1 inner join event_category t2 on t1.event_type =t2.id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy}) a where t1.publish_status = 1 and t1.create_by = #{createBy}
<if test="tenant!=null and tenant != ''">
and t1.tenant = #{tenant}
</if>) a
inner join project_subject_map m on a.id = m.subject_id inner join project_subject_map m on a.id = m.subject_id
) b ) b
where b.project_id = #{projectId} where b.project_id = #{projectId}
...@@ -224,6 +236,9 @@ ...@@ -224,6 +236,9 @@
inner join project_subject_map m on t1.id = m.subject_id inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId} where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="tenant != null and tenant != ''">
and t1.tenant = #{tenant}
</if>
<if test="eventName!=null and eventName != ''"> <if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%') and t1.event_name like CONCAT('%',#{eventName},'%')
</if> </if>
...@@ -264,6 +279,9 @@ ...@@ -264,6 +279,9 @@
inner join project_subject_map m on t1.id = m.subject_id inner join project_subject_map m on t1.id = m.subject_id
left join event_tag t3 on t1.id=t3.event_id left join event_tag t3 on t1.id=t3.event_id
where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId} where t1.publish_status = 1 and t1.create_by = #{createBy} and m.project_id = #{projectId}
<if test="tenant != null and tenant != ''">
and t1.tenant = #{tenant}
</if>
<if test="eventName!=null and eventName != ''"> <if test="eventName!=null and eventName != ''">
and t1.event_name like CONCAT('%',#{eventName},'%') and t1.event_name like CONCAT('%',#{eventName},'%')
</if> </if>
...@@ -485,10 +503,16 @@ ...@@ -485,10 +503,16 @@
select t.id,t.event_name,t.start_time,t.end_time,t.publish_date,t.total_hot,ec.type_name select t.id,t.event_name,t.start_time,t.end_time,t.publish_date,t.total_hot,ec.type_name
from event t inner join event_category ec on t.event_type = ec.id from event t inner join event_category ec on t.event_type = ec.id
where t.publish_status = 1 and t.face_public = 1 where t.publish_status = 1 and t.face_public = 1
<if test="tenant != null and tenant != ''">
and t.tenant = #{tenant}
</if>
union union
select e.id,e.event_name,e.start_time,e.end_time,e.publish_date,e.total_hot,ec.type_name select e.id,e.event_name,e.start_time,e.end_time,e.publish_date,e.total_hot,ec.type_name
from event e inner join event_category ec on e.event_type = ec.id from event e inner join event_category ec on e.event_type = ec.id
where e.publish_status = 1 and e.create_by = #{createBy} where e.publish_status = 1 and e.create_by = #{createBy}
<if test="tenant != null and tenant != ''">
and e.tenant = #{tenant}
</if>
) a inner join project_subject_map m on a.id = m.subject_id ) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId} where m.project_id = #{projectId}
<if test="startTime!=null and startTime != ''"> <if test="startTime!=null and startTime != ''">
...@@ -532,9 +556,15 @@ ...@@ -532,9 +556,15 @@
( (
select distinct a.* from( select distinct a.* from(
select t.id,t.event_name,t.start_time,t.end_time from event t where t.publish_status = 1 and t.face_public = 1 select t.id,t.event_name,t.start_time,t.end_time from event t where t.publish_status = 1 and t.face_public = 1
<if test="tenant != null and tenant != ''">
and t.tenant = #{tenant}
</if>
union union
select e.id,e.event_name,e.start_time,e.end_time from event e where e.publish_status = 1 and e.create_by = select e.id,e.event_name,e.start_time,e.end_time from event e where e.publish_status = 1 and e.create_by =
#{createBy} #{createBy}
<if test="tenant != null and tenant != ''">
and e.tenant = #{tenant}
</if>
) a inner join project_subject_map m on a.id = m.subject_id ) a inner join project_subject_map m on a.id = m.subject_id
where m.project_id = #{projectId} where m.project_id = #{projectId}
) b ) b
...@@ -550,9 +580,15 @@ ...@@ -550,9 +580,15 @@
select distinct a.* from ( select distinct a.* from (
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.face_public = 1 where e.publish_status = 1 and e.face_public = 1
<if test="tenant != null and tenant != ''">
and e.tenant = #{tenant}
</if>
union union
select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e select e.id,e.event_name,e.event_type,e.event_describe,e.publish_date,e.total_hot from event e
where e.publish_status = 1 and e.create_by = #{createBy} where e.publish_status = 1 and e.create_by = #{createBy}
<if test="tenant != null and tenant != ''">
and e.tenant = #{tenant}
</if>
) a inner join project_subject_map m on a.id = m.subject_id ) a inner join project_subject_map m on a.id = m.subject_id
left join event_tag t3 on a.id=t3.event_id left join event_tag t3 on a.id=t3.event_id
where m.project_id = #{projectId} where m.project_id = #{projectId}
...@@ -636,6 +672,9 @@ ...@@ -636,6 +672,9 @@
<select id="eventList" resultType="com.zzsn.event.vo.EventVO"> <select id="eventList" resultType="com.zzsn.event.vo.EventVO">
select t.id,t.event_name from event t where 1=1 select t.id,t.event_name from event t where 1=1
<if test="tenant != null and tenant != ''">
and t.tenant = #{tenant}
</if>
<if test="eventIdList != null and eventIdList.size()>0"> <if test="eventIdList != null and eventIdList.size()>0">
and t.id in and t.id in
<foreach collection="eventIdList" open="(" separator="," close=")" item="item"> <foreach collection="eventIdList" open="(" separator="," close=")" item="item">
......
...@@ -166,8 +166,8 @@ public interface IEventService extends IService<Event> { ...@@ -166,8 +166,8 @@ public interface IEventService extends IService<Event> {
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventExcelVO> frontAllList(String projectId, String createBy, List<String> eventIdList,String searchWord, List<EventExcelVO> frontAllList(String projectId, String createBy, List<String> eventIdList, String searchWord,
String eventType, String labelField,String labelName, Integer size); String eventType, String labelField, String labelName, Integer size);
/** /**
* 默认创建的,公开且发布的事件信息集合 * 默认创建的,公开且发布的事件信息集合
...@@ -179,8 +179,8 @@ public interface IEventService extends IService<Event> { ...@@ -179,8 +179,8 @@ public interface IEventService extends IService<Event> {
* @author lkg * @author lkg
* @date 2024/4/10 * @date 2024/4/10
*/ */
List<EventExcelVO> frontOwnerList(String projectId, String createBy, List<String> eventIdList,String searchWord, List<EventExcelVO> frontOwnerList(String projectId, String createBy, List<String> eventIdList, String searchWord,
String eventType, String labelField,String labelName, Integer size); String eventType, String labelField, String labelName, Integer size);
/** /**
* 模型信息列表 * 模型信息列表
......
package com.zzsn.event.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsn.event.entity.EventTagClb;
/**
* 克虏宝中事件标签
* @author wangFeng
* @date 2024/10/15 10:07
*/
public interface IEventTagClbService extends IService<EventTagClb> {
}
...@@ -55,6 +55,7 @@ public interface IKeyWordsService extends IService<KeyWords> { ...@@ -55,6 +55,7 @@ public interface IKeyWordsService extends IService<KeyWords> {
*/ */
KeyWords saveKeyword(Event event, String keyword, String exclusionWord); KeyWords saveKeyword(Event event, String keyword, String exclusionWord);
KeyWords saveKeyword(String subjectId, KeyWords keyWords);
/** /**
* 事件绑定关键词信息 * 事件绑定关键词信息
* *
......
package com.zzsn.event.service.impl; package com.zzsn.event.service.impl;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -171,7 +170,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -171,7 +170,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
//获取当前登录人信息 //获取当前登录人信息
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
List<EventFrontVO> pageList = baseMapper.frontAllPageList(projectId, currentUser.getUsername(), eventId,eventName, eventTypes, labelField, labelName, type, order, orderType, offset, pageSize); List<EventFrontVO> pageList = baseMapper.frontAllPageList(projectId, currentUser.getUsername(), eventId,eventName, eventTypes, labelField, labelName, type, order, orderType, offset, pageSize,UserUtil.getLoginUser().getTenant());
if (CollectionUtils.isNotEmpty(pageList)) { if (CollectionUtils.isNotEmpty(pageList)) {
Map<String, String> map = getFirstMap(pageList); Map<String, String> map = getFirstMap(pageList);
if (MapUtil.isNotEmpty(map)) { if (MapUtil.isNotEmpty(map)) {
...@@ -187,7 +186,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -187,7 +186,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
} }
//获取总条数 //获取总条数
Integer count = baseMapper.frontAllCount(projectId, currentUser.getUsername(), eventId,eventName, eventTypes, labelField, labelName, type); Integer count = baseMapper.frontAllCount(projectId, currentUser.getUsername(), eventId,eventName, eventTypes, labelField, labelName, type,UserUtil.getLoginUser().getTenant());
IPage<EventFrontVO> pageData = new Page<>(pageNo, pageSize, count); IPage<EventFrontVO> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList); pageData.setRecords(pageList);
return pageData; return pageData;
...@@ -207,7 +206,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -207,7 +206,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
//获取当前登录人信息 //获取当前登录人信息
UserVo currentUser = UserUtil.getLoginUser(); UserVo currentUser = UserUtil.getLoginUser();
List<EventFrontVO> pageList = baseMapper.frontOwnerPageList(projectId, currentUser.getUsername(), eventName, eventTypes, labelField, labelName, type, order, orderType, offset, pageSize); List<EventFrontVO> pageList = baseMapper.frontOwnerPageList(projectId, currentUser.getUsername(), eventName, eventTypes, labelField, labelName, type, order, orderType, offset, pageSize,currentUser.getTenant());
if (CollectionUtils.isNotEmpty(pageList)) { if (CollectionUtils.isNotEmpty(pageList)) {
Map<String, String> map = getFirstMap(pageList); Map<String, String> map = getFirstMap(pageList);
if (MapUtil.isNotEmpty(map)) { if (MapUtil.isNotEmpty(map)) {
...@@ -219,7 +218,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -219,7 +218,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
} }
//获取总条数 //获取总条数
Integer count = baseMapper.frontOwnerCount(projectId, currentUser.getUsername(), eventName, eventTypes, labelField, labelName, type); Integer count = baseMapper.frontOwnerCount(projectId, currentUser.getUsername(), eventName, eventTypes, labelField, labelName, type,UserUtil.getLoginUser().getTenant());
IPage<EventFrontVO> pageData = new Page<>(pageNo, pageSize, count); IPage<EventFrontVO> pageData = new Page<>(pageNo, pageSize, count);
pageData.setRecords(pageList); pageData.setRecords(pageList);
return pageData; return pageData;
...@@ -260,12 +259,12 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -260,12 +259,12 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Override @Override
public List<EventTopVO> topEventList(String projectId, String createBy,String startTime, String endTime, Integer type, Integer pageSize) { public List<EventTopVO> topEventList(String projectId, String createBy,String startTime, String endTime, Integer type, Integer pageSize) {
return baseMapper.topEventList(projectId,createBy,startTime, endTime, type, 0, pageSize); return baseMapper.topEventList(projectId,createBy,startTime, endTime, type, 0, pageSize,UserUtil.getLoginUser().getTenant());
} }
@Override @Override
public List<EventRegionVO> listByRegion(String projectId, String createBy,Integer type, String name) { public List<EventRegionVO> listByRegion(String projectId, String createBy,Integer type, String name) {
return baseMapper.listByRegion(projectId,createBy,type, name); return baseMapper.listByRegion(projectId,createBy,type, name,UserUtil.getLoginUser().getTenant());
} }
private Map<String, String> getFirstMap(List<EventFrontVO> pageList) { private Map<String, String> getFirstMap(List<EventFrontVO> pageList) {
...@@ -478,7 +477,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -478,7 +477,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
@Override @Override
public List<EventVO> eventList(List<String> eventIdList) { public List<EventVO> eventList(List<String> eventIdList) {
return baseMapper.eventList(eventIdList); return baseMapper.eventList(eventIdList,UserUtil.getLoginUser().getTenant());
} }
@Override @Override
...@@ -512,8 +511,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -512,8 +511,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
} }
@Override @Override
public List<EventExcelVO> frontAllList(String projectId, String createBy, List<String> eventIdList,String eventName, public List<EventExcelVO> frontAllList(String projectId, String createBy, List<String> eventIdList, String eventName,
String eventType, String labelField,String labelName, Integer size) { String eventType, String labelField, String labelName, Integer size) {
Integer type = null; Integer type = null;
if (StringUtils.isNotEmpty(labelField) && labelField.equals("event_label")) { if (StringUtils.isNotEmpty(labelField) && labelField.equals("event_label")) {
type = 1; type = 1;
...@@ -523,7 +522,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -523,7 +522,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
List<Node> nodes = eventCategoryService.categoryList(); List<Node> nodes = eventCategoryService.categoryList();
eventTypes = TreeUtil.belowList(nodes, eventType, true); eventTypes = TreeUtil.belowList(nodes, eventType, true);
} }
return baseMapper.frontAllList(projectId,createBy,eventIdList,eventName,eventTypes,labelField,labelName,type, size); return baseMapper.frontAllList(projectId,createBy,eventIdList,eventName,eventTypes,labelField,labelName,type, size,UserUtil.getLoginUser().getTenant());
} }
@Override @Override
......
package com.zzsn.event.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.event.entity.EventTagClb;
import com.zzsn.event.mapper.EventTagClbMapper;
import com.zzsn.event.service.IEventTagClbService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 克虏宝事件标签
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Service
@Slf4j
@DS("multi-datasource-clb")
public class EventTagClbServiceImpl extends ServiceImpl<EventTagClbMapper, EventTagClb> implements IEventTagClbService {
}
...@@ -244,6 +244,20 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i ...@@ -244,6 +244,20 @@ public class KeyWordsServiceImpl extends ServiceImpl<KeyWordsMapper, KeyWords> i
} }
@Override @Override
public KeyWords saveKeyword(String subjectId, KeyWords keyWords) {
if (keyWords != null){
save(keyWords);
String keyWordsId = keyWords.getId();
//专题和关键词关系
SubjectKeywordsMap subjectKeywordsMap = new SubjectKeywordsMap();
subjectKeywordsMap.setKeywordsId(keyWordsId);
subjectKeywordsMap.setSubjectId(subjectId);
subjectKeywordsMapService.save(subjectKeywordsMap);
}
return keyWords;
}
@Override
public KeywordsVO keywordInfoByEventId(String eventId) { public KeywordsVO keywordInfoByEventId(String eventId) {
return baseMapper.keywordInfoByEventId(eventId); return baseMapper.keywordInfoByEventId(eventId);
} }
......
...@@ -21,6 +21,7 @@ import org.apache.commons.collections4.ListUtils; ...@@ -21,6 +21,7 @@ import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -51,13 +52,18 @@ public class AnalysisTask { ...@@ -51,13 +52,18 @@ public class AnalysisTask {
@Autowired @Autowired
private SubjectAnalysisService subjectAnalysisService; private SubjectAnalysisService subjectAnalysisService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
/** /**
* 每天凌晨0点20分执行一次 * 每天凌晨0点20分执行一次
* 发送 伪事件脉络 所需信息到kafka对应的topic * 发送 伪事件脉络 所需信息到kafka对应的topic
*/ */
@Scheduled(cron = "0 20 0 * * ?") @Scheduled(cron = "0 20 0 * * ?")
public void eventContext_fake() { public void eventContext_fake() {
if(yjzxEnable){
//研究中心不需要此任务
return;
}
Date today = new Date(); Date today = new Date();
Date disableDate = DateUtil.addDate(today, -1); Date disableDate = DateUtil.addDate(today, -1);
List<SubjectKafkaVo> fakeEventIdList = new ArrayList<>(); List<SubjectKafkaVo> fakeEventIdList = new ArrayList<>();
......
package com.zzsn.event.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzsn.event.entity.Event;
import com.zzsn.event.entity.EventTag;
import com.zzsn.event.entity.EventTagClb;
import com.zzsn.event.mapper.EventClbMapper;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.service.IEventTagClbService;
import com.zzsn.event.service.IEventTagService;
import com.zzsn.event.vo.EventVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* 同步克虏宝事件相关信息,因为查询事件时候关联的有其它相关表,并且相关表的字段也参与过滤条件
* @author wangFeng
* @date 2024/10/15 13:51
*/
@Slf4j
@Component
public class SynClbEventDataTask {
@Resource
private IEventService eventService;
@Resource
private IEventTagService eventTagService;
@Resource
private EventClbMapper eventClbMapper;
@Resource
private IEventTagClbService eventTagClbService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
/**
* 同步克虏宝中事件信息到研究中心数据库
*/
@Scheduled(cron = "0 15 0/1 * * ?")
public void synEventData () {
if(!yjzxEnable){
return;
}
log.info("同步克虏宝中事件信息到研究中心数据库开始");
LambdaQueryWrapper<Event> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Event::getFacePublic,1).eq(Event::getPublishStatus,1);
List<Event> list = eventService.list(queryWrapper);
for (Event event : list) {
try{
// 克虏宝事件表
String eventId = event.getId();
EventVO eventVOClb = eventClbMapper.queryInfo(eventId);
if (eventVOClb != null) {
LambdaUpdateWrapper<Event> lambdaUpdateWrapper = Wrappers.lambdaUpdate(Event.class).eq(Event::getId, eventId)
.set(Event::getRelationEvents, eventVOClb.getRelationEvents()) // 事件关联事件
.set(Event::getEventLabel, eventVOClb.getEventLabel()) // 事件表中打的标签
// total_hot根据所有事件定时统计,这个使用研究中心自己的
;
eventService.update(lambdaUpdateWrapper);
// 事件标签表
EventTagClb eventTagClb = eventTagClbService.getOne(new LambdaQueryWrapper<EventTagClb>()
.eq(EventTagClb::getEventId, eventId)
.last(" limit 1"));
LambdaUpdateWrapper<EventTag> tagUpdateWrapper = Wrappers.lambdaUpdate(EventTag.class)
.eq(EventTag::getEventId, eventId)
.set(EventTag::getExtractIndustryTag, eventTagClb.getExtractIndustryTag()) // 事件关联事件
.set(EventTag::getExtractCompanyTag, eventTagClb.getExtractCompanyTag())
.set(EventTag::getExtractPersonTag, eventTagClb.getExtractPersonTag())
.set(EventTag::getExtractSentimentTag, eventTagClb.getExtractSentimentTag())
.set(EventTag::getExtractKeywordsTag, eventTagClb.getExtractKeywordsTag())
.set(EventTag::getExtractLocationTag, eventTagClb.getExtractLocationTag())
.set(EventTag::getExtractTimeTag, eventTagClb.getExtractTimeTag());
eventTagService.update(tagUpdateWrapper);
}
}catch (Exception e){
log.error("同步克虏宝中事件信息到研究中心数据库失败:{}", e);
}
}
log.info("同步克虏宝中事件信息到研究中心数据库结束");
}
}
package com.zzsn.event.util;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
public class RequestUtil {
public static final String env_prod = "prod";
public static String getTenantByRequest(HttpServletRequest request) {
// TODO 待定 看如何取值判断前端环境
String env = request.getHeader("Env");
if (StringUtils.isEmpty(env)) {
// 空的默认生产环境
return env_prod;
}
if(!StringUtils.equals(env, "test")) {
return env_prod;
}
return env;
}
}
...@@ -13,7 +13,8 @@ public abstract class UserUtil { ...@@ -13,7 +13,8 @@ public abstract class UserUtil {
private static final ThreadLocal<UserVo> USER_THREAD_LOCAL = new ThreadLocal<>(); private static final ThreadLocal<UserVo> USER_THREAD_LOCAL = new ThreadLocal<>();
public static UserVo getLoginUser() { public static UserVo getLoginUser() {
return USER_THREAD_LOCAL.get(); UserVo userVo = USER_THREAD_LOCAL.get();
return userVo==null?new UserVo():userVo;
} }
public static void setLoginUser(UserVo userVo) { public static void setLoginUser(UserVo userVo) {
......
...@@ -123,4 +123,8 @@ public class UserVo implements Serializable { ...@@ -123,4 +123,8 @@ public class UserVo implements Serializable {
private String userId; private String userId;
private String customerId; private String customerId;
/**
* 访问环境,prod:正式环境 test:测试环境
*/
private String tenant;
} }
...@@ -51,4 +51,12 @@ public class AddEventVO { ...@@ -51,4 +51,12 @@ public class AddEventVO {
/**伪事件id*/ /**伪事件id*/
private String fakeEventId; private String fakeEventId;
/**事件编码,这里研究中心部署调用克虏宝,直接使用clb中的事件编码*/
private String eventCode;
/**
* 访问环境,prod:正式环境 test:测试环境
*/
private String tenant;
} }
server:
#服务部署环境 clb:克虏宝 yjzx:研究中心
profiles: yjzx
spring: spring:
servlet: servlet:
multipart: multipart:
...@@ -42,22 +45,27 @@ spring: ...@@ -42,22 +45,27 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: master:
url: jdbc:mysql://1.95.14.228:3306/clb_project?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true url: jdbc:mysql://1.95.78.131:3306/clb_project_yjzx?useUnicode=true&characterEncoding=utf-8&AllowPublicKeyRetrieval=True&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true
username: ciglobal username: ciglobal
password: _PSuWVQ4CLpX password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource1: multi-datasource1:
url: jdbc:mysql://1.95.78.131:3306/clb_xxl_job?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://1.95.78.131:3306/clb_xxl_job_yjzx?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal username: ciglobal
password: qwer@9988&zzsn password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource2: multi-datasource2:
url: jdbc:mysql://1.95.14.228:3306/clb_system?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://1.95.78.131:3306/clb_system_yjzx?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: ciglobal username: ciglobal
password: _PSuWVQ4CLpX password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
multi-datasource-clb:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://1.95.14.228:3306/clb_project?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
username: ciglobal
password: _PSuWVQ4CLpX
elasticsearch: elasticsearch:
uris: ["192.168.0.24:9700","192.168.0.150:9200","192.168.0.81:9700"] uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"] # ["192.168.0.24:9700","192.168.0.150:9200","192.168.0.81:9700"]
username: elastic username: elastic
password: zzsn9988 password: zzsn9988
connection-timeout: 300000 connection-timeout: 300000
...@@ -66,12 +74,12 @@ spring: ...@@ -66,12 +74,12 @@ spring:
stream: stream:
kafka: kafka:
binder: binder:
brokers: 192.168.0.180:7092 brokers: 1.95.78.131:9092
zkNodes: 192.168.0.180:12181 zkNodes: 1.95.78.131:2181
requiredAcks: 1 requiredAcks: 1
redis: redis:
database: 0 database: 11
host: 114.116.90.53 host: 1.95.69.2
lettuce: lettuce:
pool: pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制 max-active: 8 #最大连接数据库连接数,设 0 为没有限制
...@@ -82,7 +90,7 @@ spring: ...@@ -82,7 +90,7 @@ spring:
port: 6380 port: 6380
password: RPHZgkDQ4zGJ password: RPHZgkDQ4zGJ
kafka: kafka:
bootstrap-servers: 192.168.0.180:7092 bootstrap-servers: 1.95.78.131:9092
producer: # 生产者 producer: # 生产者
retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送 retries: 3 # 设置大于0的值,则客户端会将发送失败的记录重新发送
batch-size: 16384 batch-size: 16384
...@@ -94,15 +102,9 @@ spring: ...@@ -94,15 +102,9 @@ spring:
value-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer
properties: properties:
max.request.size: 335544324 #32M max.request.size: 335544324 #32M
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
consumer: consumer:
#用于标识此使用者所属的使用者组的唯一字符串 #用于标识此使用者所属的使用者组的唯一字符串
group-id: event-analysis-group group-id: event-analysis-group-yjzx
#当Kafka中没有初始偏移量或者服务器上不再存在当前偏移量时该怎么办,默认值为latest,表示自动将偏移重置为最新的偏移量 #当Kafka中没有初始偏移量或者服务器上不再存在当前偏移量时该怎么办,默认值为latest,表示自动将偏移重置为最新的偏移量
#可选的值为latest, earliest, none #可选的值为latest, earliest, none
auto-offset-reset: latest auto-offset-reset: latest
...@@ -114,13 +116,6 @@ spring: ...@@ -114,13 +116,6 @@ spring:
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
#值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer #值的反序列化器类,实现类实现了接口org.apache.kafka.common.serialization.Deserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
security:
protocol: SASL_PLAINTEXT
sasl:
mechanism: PLAIN
jaas:
config: org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin-zzsn9988";
main: main:
allow-circular-references: true allow-circular-references: true
mybatis-plus: mybatis-plus:
...@@ -132,18 +127,17 @@ obs: ...@@ -132,18 +127,17 @@ obs:
sk: heR353lvSWVPNU8pe2QxDtd8GDsO5L6PGH5eUoQY sk: heR353lvSWVPNU8pe2QxDtd8GDsO5L6PGH5eUoQY
endPoint: https://obs.cn-north-1.myhuaweicloud.com endPoint: https://obs.cn-north-1.myhuaweicloud.com
scheduling: scheduling:
enable: true enable: false
yjzxEnable: false
serviceProject: serviceProject:
url: https://clb.ciglobal.cn/clb-api/datapull/ url: https://clb.ciglobal.cn/clb-api/datapull/
checkToken:
url: https://clb.ciglobal.cn/clb-api/sys/checkToken
scoreRule: scoreRule:
weekScore: 10 weekScore: 10
monthScore: 5 monthScore: 5
yearScore: 3 yearScore: 3
beforeYearScore: 1 beforeYearScore: 1
translate: translate:
url: http://114.116.116.241:8018/translate/getTranslateInfoWithTag url: http://1.95.51.144:8018/translate/getTranslateInfoWithTag
python: python:
#python打分接口-弃用 #python打分接口-弃用
scoreModelUrl: http://114.116.36.231:8080/score scoreModelUrl: http://114.116.36.231:8080/score
...@@ -162,7 +156,12 @@ kafka: ...@@ -162,7 +156,12 @@ kafka:
topic: topic:
subject: subject:
run: subjectModelTest run: subjectModelTest
event:
run: eventSubjectModelTest
clb: clb:
eventAdd: http://1.95.72.34:1688/event/third/api/saveEvent
eventEdit: http://1.95.72.34:1688/event/third/api/editEvent
eventDelete: http://1.95.72.34:1688/event/third/api/deleteEvent
subject: subject:
default: default:
processing: processing:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论