Browse Source

提交

tags/v1.0.1-214.1626
wangyi 2 years ago
commit
716e6d4eeb
100 changed files with 19381 additions and 0 deletions
  1. +31
    -0
      .gitignore
  2. +117
    -0
      .mvn/wrapper/MavenWrapperDownloader.java
  3. BIN
      .mvn/wrapper/maven-wrapper.jar
  4. +2
    -0
      .mvn/wrapper/maven-wrapper.properties
  5. +54
    -0
      config/application.properties
  6. +50
    -0
      config/application.yml
  7. +2
    -0
      config/config.properties
  8. +310
    -0
      mvnw
  9. +182
    -0
      mvnw.cmd
  10. +229
    -0
      pom.xml
  11. +24
    -0
      src/main/java/com/stonedt/intelligence/StonedtPortalApplication.java
  12. +31
    -0
      src/main/java/com/stonedt/intelligence/aop/SystemControllerLog.java
  13. +204
    -0
      src/main/java/com/stonedt/intelligence/aop/SystemLogAspect.java
  14. +24
    -0
      src/main/java/com/stonedt/intelligence/aspect/SystemControllerLog.java
  15. +170
    -0
      src/main/java/com/stonedt/intelligence/aspect/UserLogAspect.java
  16. +35
    -0
      src/main/java/com/stonedt/intelligence/config/CorsFilter.java
  17. +28
    -0
      src/main/java/com/stonedt/intelligence/config/ScheduleConfig.java
  18. +21
    -0
      src/main/java/com/stonedt/intelligence/config/StartComponent.java
  19. +11
    -0
      src/main/java/com/stonedt/intelligence/constant/HotNewsConstant.java
  20. +67
    -0
      src/main/java/com/stonedt/intelligence/constant/MonitorConstant.java
  21. +42
    -0
      src/main/java/com/stonedt/intelligence/constant/PublicoptionConstant.java
  22. +67
    -0
      src/main/java/com/stonedt/intelligence/constant/ReportConstant.java
  23. +119
    -0
      src/main/java/com/stonedt/intelligence/constant/SearchConstant.java
  24. +17
    -0
      src/main/java/com/stonedt/intelligence/constant/VolumeConstant.java
  25. +60
    -0
      src/main/java/com/stonedt/intelligence/constant/WechatConstant.java
  26. +336
    -0
      src/main/java/com/stonedt/intelligence/controller/AnalysisController.java
  27. +397
    -0
      src/main/java/com/stonedt/intelligence/controller/DatafavoriteContoller.java
  28. +135
    -0
      src/main/java/com/stonedt/intelligence/controller/DisplayBoardContoller.java
  29. +872
    -0
      src/main/java/com/stonedt/intelligence/controller/FullSearchController.java
  30. +64
    -0
      src/main/java/com/stonedt/intelligence/controller/HotNewsController.java
  31. +55
    -0
      src/main/java/com/stonedt/intelligence/controller/LSearchController.java
  32. +219
    -0
      src/main/java/com/stonedt/intelligence/controller/LoginController.java
  33. +430
    -0
      src/main/java/com/stonedt/intelligence/controller/MonitorController.java
  34. +790
    -0
      src/main/java/com/stonedt/intelligence/controller/ProjectController.java
  35. +577
    -0
      src/main/java/com/stonedt/intelligence/controller/PublicOptionContoller.java
  36. +131
    -0
      src/main/java/com/stonedt/intelligence/controller/ReportController.java
  37. +47
    -0
      src/main/java/com/stonedt/intelligence/controller/SearchController.java
  38. +380
    -0
      src/main/java/com/stonedt/intelligence/controller/SystemController.java
  39. +196
    -0
      src/main/java/com/stonedt/intelligence/controller/UserAuthController.java
  40. +137
    -0
      src/main/java/com/stonedt/intelligence/controller/UserController.java
  41. +93
    -0
      src/main/java/com/stonedt/intelligence/controller/VolumeController.java
  42. +41
    -0
      src/main/java/com/stonedt/intelligence/controller/WechatController.java
  43. +25
    -0
      src/main/java/com/stonedt/intelligence/dao/AnalysisDao.java
  44. +13
    -0
      src/main/java/com/stonedt/intelligence/dao/AnalysisQuartzDao.java
  45. +23
    -0
      src/main/java/com/stonedt/intelligence/dao/DatafavoriteDao.java
  46. +15
    -0
      src/main/java/com/stonedt/intelligence/dao/DisplayBoardDao.java
  47. +73
    -0
      src/main/java/com/stonedt/intelligence/dao/IFullSearchDao.java
  48. +30
    -0
      src/main/java/com/stonedt/intelligence/dao/OpinionConditionDao.java
  49. +64
    -0
      src/main/java/com/stonedt/intelligence/dao/ProjectDao.java
  50. +29
    -0
      src/main/java/com/stonedt/intelligence/dao/ProjectTaskDao.java
  51. +57
    -0
      src/main/java/com/stonedt/intelligence/dao/PublicOptionDao.java
  52. +32
    -0
      src/main/java/com/stonedt/intelligence/dao/ReportCustomDao.java
  53. +18
    -0
      src/main/java/com/stonedt/intelligence/dao/ReportDetailDao.java
  54. +37
    -0
      src/main/java/com/stonedt/intelligence/dao/SolutionGroupDao.java
  55. +13
    -0
      src/main/java/com/stonedt/intelligence/dao/SynthesizeDao.java
  56. +78
    -0
      src/main/java/com/stonedt/intelligence/dao/SystemDao.java
  57. +13
    -0
      src/main/java/com/stonedt/intelligence/dao/SystemLogDao.java
  58. +118
    -0
      src/main/java/com/stonedt/intelligence/dao/UserDao.java
  59. +24
    -0
      src/main/java/com/stonedt/intelligence/dao/UserLogDao.java
  60. +24
    -0
      src/main/java/com/stonedt/intelligence/dao/VolumeMonitorDao.java
  61. +17
    -0
      src/main/java/com/stonedt/intelligence/dao/WarningarticleDao.java
  62. +323
    -0
      src/main/java/com/stonedt/intelligence/entity/Analysis.java
  63. +237
    -0
      src/main/java/com/stonedt/intelligence/entity/AnalysisQuartzDo.java
  64. +106
    -0
      src/main/java/com/stonedt/intelligence/entity/DataMonitorVO.java
  65. +18
    -0
      src/main/java/com/stonedt/intelligence/entity/DatafavoriteEntity.java
  66. +72
    -0
      src/main/java/com/stonedt/intelligence/entity/FullPolymerization.java
  67. +75
    -0
      src/main/java/com/stonedt/intelligence/entity/FullType.java
  68. +41
    -0
      src/main/java/com/stonedt/intelligence/entity/FullWord.java
  69. +265
    -0
      src/main/java/com/stonedt/intelligence/entity/OpinionCondition.java
  70. +115
    -0
      src/main/java/com/stonedt/intelligence/entity/Project.java
  71. +124
    -0
      src/main/java/com/stonedt/intelligence/entity/ProjectTask.java
  72. +108
    -0
      src/main/java/com/stonedt/intelligence/entity/PublicoptionDetailEntity.java
  73. +109
    -0
      src/main/java/com/stonedt/intelligence/entity/PublicoptionEntity.java
  74. +212
    -0
      src/main/java/com/stonedt/intelligence/entity/ReportCustom.java
  75. +225
    -0
      src/main/java/com/stonedt/intelligence/entity/ReportDetail.java
  76. +49
    -0
      src/main/java/com/stonedt/intelligence/entity/SolutionGroup.java
  77. +178
    -0
      src/main/java/com/stonedt/intelligence/entity/SysLog.java
  78. +22
    -0
      src/main/java/com/stonedt/intelligence/entity/SystemLogEntity.java
  79. +148
    -0
      src/main/java/com/stonedt/intelligence/entity/User.java
  80. +137
    -0
      src/main/java/com/stonedt/intelligence/entity/VolumeMonitor.java
  81. +160
    -0
      src/main/java/com/stonedt/intelligence/entity/WarningSetting.java
  82. +67
    -0
      src/main/java/com/stonedt/intelligence/interceptor/LoginHandlerInterceptor.java
  83. +95
    -0
      src/main/java/com/stonedt/intelligence/interceptor/WebConfigurer.java
  84. +3142
    -0
      src/main/java/com/stonedt/intelligence/quartz/AnalysisDataRequest.java
  85. +274
    -0
      src/main/java/com/stonedt/intelligence/quartz/AnalysisPTQuartz.java
  86. +351
    -0
      src/main/java/com/stonedt/intelligence/quartz/AnalysisQuartz.java
  87. +155
    -0
      src/main/java/com/stonedt/intelligence/quartz/HotDataSchedule.java
  88. +808
    -0
      src/main/java/com/stonedt/intelligence/quartz/ReportDataSchedule.java
  89. +284
    -0
      src/main/java/com/stonedt/intelligence/quartz/ReportListSchedule.java
  90. +649
    -0
      src/main/java/com/stonedt/intelligence/quartz/SynthesizeSchedule.java
  91. +737
    -0
      src/main/java/com/stonedt/intelligence/quartz/VolumeDataRequest.java
  92. +133
    -0
      src/main/java/com/stonedt/intelligence/quartz/VolumePTSchedule.java
  93. +143
    -0
      src/main/java/com/stonedt/intelligence/quartz/VolumeSchedule.java
  94. +635
    -0
      src/main/java/com/stonedt/intelligence/quartz/WarningSchedule.java
  95. +165
    -0
      src/main/java/com/stonedt/intelligence/quartz/WechatSchedule.java
  96. +176
    -0
      src/main/java/com/stonedt/intelligence/quartz/WechatqrcodeSchedule.java
  97. +1279
    -0
      src/main/java/com/stonedt/intelligence/quartz/publicoptionQuartz.java
  98. +29
    -0
      src/main/java/com/stonedt/intelligence/service/AnalysisService.java
  99. +16
    -0
      src/main/java/com/stonedt/intelligence/service/ArticleService.java
  100. +19
    -0
      src/main/java/com/stonedt/intelligence/service/DatafavoriteService.java

+ 31
- 0
.gitignore View File

@@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/

+ 117
- 0
.mvn/wrapper/MavenWrapperDownloader.java View File

@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}

BIN
.mvn/wrapper/maven-wrapper.jar View File


+ 2
- 0
.mvn/wrapper/maven-wrapper.properties View File

@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

+ 54
- 0
config/application.properties View File

@@ -0,0 +1,54 @@
# es搜索地址
#es.search.url=http://192.168.71.63:6306
#es.search.url=http://s1.stonedt.com:3101
#es.search.url=http://192.168.71.81:8123
es.search.url=http://dx2.stonedt.com:7121
# es热点地址
es.hot.search.url=http://dx2.stonedt.com:7121
# 本系统外网访问地址
system.url=http://localhost:8080
# 卡夫卡地址
kafuka.url = http://dx2.stonedt.com:7189/stonedt-etl/setKafkaMsg
insertnewwords.url = http://192.168.71.84:8490/newDic/insert
# 定时任务开关(0:关闭,1:开启)
# 监测分析
schedule.analysis.open=0
#schedule.analysispt.cron=0 0 22 * * ?
schedule.analysispt.cron=0 0/1 * * * ?
# 监测分析pt
schedule.analysispt.open=0
# 声量监测
schedule.volume.open=0
# 声量监测pt
schedule.volumept.open=0
# 数据报告-日报列表
schedule.dayreport.open=0
# 数据报告-周报列表
schedule.weekreport.open=0
# 数据报告-月报列表
schedule.monthreport.open=0
# 数据报告-数据
schedule.report.open=0
# 预警
schedule.warning.open=0
#微信推送
schedule.wechat.open=0
#微信定时生成二维码
schedule.wechatqrcode.open=0
#热点
es.hot.open=1
#综合看板
schedule.synthesize.open=1
#舆情研判
schedule.publicoption.open=1
stopwords=1

+ 50
- 0
config/application.yml View File

@@ -0,0 +1,50 @@
server:
port: 8084
servlet:
session:
cookie:
name: local-portal
max-age: 3600
timeout: 3600
spring:
thymeleaf:
prefix: classpath:/templates/
cache: false
mode: LEGACYHTML5 # 用非严格的 HTML
encoding: UTF-8
servlet:
content-type: text/html
http:
# 设置编码
encoding:
force: true
charset: UTF-8
enabled: true
devtools:
restart:
enabled: true #热部署生效
application:
name: stonedt-portal
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/stonedt_portal?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
redis:
database: 0
host: localhost
port: 6379
max-active: 10000
max-idle: 10
max-wait: 100000
timeout: 100000
mybatis:
type-aliases-package: com.stonedt.intelligence.entity
mapper-locations: classpath:mapper/*.xml
logging:
level:
com.stonedt.intelligence.dao : debug

+ 2
- 0
config/config.properties View File

@@ -0,0 +1,2 @@
# 服务器文件路径
product.manual.path=C:/Users/zhx/Desktop/新版本舆情产品手册V1.0.pdf

+ 310
- 0
mvnw View File

@@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

if [ -z "$MAVEN_SKIP_RC" ] ; then

if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi

if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi

fi

# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac

if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi

if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"

# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done

saveddir=`pwd`

M2_HOME=`dirname "$PRG"`/..

# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`

cd "$saveddir"
# echo Using m2 at $M2_HOME
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi

if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi

if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi

if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi

if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi

CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {

if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi

basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}

# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}

BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi

##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi

if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi

else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################

export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS

WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182
- 0
mvnw.cmd View File

@@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"

FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)

@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)

powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension

@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*

%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause

if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

exit /B %ERROR_CODE%

+ 229
- 0
pom.xml View File

@@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.stonedt</groupId>
<artifactId>stonedt-portal</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>stonedt-portal</name>
<description>stonedt-portal</description>

<properties>
<java.version>1.8</java.version>

<fastjson.version>1.2.47</fastjson.version>
<druid-spring-boot-starter.version>1.1.10</druid-spring-boot-starter.version>
<mybatis-spring-boot-starter.version>1.3.2</mybatis-spring-boot-starter.version>
<pagehelper-spring-boot-starter.version>1.2.3</pagehelper-spring-boot-starter.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot-starter.version}</version>
</dependency>
<!-- 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper-spring-boot-starter.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- json库统一使用fastjson -->
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.6.0</version>
</dependency> -->

<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>

<!-- 雪花算法唯一id -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.2.5</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.15</version>
</dependency>

<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>


<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.20</version>
</dependency>
<dependency>
<groupId>com.hankcs</groupId>
<artifactId>hanlp</artifactId>
<version>portable-1.7.0</version>
</dependency>
</dependencies>

<build>
<finalName>stonedt-portal</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<!--<plugin>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--<configuration>-->
<!--<source>1.8</source>-->
<!--<target>1.8</target>-->
<!--<encoding>UTF-8</encoding>-->
<!--<compilerArguments>-->
<!--<extdirs>${project.basedir}/libs</extdirs>-->
<!--</compilerArguments>-->
<!--<includeSystemScope>true</includeSystemScope>-->
<!--</configuration>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/**</exclude>
</excludes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/**</include>
</includes>
</resource>
</resources>
</build>

</project>

+ 24
- 0
src/main/java/com/stonedt/intelligence/StonedtPortalApplication.java View File

@@ -0,0 +1,24 @@
package com.stonedt.intelligence;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
* 启动类
*/
@SpringBootApplication
@EnableScheduling
public class StonedtPortalApplication{

public static void main(String[] args) {
SpringApplication.run(StonedtPortalApplication.class, args);
}

}

+ 31
- 0
src/main/java/com/stonedt/intelligence/aop/SystemControllerLog.java View File

@@ -0,0 +1,31 @@
package com.stonedt.intelligence.aop;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @date 2019年11月27日 上午11:44:43
*/
@Target({ElementType.PARAMETER, ElementType.METHOD})//作用在参数和方法上
@Retention(RetentionPolicy.RUNTIME)//运行时注解
@Documented//表明这个注解应该被 javadoc工具记录
public @interface SystemControllerLog {
String operation() default "";
String type() default "";
String remark() default "";
String module() default "";
String submodule() default "";
String a = "";
}

+ 204
- 0
src/main/java/com/stonedt/intelligence/aop/SystemLogAspect.java View File

@@ -0,0 +1,204 @@
package com.stonedt.intelligence.aop;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.entity.SysLog;
import com.stonedt.intelligence.entity.SystemLogEntity;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.SystemLogService;
import com.stonedt.intelligence.service.UserService;
import eu.bitwalker.useragentutils.UserAgent;
import lombok.extern.slf4j.Slf4j;
/**
* @date 2019年11月27日 下午12:03:01
*/
@Aspect
@Component
@SuppressWarnings("all")
@Slf4j
public class SystemLogAspect {
@Autowired
private SystemLogService systemLogService;
@Autowired
private UserService userService;
@Pointcut("@annotation(com.stonedt.intelligence.aop.SystemControllerLog)")
public void controllerAspect(){
System.out.println("12121212121221");
}
/**
* @Description 前置通知 ,用于拦截Controller层记录用户的操作
*/
@Before("controllerAspect()")
public void doBefore(JoinPoint joinPoint){
System.out.println("进入拦截器----------");
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest();
SysLog sysLog = new SysLog();
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
System.out.println("拦截到了" + joinPoint.getSignature().getName() +"方法...");
String loginIp = getIpAddr(request);
String username = "";
Integer id = null ;
String signatrue_name = joinPoint.getSignature().getName();
if(signatrue_name.equals("login")) {
//String queryString = request.getQueryString();
String telephone = request.getParameter("telephone");
User selectUserByTelephone = userService.selectUserByTelephone(telephone);
if(selectUserByTelephone!=null) {
username = selectUserByTelephone.getUsername();
id = selectUserByTelephone.getId();
System.out.println("username:"+username);
}
}else {
User use = (User)request.getSession().getAttribute("User");
username = use.getUsername();
id = use.getId();
}
UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
String remark = joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName();
SystemLogEntity systemlog = new SystemLogEntity();
log.info("浏览器:{}", userAgent.getBrowser().toString());
systemlog.setUser_browser(userAgent.getBrowser().toString());
log.info("浏览器版本:{}", userAgent.getBrowserVersion());
systemlog.setUser_browser_version(userAgent.getBrowserVersion().getVersion());
log.info("操作系统: {}", userAgent.getOperatingSystem().toString());
systemlog.setOperatingSystem(userAgent.getOperatingSystem().toString());
systemlog.setUser_id(id);
systemlog.setUsername(username);
systemlog.setLoginip(loginIp);
try {
SysLog controllerMethodDescription = getControllerMethodDescription(joinPoint);
String module = controllerMethodDescription.getModule_name();
System.out.println("module:"+module);
systemlog.setModule(module);
String type = controllerMethodDescription.getType();
systemlog.setType(type);
//子模块
String submodule_name = controllerMethodDescription.getSubmodule_name();
systemlog.setSubmodule(submodule_name);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
systemLogService.addData(systemlog);
}
public static String getIpAddr(HttpServletRequest request) {
String ipAddress = null;
try {
ipAddress = request.getHeader("x-forwarded-for");
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("WL-Proxy-Client-IP");
}
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getRemoteAddr();
if ("127.0.0.1".equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)) {
// 根据网卡取本机配置的IP
InetAddress inet = null;
try {
inet = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
ipAddress = inet.getHostAddress();
}
}
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
if (ipAddress.indexOf(",") > 0) {
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
}
}
} catch (Exception e) {
ipAddress = "";
e.printStackTrace();
}
return ipAddress;
}
/**
* @Description 获取注解中对方法的描述信息 用于Controller层注解
*/
public static SysLog getControllerMethodDescription(JoinPoint joinPoint) throws Exception {
SysLog sysLog = new SysLog();
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();//目标方法名
Object[] arguments = joinPoint.getArgs();
Class targetClass = Class.forName(targetName);
Method[] methods = targetClass.getMethods();
for (Method method:methods) {
if (method.getName().equals(methodName)){
Class[] clazzs = method.getParameterTypes();
if (clazzs.length == arguments.length){
String module = method.getAnnotation(SystemControllerLog.class).module();
String type = method.getAnnotation(SystemControllerLog.class).type();
String submodule = method.getAnnotation(SystemControllerLog.class).submodule();
sysLog.setModule_name(module);
sysLog.setType(type);
sysLog.setSubmodule_name(submodule);
break;
}
}
}
return sysLog;
}
}

+ 24
- 0
src/main/java/com/stonedt/intelligence/aspect/SystemControllerLog.java View File

@@ -0,0 +1,24 @@
package com.stonedt.intelligence.aspect;
import java.lang.annotation.*;
/**
* @date 2019年11月27日 上午11:44:43
*/
@Target({ElementType.PARAMETER, ElementType.METHOD})//作用在参数和方法上
@Retention(RetentionPolicy.RUNTIME)//运行时注解
@Documented//表明这个注解应该被 javadoc工具记录
public @interface SystemControllerLog {
String operation() default ""; // 请求名称
String type() default ""; // 操作类型
String remark() default ""; // 注释
String module() default ""; // 模块名称
String submodule() default ""; // 子模块名称
String description() default ""; // 描述
}

+ 170
- 0
src/main/java/com/stonedt/intelligence/aspect/UserLogAspect.java View File

@@ -0,0 +1,170 @@
package com.stonedt.intelligence.aspect;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.UserLogService;
import com.stonedt.intelligence.util.*;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.stereotype.Component;
import org.aspectj.lang.reflect.MethodSignature;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* description: 用户操作日志 <br>
* date: 2020/5/9 12:31 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
@Aspect
@Component
public class UserLogAspect {
@Autowired
UserLogService userLogService;
@Autowired
UserUtil userUtil;
@Value("${kafuka.url}")
private String kafuka_url;
// 切点
@Pointcut("@annotation(com.stonedt.intelligence.aspect.SystemControllerLog)")
public void controllerAspect() {
}
@Around("controllerAspect()")
public Object around(ProceedingJoinPoint point) {
Object result = null;
long times = System.currentTimeMillis();
try {
// 执行方法
result = point.proceed();
} catch (Throwable e) {
e.printStackTrace();
}
long timee = System.currentTimeMillis();
// 保存日志
saveLog(point, times, timee);
return result;
}
/**
* @param joinPoint JoinPoint 对象
* @param times 开始时间
* @param timee 结束时间
* @return void
* @description: 保存用户的操作日志 <br>
* @version: 1.0 <br>
* @date: 2020/5/9 17:41 <br>
* @author: huajiancheng <br>
*/
private void saveLog(ProceedingJoinPoint joinPoint, long timestamps, long timestampe) {
JSONObject responseJson = new JSONObject();
try {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
SystemControllerLog logAnnotation = method.getAnnotation(SystemControllerLog.class);
String submodule = "";
String operation = "";
if (logAnnotation != null) {
// 注解上的描述
submodule = logAnnotation.submodule();
operation = logAnnotation.operation();
}
// 请求的方法名
String class_name = joinPoint.getTarget().getClass().getName();
String method_name = signature.getName();
// 请求的方法参数值
Object[] args = joinPoint.getArgs();
// 请求的方法参数名称
LocalVariableTableParameterNameDiscoverer tableParameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
String[] paramNames = tableParameterNameDiscoverer.getParameterNames(method);
JSONArray paramsArray = new JSONArray(); // 参数
if (args != null && paramNames != null) {
for (int i = 0; i < args.length; i++) {
JSONObject paramsJson = new JSONObject();
String paramKey = paramNames[i];
if (!paramKey.equals("mv") && !paramKey.equals("request") && !paramKey.equals("session")) {
String paramValue = String.valueOf(args[i]);
if (!paramValue.equals("null")) {
paramsJson.put(paramKey, paramValue);
paramsArray.add(paramsJson);
}
}
}
}
// 获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
User user = userUtil.getuser(request);
Long user_id = user.getUser_id();
String organization_id = user.getOrganization_id();
Integer status = user.getStatus();
String username = user.getUsername();
String create_time = DateUtil.getNowTime();
Map<String, Object> organizeMap = new HashMap<String, Object>();
organizeMap.put("organization_id", organization_id);
Map<String, Object> organizeResponseMap = userLogService.getUserOrganizationById(organizeMap);
String organization_name = String.valueOf(organizeResponseMap.get("organization_name"));
String term_of_validity = String.valueOf(organizeResponseMap.get("term_of_validity"));
term_of_validity = term_of_validity.substring(0,19);
String article_public_id = MD5Util.getMD5(user_id + create_time + method_name + method_name + paramsArray.toJSONString());
String times = DateUtil.stampToDate(String.valueOf(timestamps));
String timee = DateUtil.stampToDate(String.valueOf(timestampe));
// Map<String, Object> moudleMap = userLogService.getMoudleByName(module_name);
Map<String, Object> moudleMap = userLogService.getSubMoudleByName(submodule);
String module_name = String.valueOf(moudleMap.get("module_name"));
String submodule_name = String.valueOf(moudleMap.get("submodule_name"));
String submodule_id = String.valueOf(moudleMap.get("submodule_id"));
String module_id = String.valueOf(moudleMap.get("module_id"));
responseJson.put("user_id", user_id);
responseJson.put("article_public_id", article_public_id);
responseJson.put("organization_id", organization_id);
responseJson.put("create_time", create_time);
responseJson.put("username", username);
responseJson.put("status", status);
responseJson.put("parameters", paramsArray.toJSONString());
responseJson.put("organization_name", organization_name);
responseJson.put("class_name", class_name);
responseJson.put("method_name", method_name);
responseJson.put("times", times);
responseJson.put("timee", timee);
responseJson.put("module_id", module_id);
responseJson.put("module_name", module_name);
responseJson.put("operation", operation);
responseJson.put("submodule_id", submodule_id);
responseJson.put("submodule_name", submodule_name);
responseJson.put("term_of_validity", term_of_validity);
responseJson.put("es_index", "stonedt_portaluserlog");
responseJson.put("es_type", "infor");
responseJson.put("hbase_table", "stonedt_portaluserlog");
String result = MyHttpRequestUtil.doPostKafka("proStonedtData", responseJson.toJSONString(), kafuka_url);
if (result.equals("200")) {
System.out.println("发送成功!");
}
// SysLog sysLog = JSON.toJavaObject(responseJson, SysLog.class);
// 保存系统日志
// userLogService.saveUserLog(sysLog);
} catch (Exception e) {
e.getMessage();
}
}
}

+ 35
- 0
src/main/java/com/stonedt/intelligence/config/CorsFilter.java View File

@@ -0,0 +1,35 @@
package com.stonedt.intelligence.config;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
/**
*
* @date 2020年5月25日 下午5:52:52
*/
@WebFilter(filterName = "CorsFilter")
@Configuration
public class CorsFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
String originHeader=((HttpServletRequest) req).getHeader("Origin");
//response.setHeader("Access-Control-Allow-Origin","*");
//response.setHeader("Access-Control-Allow-Origin",appurl);
response.setHeader("Access-Control-Allow-Origin",originHeader);
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, PATCH, DELETE, PUT");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "token, Origin, X-Requested-With, Content-Type, Accept");
chain.doFilter(req, res);
}
}

+ 28
- 0
src/main/java/com/stonedt/intelligence/config/ScheduleConfig.java View File

@@ -0,0 +1,28 @@
package com.stonedt.intelligence.config;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
/**
* 定时任务配置类
*/
@Configuration
@EnableScheduling
public class ScheduleConfig implements SchedulingConfigurer {
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(taskExecutor());
}
@Bean(destroyMethod="shutdown")
public Executor taskExecutor() {
return Executors.newScheduledThreadPool(30);
}
}

+ 21
- 0
src/main/java/com/stonedt/intelligence/config/StartComponent.java View File

@@ -0,0 +1,21 @@
package com.stonedt.intelligence.config;
import com.stonedt.intelligence.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Order(value = 1)
public class StartComponent implements ApplicationRunner{
@Autowired
UserService userService;
@Override
public void run(ApplicationArguments args) throws Exception {
userService.setAlloffline();
}
}

+ 11
- 0
src/main/java/com/stonedt/intelligence/constant/HotNewsConstant.java View File

@@ -0,0 +1,11 @@
package com.stonedt.intelligence.constant;
/**
* 热点资讯
* @author wangyi
*
*/
public class HotNewsConstant {
// 热点资讯
public static String es_api_hotarticle_list = "/hotnews/hotnewslist";

}

+ 67
- 0
src/main/java/com/stonedt/intelligence/constant/MonitorConstant.java View File

@@ -0,0 +1,67 @@
package com.stonedt.intelligence.constant;
/**
* description: 数据监测的数据接口 <br>
* date: 2020/4/16 19:38 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
public interface MonitorConstant {
// 相关文章
public static String es_api_relatearticle_list = "/yqsearch/relatearticlelist";
// 监测列表 取消合并
public static String es_api_search_list = "/yqsearch/searchlist";
// 监测列表 合并文章
public static String es_api_similar_contentlist = "/yqsimilar/qbsearchbycontentlist";
// 监测列表 合并文章-行业
public static String es_api_similar_industry_list = "/yqsimilar/similarindustry";
// 监测列表 合并文章-事件
public static String es_api_similar_event_list = "/yqsimilar/similarevent";
// 监测列表 合并文章-省份
public static String es_api_similar_province_list = "/yqsimilar/similarprovince";
// 监测列表 合并文章-市域
public static String es_api_similar_city_list = "/yqsimilar/similarcity";
// 相似文章合并返回分组id
public static String es_api_similarsearch_content = "/yqsimilar/qbsearchcontent";
// 相似文章合并返回分组id
public static String es_api_similar_titlekeyword_search_content = "/yqsimilar/qbsimilarcontent";
// 相似文章合并返回分组id
public static String es_api_similar_titlekeyword_search_content_by_num_five = "/yqsimilar/qbsimilarcontentbytitlekeyword";
// 跳转文章相似度,数据来源列表页面
public static String es_api_similarsourcename_content = "/yqsimilar/qbsearchcontent";
// 1、文章详情
public static String es_api_article_newdetail = "/yqsearch/getArticlenewdetail";
// 导出数据 全部导出
public static String es_api_search__searchcontent = "/yqt/qbsearchcontent";
//导出文章接口 部分导出
public static final String es_api_exportqbsearchconten = "/yqtids/qbsearchcontent";
//获取数据源列表
public static final String es_api_data_source = "/publicoption/websitestatistics";
//情感切换
public static final String es_api_updateemtion = "/yqtemotion/updateemotion";
//删除文章
public static final String es_api_deletedata = "/yqsearch/deletearticle";
//事件标签
public static final String es_api_search_event_list = "/yqsearch/eventlable";
//行业标签
public static final String es_api_search_industry_list = "/yqsearch/industrylable";
//省份
public static final String es_api_search_province_list = "/yqsearch/statisticsprovince";
//市
public static final String es_api_search_city_list = "/yqsearch/statisticscity";
}

+ 42
- 0
src/main/java/com/stonedt/intelligence/constant/PublicoptionConstant.java View File

@@ -0,0 +1,42 @@
package com.stonedt.intelligence.constant;
/**
* 舆情研判报告常量
* @date 2020年10月15日 下午3:37:30
*/
public class PublicoptionConstant {
//关键词数据来源分布 关键词资讯数量排名
public final static String es_api_keyword_mediaexposure = "/publicoption/mediaexposure";
//关键词数据最高时间段 最高数据量
public final static String es_api_keyword_temporaldatanum= "/publicoption/temporaldatanum";
// 资讯列表 es api
public final static String es_api_search_list = "/yqsearch/searchlist";
// 查询资讯根据来源划分
public final static String es_api_websitestatistics = "/publicoption/websitestatistics";
// 查询最高热度资讯根据时间划分
public final static String es_api_eventcontext = "/publicoption/eventcontext";
public final static String es_api_datasourceanalysis = "/publicoption/datasourceanalysis";
public final static String es_api_sentimentFlagChart = "/publicoption/sentimentFlagChart";
public final static String es_api_qbsearchcontent = "/publicoption/qbsearchcontent";
public final static String es_api_authorstatistics = "/publicoption/authorstatistics";
public final static String es_api_medialist = "/yqsearch/medialist";
public final static String es_api_media_medialist = "/media/wemedialist";
public final static String es_api_datasourcestatistics = "/publicoption/datasourcestatistics";
public final static String es_yq_qbsearchcontent = "/yqt/qbsearchcontent";
public final static String es_api_HotPeoplestatistics = "/publicoption/HotPeoplestatistics";
}

+ 67
- 0
src/main/java/com/stonedt/intelligence/constant/ReportConstant.java View File

@@ -0,0 +1,67 @@
package com.stonedt.intelligence.constant;
/**
* 数据报告常量
*/
public class ReportConstant {
// 资讯列表 es api
public final static String es_api_search_list = "/yqsearch/searchlist";
// 来源数据量分布 es api
public final static String es_api_media_exposure = "/yqtenterprise/mediaexposure";
// 情感分析数据统计分布 es api
public final static String es_api_emotion_rate = "/yqtindutry/totalDatasearch";
// 相似文章列表 es api
public final static String es_api_similar_list = "/yqsimilar/qbsearchbycontentlist";
// 相似文章合并返回分组id es api
public final static String es_api_similar_ids = "/yqsimilar/qbsearchcontent";
// 高频词接口 返回结巴需要的title es api
public final static String es_api_highwords_titles = "/yqtenterprise/highwords";
// 热点地区排名 es api
public final static String es_api_hot_spot_ranking = "/yqtreport/geographicalDistribution";
// 媒体活跃度分析 es api
public final static String es_api_media_active = "/yqsearch/activemedia";
// 自媒体热度排名 es api
public final static String es_api_media_list = "/yqsearch/medialist";
// 自媒体信息 es api
public final static String es_api_wemedia_info = "/media/wemedialist";
// 实体识别 es api
public final static String es_api_ner = "/yqsearch/ner";
// 政策 es api
public final static String es_api_policy = "/yqsearch/policy";
// 高频词 无需结巴接口 es api
public final static String es_api_keyword_list = "/yqsearch/keywordlist";
// 分类标签
public final static String es_api_category_list = "/yqsearch/categorylist";
// 去除文章类型titlekeyword
public final static String searchlistnottitlekeyword = "/yqsearch/searchlistnottitlekeyword";
//行业分布分析
public static final String es_api_search_industry_list = "/yqsearch/industrylable";
//事件统计
public static final String es_api_search_event_list = "/yqsearch/eventlable";
public final static String[] spotArray = new String[]{
"北京", "天津", "河北", "山西", "内蒙古", "辽宁", "吉林", "黑龙江", "上海", "江苏",
"浙江", "安徽", "福建", "江西", "山东", "河南", "湖北", "湖南", "重庆", "四川",
"贵州", "云南", "西藏", "陕西", "甘肃", "青海", "宁夏", "新疆", "广东", "广西",
"海南", "台湾", "香港"
};
}

+ 119
- 0
src/main/java/com/stonedt/intelligence/constant/SearchConstant.java View File

@@ -0,0 +1,119 @@
package com.stonedt.intelligence.constant;
/**
* 全文搜索 常量
* @date 2020年4月17日 下午4:51:09
*/
public class SearchConstant {
// 热点资讯 es api
public static final String es_api_hot_rank = "/yqsearch/hotrank";
/**
* 热门
*/
public static final String ES_API_HOT = "/hotnews/hotuniquelist";
/**
* 投诉
*/
public static final String ES_API_COMPLAIN = "/complain/complainlist";
/**
* 市长信箱
*/
public static final String ES_API_MAYOR_MAIL_BOX = "/mayormailbox/mayormailboxlist";
/**
* 公告
*/
public static final String ES_API_ANNOUNCEMENT = "/announcement/announcementlist";
/**
* 公告类型
*/
public static final String ES_API_ANNOUNCEMENT_RTYPE = "/announcement/announcementrtype";
/**
* 研报公告详情
*/
public static final String ES_API_ANNOUNCEMENT_DETAIL = "/commonsearch/getcommondatadetail";
/**
* 研报
*/
public static final String ES_API_RESEARCH_REPORT = "/researchreport/researchreportlist";
/**
* 研报评级
*/
public static final String ES_API_RESEARCH_REPORT_INDUSTRY = "/researchreport/researchreportratingtype";
/**
* 通用接口
*/
public static final String ES_API_COMMON_SEARCH = "/commonsearch/superdatalist";
/**
* 招标详情数据
*/
public static final String ES_API_BIDDING_DETAIL = "/invitate/getinvitatedetail";
/**
* 招聘数据
*/
public static final String ES_API_JOBS_LIST= "/jobs/jobslist";
/**
* 招聘详情
*/
public static final String ES_API_JOBS_DETAIL = "/jobs/getjobsdetail";
/**
* 工商数据
*/
public static final String ES_API_COMPANY_LIST = "/company/companylist";
/**
* 工商分类
*/
public static final String ES_API_COMPANY_INDUSTRY = "/company/companyindustry";
/**
* 工商详情
*/
public static final String ES_API_COMPANY_DETAIL = "/company/getcompanydetail";
/**
* 法律文书
*/
public static final String ES_API_JUDGMENT_LIST = "/judgment/judgmentlist";
/**
* 法律文书 分类
*/
public static final String ES_API_JUDGMENT_CASE_TYPE = "/judgment/judgmentcaseType";
/**
* 通用详情接口
*/
public static final String ES_API_COMMON_DATA_DETAIL = "/commonsearch/getcommondatadetail";
/**
* 专利数据
*/
public static final String ES_API_PATENT_LIST = "/patent/patentlist";
/**
* 专利分类
*/
public static final String ES_API_PATENT_TYPE = "/patent/patentinformationtype";
/**
* 专利详情
*/
public static final String ES_API_PATENT_DETAIL = "/patent/getpatentdetail";
/**
* 投资融资 列表
*/
public static final String ES_API_INVESTMENT_LIST = "/investment/investmentlist";
/**
* 投资融资 分类
*/
public static final String ES_API_INVESTMENT_TYPE = "/investment/investmentrounds";
/**
* 投资融资 详情
*/
public static final String ES_API_INVESTMENT_DETAIL = "/investment/getinvestmentdetail";
/**
* 百度知道
*/
public static final String ES_API_BAIDU_KNOWS_LIST = "/baiduknows/baiduknowslist";
/**
* 学术论文
*/
public static final String ES_API_THESISN_LIST = "/thesisn/thesisnlist";
/**
* 学术论文 详情
*/
public static final String ES_API_THESISN_DETAIL = "/thesisn/getthesisndetail";
}

+ 17
- 0
src/main/java/com/stonedt/intelligence/constant/VolumeConstant.java View File

@@ -0,0 +1,17 @@
package com.stonedt.intelligence.constant;
/**
* 声量监测常量
* @date 2020年4月13日 下午3:37:30
*/
public class VolumeConstant {
// 关键词情感分析数据统计分布 es api 关键词曝光度环比排行
public final static String es_api_keyword_emotion_statistical = "/yqtenterprise/enterpriseemotion";
//关键词数据来源分布 关键词资讯数量排名
public final static String es_api_keyword_mediaexposure = "/yqtenterprise/mediaexposure";
//关键词情感分析数据走势
public final static String es_api_keyword_sentimentFlagChart = "/yqtindutry/sentimentFlagChart";
//关键词高频分布统计
public final static String es_api_keyword_highwords = "/yqtenterprise/highwords";
}

+ 60
- 0
src/main/java/com/stonedt/intelligence/constant/WechatConstant.java View File

@@ -0,0 +1,60 @@
package com.stonedt.intelligence.constant;
/**
* 微信相关
* @author wangyi
*
*/
public class WechatConstant {
// appid
public final static String AppID = "wx27ae60471bc5516f";
//AppSecret
public final static String AppSecret = "18f16a4529395014b66cb8394aeddaf9";
//获取AccessToken接口
public final static String api_wechat_AccessToken = "18f16a4529395014b66cb8394aeddaf9";
//发送模板消息
public final static String api_wechat_template = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx27ae60471bc5516f&secret=18f16a4529395014b66cb8394aeddaf9";
//获取二维码ticket
public final static String api_wechat_qrcode = "18f16a4529395014b66cb8394aeddaf9";
//模板id
public final static String api_wechat_template_id = "Yr-BmtZJctEJSgfq2GfqPnb44iLc6exhesUuUcrasdk";
//模板消息推送
public final static String api_wechat_templatepush = "https://api.weixin.qq.com/cgi-bin/message/template/send";
//生成临时二维码
public final static String api_wechat_temporaryqrcode = "https://api.weixin.qq.com/cgi-bin/qrcode/create";
/**
* 授权
*/
public static final String AUTH_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?";
//
public static final String AUTH_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token?";
/**
*
*/
public static final String AUTH_Basic_Info = "https://api.weixin.qq.com/cgi-bin/user/info?";
public static final String api_wechat_user ="https://api.weixin.qq.com/cgi-bin/user/get?";
}

+ 336
- 0
src/main/java/com/stonedt/intelligence/controller/AnalysisController.java View File

@@ -0,0 +1,336 @@
package com.stonedt.intelligence.controller;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.stonedt.intelligence.aop.SystemControllerLog;
import com.stonedt.intelligence.dao.ProjectDao;
import com.stonedt.intelligence.dao.ProjectTaskDao;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.entity.Analysis;
import com.stonedt.intelligence.service.AnalysisService;
/**
* 监测分析
*/
@Controller
@RequestMapping(value = "/analysis")
public class AnalysisController {
@Autowired
private AnalysisService analysisService;
@Autowired
private ProjectTaskDao projectTaskDao;
/**
* 获取监测分析数据
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "数据获取", operation = "")*/
@PostMapping(value = "/getAanlysisByProjectidAndTimeperiod")
@ResponseBody
public String getAanlysisByProjectidAndTimeperiod(Long projectId, Integer timePeriod) {
Analysis anlysisByProjectidAndTimeperiod = analysisService.getAanlysisByProjectidAndTimeperiod(projectId, timePeriod);
return JSON.toJSONString(anlysisByProjectidAndTimeperiod);
}
/**
* 跳转监测分析页面
*/
@SystemControllerLog(module = "监测分析", submodule = "监测分析页面", type = "查询", operation = "")
@GetMapping(value = "")
public ModelAndView analysis(HttpServletRequest request, ModelAndView mv) {
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
if (StringUtils.isBlank(groupId))
groupId = "";
if (StringUtils.isBlank(projectId))
projectId = "";
mv.addObject("groupId", groupId);
mv.addObject("projectId", projectId);
mv.addObject("groupid", groupId);
mv.addObject("menu", "analysis");
mv.addObject("projectid", projectId);
mv.setViewName("monitor/overview");
return mv;
}
// 历史代码
/**
* 获取监测分析数据
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "查询", operation = "getAnalysisMonitorProjectid")*/
@PostMapping(value = "/getAnalysisMonitorProjectid")
@ResponseBody
public String getAnalysisMonitorProjectid(Long projectId, Integer timePeriod) {
Analysis analysisMonitorProjectid = analysisService.getAnalysisMonitorProjectid(projectId, timePeriod);
return JSON.toJSONString(analysisMonitorProjectid);
}
/**
* 获取相关资讯数据
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "最新资讯", operation = "latestnews")*/
@PostMapping(value = "/latestnews")
@ResponseBody
public String latestnews(@RequestParam("projectid") Long projectid, Integer timePeriod) {
List<Map<String, Object>> latestnews = analysisService.latestnews(projectid, timePeriod);
return JSON.toJSONString(latestnews);
}
/**
* @param [projectid 方案id]
* @description: 获取情感占比 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "查询", operation = "emotionalproportion")*/
@PostMapping(value = "/emotionalproportion")
@ResponseBody
public String emotionalProportion(@RequestParam("projectid") Long projectid, Integer timePeriod) {
JSONObject json = new JSONObject();
// 根据projectid获取信息
Analysis a = analysisService.getInfoByProjectid(projectid, timePeriod);
if (a == null) {
return "{}";
}
if (a.getEmotionalProportion() != null && !"".equals(a.getEmotionalProportion())) {
json = JSONObject.parseObject(a.getEmotionalProportion());
}
return json.toJSONString();
}
/**
* @param [projectid 方案id]
* @description: 方案词命中 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "查询", operation = "planwordhit")*/
@PostMapping(value = "/planwordhit")
@ResponseBody
public String planwordhit(@RequestParam("projectid") Long projectid, Integer timePeriod) {
JSONArray jsona = new JSONArray();
Analysis a = analysisService.getInfoByProjectid(projectid, timePeriod);
if (a == null) {
return "[]";
}
if (a.getPlanWordHit() != null && !"".equals(a.getPlanWordHit())) {
jsona = JSONArray.parseArray(a.getPlanWordHit());
}
return jsona.toJSONString();
}
/**
* @param [projectid 方案id]
* @return java.lang.String
* @description: 热门资讯 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:10 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "查询", operation = "popularinformation")*/
@PostMapping(value = "/popularinformation")
@ResponseBody
public String popularInformation(@RequestParam("projectid") Long projectid, Integer timePeriod) {
JSONArray json = new JSONArray();
Analysis a = analysisService.getInfoByProjectid(projectid, timePeriod);
if (a == null) {
return "[]";
}
if (a.getPopularInformation() != null && !"".equals(a.getPopularInformation())) {
json = JSONArray.parseArray(a.getPopularInformation());
}
return json.toJSONString();
}
/**
* 获取关键词情感分析数据走势
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "关键词情感分析数据走势", operation = "emotioncategory")*/
@PostMapping(value = "/emotioncategory")
@ResponseBody
public String emotioncategory(@RequestParam("projectid") Long projectid, Integer timePeriod) {
@SuppressWarnings("unused")
JSONArray json = new JSONArray();
JSONObject objectdata = new JSONObject();
Analysis a = analysisService.getInfoByProjectid(projectid, timePeriod);
if (a == null) {
return "[]";
}
// if(a.getKeyword_emotion_trend()!=null&&!"".equals(a.getKeyword_emotion_trend())) {
// json=JSONArray.parseArray(a.getKeyword_emotion_trend());
// }
String chinaString = "";
String keyword_emotion_statistical = a.getKeyword_emotion_statistical();
JSONObject parseObject = JSONObject.parseObject(keyword_emotion_statistical);
Integer keyword_count = parseObject.getInteger("keyword_count");
JSONArray positive = parseObject.getJSONArray("positive");
JSONArray negative = parseObject.getJSONArray("negative");
if (keyword_count > 1) {
JSONObject object = JSONObject.parseObject(String.valueOf(positive.get(0)));
String keyword = object.getString("keyword");// 正面占比最高关键词
String rate = object.getString("rate");// 占比
JSONObject object2 = JSONObject.parseObject(String.valueOf(positive.get(1)));
String keyword2 = object2.getString("keyword");// 其次是正面关键词
String rate2 = object2.getString("rate");// 占比
chinaString = "您一共设置了 " + keyword_count + "个关键词,正面占比最高的是【" + keyword + "】到达" + rate + ",其次是【" + keyword2
+ "】到达" + rate2 + "。负面占比最高的是【" + negative.getJSONObject(0).getString("keyword") + "】到达"
+ negative.getJSONObject(0).getString("rate") + ",其次是【"
+ negative.getJSONObject(1).getString("keyword") + "】到达"
+ negative.getJSONObject(1).getString("rate") + "。";
} else if (keyword_count == 1) {
chinaString = "您一共设置了 " + keyword_count + "个关键词,正面占比最高的是【" + positive.getJSONObject(0).getString("keyword")
+ "】到达" + positive.getJSONObject(0).getString("rate") + "。负面占比最高的是【"
+ negative.getJSONObject(0).getString("keyword") + "】到达"
+ negative.getJSONObject(0).getString("rate") + "。";
}
// json.put("china", chinaString);
objectdata.put("china", chinaString);
objectdata.put("data", a);
return objectdata.toJSONString();
}
/**
* @param [projectid 方案id]
* @description: 高频词指数 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "高频词指数", operation = "keywordindex")*/
@PostMapping(value = "/keywordindex")
@ResponseBody
public String keywordindex(@RequestParam("projectid") Long projectid, HttpServletRequest request,
Integer timePeriod) {
// User user = userUtil.getuser(request);
// Long user_id = user.getUser_id();
JSONArray json = new JSONArray();
// Map<String, Object> queryUserid = projectService.queryUserid(user_id);
// if (MapUtils.isEmpty(queryUserid)) {
// return json.toJSONString();
// }
// 根据projectid获取信息
Analysis a = analysisService.getInfoByProjectid(projectid, timePeriod);
if (a == null) {
return "[]";
}
if (a.getKeywordIndex() != null && !"".equals(a.getKeywordIndex())) {
json = JSONArray.parseArray(a.getKeywordIndex());
}
return json.toJSONString();
}
/*@SystemControllerLog(module = "监测分析", submodule = "监测分析", type = "查询", operation = "popularkeyword")*/
@PostMapping("/popularkeyword")
@ResponseBody
public String popularKeyword(@RequestParam("projectid") Long projectid, HttpServletRequest request,
Integer timePeriod) {
JSONObject jsonObject = new JSONObject();
// User user = userUtil.getuser(request);
// Long user_id = user.getUser_id();
// Map<String, Object> queryUserid = projectService.queryUserid(user_id);
// if (MapUtils.isEmpty(queryUserid)) {
// return jsonObject.toJSONString();
// }
Analysis analysis = analysisService.getInfoByProjectid(projectid, timePeriod);
if (analysis == null) {
jsonObject.put("updateTime", "");
jsonObject.put("hotCompany", JSONArray.parseArray("[]"));
jsonObject.put("hotPeople", JSONArray.parseArray("[]"));
jsonObject.put("hotSpot", JSONArray.parseArray("[]"));
return jsonObject.toJSONString();
}
Date createTime = analysis.getCreateTime();
if (null != createTime) {
try {
Instant instant = createTime.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
jsonObject.put("updateTime", localDateTime.format(dateTimeFormatter));
} catch (Exception e) {
e.printStackTrace();
jsonObject.put("updateTime", "");
}
} else {
jsonObject.put("updateTime", "");
}
if (analysis.getHotCompany() != null && !"".equals(analysis.getHotCompany())) {
String hotCompany = analysis.getHotCompany();
jsonObject.put("hotCompany", JSONArray.parseArray(hotCompany));
} else {
jsonObject.put("hotCompany", JSONArray.parseArray("[]"));
}
if (analysis.getHotPeople() != null && !"".equals(analysis.getHotPeople())) {
String hotPeople = analysis.getHotPeople();
jsonObject.put("hotPeople", JSONArray.parseArray(hotPeople));
} else {
jsonObject.put("hotPeople", JSONArray.parseArray("[]"));
}
if (analysis.getHotSpot() != null && !"".equals(analysis.getHotSpot())) {
String hotSpot = analysis.getHotSpot();
jsonObject.put("hotSpot", JSONArray.parseArray(hotSpot));
} else {
jsonObject.put("hotSpot", JSONArray.parseArray("[]"));
}
return jsonObject.toJSONString();
}
/**
* 刷新监测分析结果
*/
@SystemControllerLog(module = "监测分析", submodule = "更新监测分析", type = "更新", operation = "")
@GetMapping(value = "/updateanalysisdata")
@ResponseBody
public String updateanalysis(HttpServletRequest request, ModelAndView mv) {
Map map = new HashMap<String, Object>();
map.put("status", 500);
map.put("result", "fail");
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
if (StringUtils.isBlank(groupId))groupId = "";
if (StringUtils.isBlank(projectId))projectId = "";
try {
Boolean flag = projectTaskDao.updateProjectTaskAnalysisToUnDealFlag(Long.parseLong(projectId));
if(flag==true) {
map.put("status", 200);
map.put("result", "success");
}
} catch (Exception e) {
e.printStackTrace();
}
return JSONObject.toJSONString(map);
}
}

+ 397
- 0
src/main/java/com/stonedt/intelligence/controller/DatafavoriteContoller.java View File

@@ -0,0 +1,397 @@
package com.stonedt.intelligence.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.MonitorConstant;
import com.stonedt.intelligence.entity.DatafavoriteEntity;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.DatafavoriteService;
import com.stonedt.intelligence.service.EarlyWarningService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.SnowFlake;
import com.stonedt.intelligence.aop.SystemControllerLog;

import lombok.extern.slf4j.Slf4j;

/**
* 收藏
*
* @author wangyi datamonitor/updateemtion
*
*/
@Controller
@RequestMapping("/datamonitor")
@Slf4j
public class DatafavoriteContoller {
public SnowFlake snowFlake = new SnowFlake();

@Autowired
public DatafavoriteService datafavoriteService;
@Autowired
private EarlyWarningService earlyWarningService;

// es搜索地址
@Value("${es.search.url}")
private String es_search_url;
/**
* 情感标记
* @param request
* @param mv
* @param session
* @param id
* @param projectid
* @param groupid
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "情感标记", type = "情感标记", operation = "")
@PostMapping(value = "/updateemtion")
@ResponseBody
public String updateemtion(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id,
@RequestParam(value = "publish_time", required = false, defaultValue = "") String publish_time,
@RequestParam(value = "flag", required = false, defaultValue = "") int flag) {
datafavoriteService.updateemtion(id,flag,es_search_url,publish_time);
User user = (User) session.getAttribute("User");
Map<String,Object> map =new HashMap<String,Object>();
map.put("status", 200);
map.put("result", "success");
return JSON.toJSONString(map);

}
/**
* 添加收藏
* @param request
* @param mv
* @param session
* @param id
* @param projectid
* @param groupid
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "收藏", type = "添加收藏", operation = "")
@PostMapping(value = "/addfavoritedata")
@ResponseBody
public String displayboardlist(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id,
@RequestParam(value = "projectid", required = false, defaultValue = "") Long projectid,
@RequestParam(value = "groupid", required = false, defaultValue = "") Long groupid) {
User user = (User) session.getAttribute("User");
String url = es_search_url + MonitorConstant.es_api_article_newdetail;
String params = "article_public_id=" + id + "&esindex=postal&estype=infor";
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
String title = parseObject.get("title").toString();
String source_name = parseObject.get("sourcewebsitename").toString();
String emotionalIndex = parseObject.get("emotionalIndex").toString();
String publish_time = parseObject.get("publish_time").toString();
DatafavoriteEntity favorite = datafavoriteService.selectdata(user.getUser_id(),id);
// System.err.println(favorite1);
String result = "";
if(favorite==null) {
result = datafavoriteService.adddata(user.getUser_id(),id,projectid,groupid,title,source_name,emotionalIndex,publish_time);
}else{
result = datafavoriteService.updatedata(user.getUser_id(),id,projectid,groupid,title,source_name,emotionalIndex,publish_time);
}
return result;

}
/**
* 已读、未读标记
* @param request
* @param mv
* @param session
* @param id
* @param flag
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "已读、未读标记", type = "已读、未读标记", operation = "")
@PostMapping(value = "/isread")
@ResponseBody
public String isread(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id,
@RequestParam(value = "flag", required = false, defaultValue = "") int flag) {
String result = "";
User user = (User) session.getAttribute("User");
Map<String, Object> readsign = new HashMap<>();
readsign.put("create_time", DateUtil.nowTime());
readsign.put("user_id", user.getUser_id());
readsign.put("article_id", id);
// 入库
if(flag==1) {
try {
boolean bool = earlyWarningService.readSign(readsign);
if (bool) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 200);
map.put("result", "success");
result = JSON.toJSONString(map);
} else {
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 500);
map.put("result", "fail");
result = JSON.toJSONString(map);
}
} catch (Exception e) {
// e.printStackTrace();
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 500);
map.put("result", "fail");
result = JSON.toJSONString(map);
}
}else if(flag==2) {
try {
earlyWarningService.delReadSign(readsign);
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 300);
map.put("result", "success");
result = JSON.toJSONString(map);
} catch (Exception e) {
// e.printStackTrace();
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 400);
map.put("result", "fail");
result = JSON.toJSONString(map);
}
}
return result;

}
/**
* 删除信息来源
* @param request
* @param mv
* @param session
* @param id
* @param flag
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "删除信息来源", type = "删除", operation = "deletedata")
@PostMapping(value = "/deletedata")
@ResponseBody
public String deletedata(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id,
@RequestParam(value = "flag", required = false, defaultValue = "")int flag,
@RequestParam(value = "publish_time", required = false, defaultValue = "")String publish_time ) {
datafavoriteService.deletedata(id,flag,es_search_url,publish_time);
User user = (User) session.getAttribute("User");
Map<String,Object> map =new HashMap<String,Object>();
map.put("status", 200);
map.put("result", "success");
return JSON.toJSONString(map);

}
/**
* 一键复制
* @param request
* @param mv
* @param id
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "一键复制", type = "复制", operation = "")
@PostMapping(value = "/copytext")
@ResponseBody
public String copytext(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id) {
String result = "";
String url = es_search_url + MonitorConstant.es_api_article_newdetail;
String params = "article_public_id=" + id + "&esindex=postal&estype=infor";
try {
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
String title = parseObject.get("title").toString();
String content = parseObject.get("content").toString();
String result1 = "标题:"+title+" 内容:"+content;
// result = "标题:"+title+" 内容:"+content;
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 200);
map.put("result", result1);
result = JSON.toJSONString(map);
} catch (Exception e) {
// TODO: handle exception
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 500);
map.put("result", "");
result = JSON.toJSONString(map);
}
return result;

}
/**
* 发送、移动
* @param request
* @param mv
* @param session
* @param id
* @param projectid
* @param groupid
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "发送移动", type = "发送", operation = "sending")
@PostMapping(value = "/sending")
@ResponseBody
public String sending(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id,
@RequestParam(value = "projectid", required = false, defaultValue = "") Long projectid,
@RequestParam(value = "groupid", required = false, defaultValue = "") Long groupid) {
String result = "";
User user = (User) session.getAttribute("User");
String url = es_search_url + MonitorConstant.es_api_article_newdetail;
String params = "article_public_id=" + id + "&esindex=postal&estype=infor";
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
String title = parseObject.get("title").toString();
String source_name = parseObject.get("sourcewebsitename").toString();
String emotionalIndex = parseObject.get("emotionalIndex").toString();
String publish_time = parseObject.get("publish_time").toString();
String content = parseObject.get("content").toString();
if (content.length() > 255) {
content = content.substring(0, 254);
}
Map<String, Object> warning_popup = new HashMap<>();
warning_popup.put("create_time", DateUtil.nowTime());
warning_popup.put("warning_article_id", snowFlake.getId());
warning_popup.put("user_id", user.getUser_id());
warning_popup.put("popup_id", snowFlake.getId());
warning_popup.put("popup_content", content);
warning_popup.put("popup_time", DateUtil.nowTime());
warning_popup.put("article_id", id);
warning_popup.put("article_time", publish_time);
warning_popup.put("article_title", title);
warning_popup.put("article_emotion", emotionalIndex);
warning_popup.put("project_id", projectid);
warning_popup.put("status", 0);
warning_popup.put("type", 0);
warning_popup.put("read_status", 0);
Map<String, Object> article_detail = new HashMap<>();
article_detail.put("sourcewebsitename", source_name);
warning_popup.put("article_detail", JSON.toJSONString(article_detail));
// 入库
try {
boolean warning_popupresult = earlyWarningService.saveWarningPopup(warning_popup);
if (warning_popupresult) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 200);
map.put("result", "1");
result = JSON.toJSONString(map);
} else {
Map<String, Object> map = new HashMap<String, Object>();
map.put("status", 500);
map.put("result", "1");
result = JSON.toJSONString(map);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;

}
/**
* 读取:已读未读标记
* @param request
* @param mv
* @param session
* @param id
* @param flag
* @return
*/
@SystemControllerLog(module = "数据监测", submodule = "读取标记", type = "读取标记", operation = "selectreadsign")
@PostMapping(value = "/selectreadsign")
@ResponseBody
public String selectreadsign(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "") String id) {
String result = "";
User user = (User) session.getAttribute("User");
Map<String, Object> selectreadsign = new HashMap<>();
selectreadsign.put("article_id", id);
selectreadsign.put("user_id", user.getUser_id());
Map<String, Object> resMap = earlyWarningService.selectReadSign(selectreadsign);
System.err.println(id);
if(resMap!=null) {
Map<String,Object> map =new HashMap<String,Object>();
map.put("status", 200);
map.put("result", "success");
result = JSON.toJSONString(map);
}else {
Map<String,Object> map =new HashMap<String,Object>();
map.put("status", 500);
map.put("result", "err");
result = JSON.toJSONString(map);
}
System.err.println(result);
return result;

}
// /**
// * @param [mv]
// * @return org.springframework.web.servlet.ModelAndView
// * @description: 添加关键词预警设置 <br>
// * @version: 1.0 <br>
// * @date: 2020/4/13 15:44 <br>
// * @author: wangziqiu <br>
// */
// @SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-添加关键词预警", type = "新增", operation = "toaddwordwarning")
// @GetMapping(value = "/createtrack")
// public ModelAndView toaddwordwarning(HttpServletRequest request, ModelAndView mv, String id, String keyword) {
//// String id = request.getParameter("id");
// String page = request.getParameter("page");
//
// WordWarningSetting warning = new WordWarningSetting();
// warning.setWarning_classify("1,2,3,4,5,6,7,8,9,10,11,");
// warning.setWarning_content(0);
// warning.setWarning_similar(0);
// warning.setWarning_match(2);
// warning.setWarning_deduplication(0);
// warning.setWarning_source("{\"type\":\"1\",\"email\":\"\"}");
// warning.setWarning_receive_time("{\"start\":\"00:00\",\"end\":\"23:00\"}");
// warning.setWeekend_warning(1);
// warning.setWarning_interval("{\"type\":\"1\",\"time\":\"1\"}");
// System.out.println(warning);
// mv.addObject("warning", warning);
// mv.addObject("warningStr", JSON.toJSONString(warning));
// mv.addObject("page", page);
// mv.addObject("article_id", id);
// mv.addObject("keyword", keyword);
// mv.addObject("settingLeft", "wordswarning");
// mv.setViewName("setting/to_add_wordwarningcopy");
// return mv;
// }
}

+ 135
- 0
src/main/java/com/stonedt/intelligence/controller/DisplayBoardContoller.java View File

@@ -0,0 +1,135 @@
package com.stonedt.intelligence.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.aop.SystemControllerLog;
import com.stonedt.intelligence.entity.DatafavoriteEntity;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.DisplayBoardService;
import com.stonedt.intelligence.service.UserService;
import com.stonedt.intelligence.util.TextUtil;


@Controller
@RequestMapping("/displayboard")
public class DisplayBoardContoller {
@Autowired
DisplayBoardService displayBoardService;
@Autowired
UserService userService;
@SystemControllerLog(module = "综合看板", submodule = "综合看板", type = "查询", operation = "displayboardlist")
@GetMapping(value = "")
public ModelAndView displayboardlist(HttpSession session,HttpServletRequest request,ModelAndView mv) {
User user = (User)session.getAttribute("User");
User u = userService.selectUserByTelephone(user.getTelephone());
session.setAttribute("User", u);
List<Map<String, Object>> list = displayBoardService.searchDisplayBiardByUser(u);
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
if (StringUtils.isBlank(groupId))
groupId = "";
if (StringUtils.isBlank(projectId))
projectId = "";
if(list.size() > 0){
Map<String, Object> map = list.get(0);
Set<String> keySet = map.keySet();
for (String string : keySet) {
// if(string)
String string2 = TextUtil.processQuotationMarks(map.get(string).toString());
mv.addObject(string,JSONObject.parse(string2));
}
}
JSONObject parseObject2 = JSONObject.parseObject(JSON.toJSONString(u) );
mv.addObject("user",parseObject2);
mv.addObject("groupId", groupId);
mv.addObject("projectId", projectId);
mv.addObject("groupid", groupId);
mv.addObject("menu", "displayboard");
mv.addObject("projectid", projectId);
mv.setViewName("displayboard/displayboard");
return mv;
}
/**
* @return java.lang.String
* @description: 获取左侧的方案组数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:47 <br>
* @author: huajiancheng <br>
* @params []
*/
/*@SystemControllerLog(module = "综合看板", submodule = "获取左侧的方案组数据", type = "查询", operation = "getprojectType")*/
@PostMapping(value = "/collection")
@ResponseBody
public String getprojectType(@RequestParam(value="user_id") Long user_id,HttpServletRequest request) {
JSONObject response = new JSONObject();
List<DatafavoriteEntity> result = displayBoardService.getCollectionByuser(user_id);
// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
// try {
// list = projectUtil.getprojectType();
// response.put("code", 200);
// response.put("msg", "方案组数据返回成功");
// response.put("data", list);
// } catch (Exception e) {
// e.printStackTrace();
// response.put("code", 500);
// response.put("msg", "方案组数据返回失败");
// response.put("data", list);
// }
response.put("user_id", user_id);
response.put("data", result);
return JSON.toJSONString(response);
}
/**
* @return java.lang.String
* @description: 获取左侧的方案组数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:47 <br>
* @author: huajiancheng <br>
* @params []
*/
/*@SystemControllerLog(module = "综合看板", submodule = "获取左侧的方案组数据", type = "查询", operation = "collection2")*/
@PostMapping(value = "/collection2")
@ResponseBody
public String getprojectType2(@RequestParam(value="user_id") Long user_id,HttpServletRequest request) {
JSONObject response = new JSONObject();
List<DatafavoriteEntity> result = displayBoardService.getCollectionByuser(user_id);
// List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
// try {
// list = projectUtil.getprojectType();
// response.put("code", 200);
// response.put("msg", "方案组数据返回成功");
// response.put("data", list);
// } catch (Exception e) {
// e.printStackTrace();
// response.put("code", 500);
// response.put("msg", "方案组数据返回失败");
// response.put("data", list);
// }
response.put("user_id", user_id);
response.put("data", result);
return JSON.toJSONString(response);
}

}

+ 872
- 0
src/main/java/com/stonedt/intelligence/controller/FullSearchController.java View File

@@ -0,0 +1,872 @@
package com.stonedt.intelligence.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.aop.SystemControllerLog;
import com.stonedt.intelligence.entity.FullPolymerization;
import com.stonedt.intelligence.entity.FullType;
import com.stonedt.intelligence.entity.FullWord;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.FullSearchService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.UserUtil;
import com.stonedt.intelligence.vo.FullSearchParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
/**
* 全文搜索控制器
*/
@Controller
@RequestMapping(value = "/fullsearch")
public class FullSearchController {
@Autowired
private FullSearchService fullSearchService;
@Autowired
UserUtil userUtil;
/**
* 全文搜索页面
*/
@SystemControllerLog(module = "全文搜索", submodule = "全文搜索", type = "全文搜索页面", operation = "search")
@GetMapping(value = "")
public String search(Integer full_poly, @RequestParam(defaultValue = "1") Integer full_type, Model model) {
model.addAttribute("fulltype", full_type);
model.addAttribute("full_poly", full_poly);
model.addAttribute("menu", "full_search");
return "search/full_search";
}
/**
* 全文搜索结果页面
*/
@GetMapping(value = "/result")
@SystemControllerLog(module = "全文搜索", submodule = "搜索结果", type = "查询", operation = "result")
public String result(@RequestParam(value = "menuStyle", required = false, defaultValue = "1") Integer menuStyle,
@RequestParam(value = "pageSize", required = false, defaultValue = "50") Integer pageSize,
Integer full_poly, String fulltype, String searchword,
String sourcename, Integer page, Model model,
HttpServletRequest request) {
model.addAttribute("searchWord", searchword);
model.addAttribute("page", page);
model.addAttribute("source_name", sourcename);
model.addAttribute("fulltype", fulltype);
model.addAttribute("full_poly", full_poly);
model.addAttribute("menuStyle", menuStyle);
model.addAttribute("pageSize", pageSize);
model.addAttribute("menu", "full_search");
//将搜索的词存到数据库
User user = userUtil.getuser(request);
String user_id = String.valueOf(user.getUser_id());
String create_time = DateUtil.getNowTime();
if (!searchword.equals("")) {
FullWord fullWord = new FullWord();
fullWord.setUser_id(Long.valueOf(user_id));
fullWord.setCreate_time(create_time);
fullWord.setSearch_word(searchword);
boolean result = fullSearchService.saveFullWord(fullWord);
}
return "search/search_result";
}
/**
* 律师详情页
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "律师详情", type = "查询", operation = "lawyerDetail")
@GetMapping(value = "/lawyerDetail/{articleid}")
public ModelAndView lawyerDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.setViewName("lawyer/lawyerDetail");
return mv;
}
/**
* 律师列表
* @param lawyerListParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "律师列表", type = "查询", operation = "lawyerList")
@GetMapping(value = "/lawyerList")
public @ResponseBody
JSONObject lawyerList(FullSearchParam lawyerListParam) {
JSONObject lawyerList=fullSearchService.lawyerList(lawyerListParam);
return lawyerList;
}
/**
* 律师详情数据
* @param article_public_id
* @return
*/
@PostMapping(value = "/lawyerDetailData")
public @ResponseBody
JSONObject lawyerDetailData(String article_public_id) {
JSONObject lawyerDetailData=fullSearchService.lawyerDetailData(article_public_id);
return lawyerDetailData;
}
/**
* 被执行人
*/
@SystemControllerLog(module = "全文搜索", submodule = "被执行人列表", type = "查询", operation = "executionPersonList")
@GetMapping(value = "/executionPersonList")
public @ResponseBody
JSONObject executionPersonList(FullSearchParam executionPersonListParam) {
JSONObject executionPersonList=fullSearchService.executionPersonList(executionPersonListParam);
return executionPersonList;
}
/**
* 被执行人详情视图
*/
@SystemControllerLog(module = "全文搜索", submodule = "被执行人详情", type = "查询", operation = "executionPersonDetail")
@GetMapping(value = "/executionPersonDetail/{articleid}")
public ModelAndView executionPersonDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.setViewName("executionPerson/executionPersonDetail");
return mv;
}
/**
* 被执行人详情数据
*/
@PostMapping(value = "/executionPersonDetailData")
public @ResponseBody
JSONObject executionPersonDetailData(String article_public_id) {
JSONObject executionPersonDetailData=fullSearchService.executionPersonDetailData(article_public_id);
return executionPersonDetailData;
}
/**
* 专家人才列表
*/
@SystemControllerLog(module = "全文搜索", submodule = "专家人才列表", type = "查询", operation = "professorList")
@GetMapping(value = "/professorList")
public @ResponseBody
JSONObject professorList(FullSearchParam professorListParam) {
JSONObject professorList=fullSearchService.professorList(professorListParam);
return professorList;
}
/**
* 专家人才详情视图
*/
@SystemControllerLog(module = "全文搜索", submodule = "专家人才详情", type = "查询", operation = "professorDetail")
@GetMapping(value = "/professorDetail/{articleid}")
public ModelAndView professorDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.setViewName("professor/professorDetail");
return mv;
}
/**
* 专家人才详情数据
*/
@PostMapping(value = "/professorDetailData")
public @ResponseBody
JSONObject professorDetailData(String article_public_id) {
JSONObject professorDetailData=fullSearchService.professorDetailData(article_public_id);
return professorDetailData;
}
/**
* 医生列表
*/
@SystemControllerLog(module = "全文搜索", submodule = "医生列表", type = "查询", operation = "doctorList")
@GetMapping(value = "/doctorList")
public @ResponseBody
JSONObject doctorList(FullSearchParam doctorListParam) {
JSONObject doctorList=fullSearchService.doctorList(doctorListParam);
return doctorList;
}
/**
* 医生详情视图
*/
@SystemControllerLog(module = "全文搜索", submodule = "医生详情", type = "查询", operation = "doctorDetail")
@GetMapping(value = "/doctorDetail/{articleid}")
public ModelAndView doctorDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.setViewName("doctor/doctorDetail");
return mv;
}
/**
* 医生详情数据
*/
@PostMapping(value = "/doctorDetailData")
public @ResponseBody
JSONObject doctorDetailData(String article_public_id) {
JSONObject doctorDetailData=fullSearchService.doctorDetailData(article_public_id);
return doctorDetailData;
}
/**
* 资讯数据列表
*/
@SystemControllerLog(module = "全文搜索", submodule = "资讯列表", type = "查询", operation = "informationList")
@GetMapping(value = "/informationList")
public @ResponseBody
JSONObject informationList(FullSearchParam informationListParam) {
JSONObject informationList = fullSearchService.informationList(informationListParam);
return informationList;
}
/**
* 资讯数据列表
*/
@SystemControllerLog(module = "全文搜索", submodule = "资讯列表", type = "查询", operation = "informationList1")
@PostMapping(value = "/informationListpost")
public @ResponseBody
JSONObject informationList1(@RequestBody FullSearchParam informationListParam) {
informationListParam.setMatchType(1);
informationListParam.setSortType(1);
informationListParam.setMergeType(0);
JSONObject informationList = fullSearchService.informationListSearch(informationListParam);
return informationList;
}
/**
* 热点数据列表
*
* @throws UnsupportedEncodingException
*/
@SystemControllerLog(module = "全文搜索", submodule = "热点数据列表", type = "查询", operation = "hotList")
@GetMapping(value = "/hotList")
public @ResponseBody
JSONObject hotList(FullSearchParam searchParam) throws UnsupportedEncodingException {
return fullSearchService.hotList(searchParam);
}
/**
* 投诉列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "投诉列表", type = "查询", operation = "complaintList")
@GetMapping(value = "/complaintList")
public @ResponseBody
JSONObject complaintList(FullSearchParam searchParam) {
return fullSearchService.complaintList(searchParam);
}
/**
* 公告列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "公告列表", type = "查询", operation = "announcementList")
@GetMapping(value = "/announcementList")
public @ResponseBody
JSONObject announcementList(FullSearchParam searchParam) {
return fullSearchService.announcementList(searchParam);
}
/**
* 公告rtype
*
* @param searchParam
* @return
*/
@GetMapping(value = "/announcementrtype")
public @ResponseBody
JSONArray announcementRtype(FullSearchParam searchParam) {
return fullSearchService.announcementRtype(searchParam);
}
/**
* 研报列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "研报列表", type = "查询", operation = "reportList")
@GetMapping(value = "/reportList")
public @ResponseBody
JSONObject reportList(FullSearchParam searchParam) {
return fullSearchService.reportList(searchParam);
}
/**
* 研报分类
*
* @param searchParam
* @return
*/
@GetMapping(value = "/reportIndustry")
public @ResponseBody
JSONArray reportIndustry(FullSearchParam searchParam) {
return fullSearchService.reportIndustry(searchParam);
}
/**
* 招标列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "招标列表", type = "查询", operation = "biddingList")
@GetMapping(value = "/biddingList")
public @ResponseBody
JSONObject bidding(FullSearchParam searchParam) {
return fullSearchService.biddingList(searchParam);
}
/**
* 招标详情
*
* @param articleid
* @param fulltype
* @param mv
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "招标详情", type = "查询", operation = "biddingdetail")
@GetMapping(value = "biddingdetail/{articleid}")
public ModelAndView biddingDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject bidding = fullSearchService.biddingDetail(articleid);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("bidding", bidding);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_bidding_detail");
return mv;
}
/**
* 招聘列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "招聘列表", type = "查询", operation = "inviteList")
@GetMapping(value = "/inviteList")
public @ResponseBody
JSONObject inviteList(FullSearchParam searchParam) {
JSONObject inviteList = fullSearchService.inviteList(searchParam);
return inviteList;
}
/**
* 招聘详情
*
* @param record_id
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "招聘详情", type = "查询", operation = "inviteDetails")
@GetMapping(value = "inviteDetails/{record_id}")
public ModelAndView inviteDetails(@PathVariable() String record_id, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject invite = fullSearchService.getInviteDetail(record_id);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("invite", invite);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_invite_detail");
return mv;
}
/**
* 跳转公告详情页面
*
* @param articleid
* @param mv
* @param request
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "招聘详情", type = "查询", operation = "reportdetail")
@GetMapping(value = "reportdetail/{articleid}/{type}")
public ModelAndView reportDetail(@PathVariable() String articleid, @PathVariable() String type, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord,
HttpServletRequest request) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("type", type);
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_report_detail");
return mv;
}
/**
* 公告、研报详情
*
* @param request
* @param type
* @param article_public_id
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "公告、研报详情", type = "查询", operation = "reportdetail")
@GetMapping(value = "getresearch-report-detail")
public @ResponseBody
String getReportDetail(HttpServletRequest request, String type, String article_public_id) {
return fullSearchService.getReportDetail(type, article_public_id);
}
/**
* 工商列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "工商列表", type = "查询", operation = "companyList")
@GetMapping(value = "companyList")
public @ResponseBody
JSONObject companyList(FullSearchParam searchParam) {
return fullSearchService.companyList(searchParam);
}
/**
* 工商行业分类
*
* @param searchParam
* @return
*/
/* @SystemControllerLog(module = "全文搜索", submodule = "工商行业分类", type = "查询", operation = "companyIndustry")*/
@GetMapping(value = "companyIndustry")
public @ResponseBody
JSONArray companyIndustry(FullSearchParam searchParam) {
return fullSearchService.companyIndustry(searchParam);
}
/**
* 工商详情页面
*
* @param articleid
* @param type
* @param fulltype
* @param mv
* @param request
* @return
*/
@GetMapping(value = "companyDetail/{articleid}")
public ModelAndView companyDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord,
HttpServletRequest request) {
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_company_detail");
return mv;
}
/**
* 工商详情
*
* @param article_public_id
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "工商详情", type = "查询", operation = "companyDetails")
@GetMapping(value = "companyDetails")
public @ResponseBody
JSONObject companyDetails(String article_public_id) {
return fullSearchService.companyDetails(article_public_id);
}
/**
* 法律文书
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "法律文书", type = "查询", operation = "judgmentList")
@GetMapping(value = "judgmentList")
public @ResponseBody
JSONObject judgmentList(FullSearchParam searchParam) {
return fullSearchService.judgmentList(searchParam);
}
/**
* 案件类型
*
* @param searchParam
* @return
*/
@GetMapping(value = "judgmentCaseType")
public @ResponseBody
JSONArray judgmentCaseType(FullSearchParam searchParam) {
return fullSearchService.judgmentCaseType(searchParam);
}
/**
* 法律文书详情
*
* @param articleid
* @param fulltype
* @param mv
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "法律文书详情", type = "查询", operation = "judgmentDetail")
@GetMapping(value = "judgmentDetail/{articleid}")
public ModelAndView judgmentDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject judgment = fullSearchService.judgmentDetail(articleid);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("judgment", judgment);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_judgment_detail");
return mv;
}
/**
* 知识产权列表
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "知识产权列表", type = "查询", operation = "knowLedgeList")
@GetMapping(value = "knowLedgeList")
public @ResponseBody
JSONObject knowLedgeList(FullSearchParam searchParam) {
JSONObject knowLedgeList = fullSearchService.knowLedgeList(searchParam);
return knowLedgeList;
}
/**
* 知识产权 专利类型
*
* @param searchParam
* @return
*/
@GetMapping(value = "knowLedgeCaseType")
public @ResponseBody
JSONArray knowLedgeCaseType(FullSearchParam searchParam) {
return fullSearchService.knowLedgeCaseType(searchParam);
}
@SystemControllerLog(module = "全文搜索", submodule = "知识产权详情", type = "查询", operation = "knowLedgeDetail")
@GetMapping(value = "knowLedgeDetail/{articleid}")
public ModelAndView knowLedgeDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject knowLedge = fullSearchService.knowLedgeDetail(articleid);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("knowLedge", knowLedge);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_knowledge_detail");
return mv;
}
/**
* 投资融资
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "投资融资", type = "查询", operation = "investmentList")
@GetMapping(value = "investmentList")
public @ResponseBody
JSONObject investmentList(FullSearchParam searchParam) {
return fullSearchService.investmentList(searchParam);
}
/**
* 投资融资 类型
*
* @param searchParam
* @return
*/
@GetMapping(value = "investmentType")
public @ResponseBody
JSONArray investmentType(FullSearchParam searchParam) {
return fullSearchService.investmentType(searchParam);
}
/**
* 投资融资 详情
*
* @param articleid
* @param fulltype
* @param mv
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "投资融资详情", type = "查询", operation = "investmentList")
@GetMapping(value = "investmentDetail/{articleid}")
public ModelAndView investmentDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject investment = fullSearchService.investmentDetail(articleid);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("investment", investment);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_investment_detail");
return mv;
}
/**
* 问答数据--百度知道
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "百度知道", type = "查询", operation = "baiduKnowsList")
@GetMapping(value = "baiduKnowsList")
public @ResponseBody
JSONObject baiduKnowsList(FullSearchParam searchParam) {
JSONObject baiduKnowsList = fullSearchService.baiduKnowsList(searchParam);
return baiduKnowsList;
}
/**
* 学术数据--百度学术
*
* @param searchParam
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "百度学术", type = "查询", operation = "thesisnList")
@GetMapping(value = "thesisnList")
public @ResponseBody
JSONObject thesisnList(FullSearchParam searchParam) {
JSONObject thesisnList = fullSearchService.thesisnList(searchParam);
return thesisnList;
}
/**
* 学术数据--百度学术 详情
*
* @param articleid
* @param fulltype
* @param mv
* @return
*/
@SystemControllerLog(module = "全文搜索", submodule = "百度学术详情", type = "查询", operation = "thesisnDetail")
@GetMapping(value = "thesisnDetail/{articleid}")
public ModelAndView thesisnDetail(@PathVariable() String articleid, String fulltype,
ModelAndView mv, String menuStyle, String fullpoly, String searchWord) {
JSONObject thesisn = fullSearchService.thesisnDetail(articleid);
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("thesisn", thesisn);
mv.addObject("articleid", articleid);
mv.addObject("menu", "full_search");
mv.addObject("fulltype", fulltype);
mv.setViewName("search/search_thesisn_detail");
return mv;
}
/**
* @param [articleid, groupid, projectid, menu, mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转 资讯文章详情页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:32 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "全文搜索", submodule = "资讯文章详情", type = "查询", operation = "thesisnDetail")
@GetMapping(value = "/detail/{articleid}")
public ModelAndView skiparticle(@PathVariable() String articleid,
String groupid, String projectid, String relatedWord,
String menu, String page, ModelAndView mv,
String menuStyle, String fulltype,
String fullpoly, String searchWord,String publish_time,
HttpServletRequest request) {
if (StringUtils.isBlank(groupid)) groupid = "";
if (StringUtils.isBlank(projectid)) projectid = "";
if (StringUtils.isBlank(articleid)) articleid = "";
if (StringUtils.isBlank(relatedWord)) relatedWord = "";
if (StringUtils.isBlank(publish_time)) publish_time = "";
if (StringUtils.isBlank(menu)) menu = "full_search";
mv.addObject("menuStyle", menuStyle);
mv.addObject("full_poly", fullpoly);
mv.addObject("fulltype", fulltype);
mv.addObject("searchWord", searchWord);
mv.addObject("publish_time", publish_time);
mv.addObject("articleid", articleid);
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectid);
mv.addObject("relatedword", relatedWord);
mv.addObject("menu", "full_search");
mv.setViewName("search/search_detail");
return mv;
}
/**
* 获取一级菜单
*
* @return
*/
@GetMapping("listFullTypeByFirst")
public @ResponseBody
List<FullType> listFullTypeByFirst() {
List<FullType> listFullTypeByFirst = fullSearchService.listFullTypeByFirst();
return listFullTypeByFirst;
}
/**
* 获取二级菜单
*
* @param type_one_id
* @return
*/
@GetMapping("listFullTypeBySecond")
public @ResponseBody
List<FullType> listFullTypeBysecond(Integer type_one_id) {
List<FullType> listFullTypeBysecond = fullSearchService.listFullTypeBysecond(type_one_id);
return listFullTypeBysecond;
}
/**
* 获取三级菜单
*
* @param type_one_id
* @return
*/
@GetMapping("listFullTypeByThird")
public @ResponseBody
List<FullType> listFullTypeBythird(Integer type_two_id) {
List<FullType> listFullTypeBythird = fullSearchService.listFullTypeBythird(type_two_id);
return listFullTypeBythird;
}
/**
* 获取聚合分类
*
* @return
*/
@GetMapping("listFullPolymerization")
public @ResponseBody
List<FullPolymerization> listFullPolymerization() {
return fullSearchService.listFullPolymerization();
}
/**
* @return
*/
@GetMapping("getBreadCrumbs")
public @ResponseBody
JSONObject getBreadCrumbs(Integer menuStyle, Integer fulltype, Integer onlyid, Integer polyid) {
return fullSearchService.getBreadCrumbs(menuStyle, fulltype, onlyid, polyid);
}
/**
* 获取全文搜索一级分类列表 通过id list
*
* @param id
* @return
*/
@GetMapping("listFullTypeOneByIdList")
public @ResponseBody
List<FullType> listFullTypeOneByIdList(String id) {
String[] split = id.split(",");
List<Integer> list = new ArrayList<Integer>();
for (String string : split) {
list.add(Integer.parseInt(string));
}
return fullSearchService.listFullTypeOneByIdList(list);
}
/**
* @param [request]
* @return com.alibaba.fastjson.JSONObject
* @description: 获取用户输入的关键词 <br>
* @version: 1.0 <br>
* @date: 2020/7/13 14:05 <br>
* @author: huajiancheng <br>
*/
@PostMapping(value = "/search")
@ResponseBody
public JSONObject getSearchWordById(HttpServletRequest request) {
JSONObject response = new JSONObject();
JSONObject paramJson = new JSONObject();
User user = userUtil.getuser(request);
String user_id = String.valueOf(user.getUser_id());
paramJson.put("user_id", user_id);
response = fullSearchService.getSearchWordById(paramJson);
return response;
}
}

+ 64
- 0
src/main/java/com/stonedt/intelligence/controller/HotNewsController.java View File

@@ -0,0 +1,64 @@
package com.stonedt.intelligence.controller;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.service.WechatService;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.RedisUtil;
import org.springframework.stereotype.Controller;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Controller
@RequestMapping(value = "/hot")
public class HotNewsController {
@Autowired
private WechatService wechatService;
@Resource
private RedisUtil redisUtil;
@RequestMapping("/hotpage")
public ModelAndView weChat(HttpServletRequest request,
ModelAndView mv,Integer page,Integer one_type,String two_type) throws IOException {
mv.addObject("page", page);
mv.addObject("one_type", one_type);
mv.addObject("two_type", two_type);
mv.setViewName("hot/hotpage");
return mv;
}
@RequestMapping("/hotlist")
public String weChat(HttpServletRequest request,@RequestParam(value = "page", required = false, defaultValue = "1") String page) throws IOException {
String sendPostEsSearch = "";
if(redisUtil.existsKey(page)) {
sendPostEsSearch = redisUtil.getKey(page);
BASE64Decoder decoder = new BASE64Decoder();
byte[] bytes = decoder.decodeBuffer(sendPostEsSearch);
sendPostEsSearch = new String(bytes);
}else {
String url = "http://192.168.71.63:6304/hotnews/hotnewslist";
sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, "?searchparam=rank&searchType=1&source_name=微博&page="+page);
BASE64Encoder encoder = new BASE64Encoder();
String data = encoder.encode(sendPostEsSearch.getBytes());
redisUtil.set(page, data);
}
return sendPostEsSearch;
}
}

+ 55
- 0
src/main/java/com/stonedt/intelligence/controller/LSearchController.java View File

@@ -0,0 +1,55 @@
package com.stonedt.intelligence.controller;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.service.LSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author lh
* @date 2021-05-31 18:21
*/
@RestController
public class LSearchController {
@Autowired
private LSearchService lSearchService;
@PostMapping("/industry")
@ResponseBody
public JSONObject getIndustry(@RequestBody JSONObject paramJson) {
JSONObject articleIndustryList = lSearchService.getArticleIndustryList(paramJson);
return articleIndustryList;
}
@PostMapping("/getevent")
@ResponseBody
public JSONObject getEvent(@RequestBody JSONObject paramJson) {
JSONObject articleEventList = lSearchService.getArticleEventList(paramJson);
return articleEventList;
}
@PostMapping("/getProvinceList")
@ResponseBody
public JSONObject getArticleProvinceList(@RequestBody JSONObject paramJson) {
JSONObject articleProvinceList = lSearchService.getArticleProvinceList(paramJson);
return articleProvinceList;
}
@PostMapping("/getArticleCityList")
@ResponseBody
public JSONObject getArticleCityList(@RequestBody JSONObject paramJson) {
JSONObject articleCityList = lSearchService.getArticleCityList(paramJson);
return articleCityList;
}
}

+ 219
- 0
src/main/java/com/stonedt/intelligence/controller/LoginController.java View File

@@ -0,0 +1,219 @@
package com.stonedt.intelligence.controller;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.aop.SystemControllerLog;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.UserService;
import com.stonedt.intelligence.util.Base64;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
/**
* description: 登录控制器 <br>
* date: 2020/4/13 10:51 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/")
public class LoginController {
@Autowired
UserService userService;
/**
* description: 登录页面跳转<br>
* version: 1.0 <br>
* date: 2020/4/13 11:06 <br>
* author: objcat <br>
* <p>
* No such property: code for class: Script1
*
* @return ModelAndView
*/
// @SystemControllerLog(module = "用户登录",submodule="用户登录", type = "查询",operation = "login")
@GetMapping(value = "/login")
public ModelAndView login(ModelAndView mv) {
mv.setViewName("user/login");
return mv;
}
/**
* description: 退出 <br>
* version: 1.0 <br>
* date: 2020/4/13 11:08 <br>
* author: objcat <br>
*
* @return ModelAndView
*/
@SystemControllerLog(module = "用户登出", submodule = "用户登出", type = "登出", operation = "logout")
@GetMapping(value = "/logout")
public void logout(HttpServletResponse response, HttpServletRequest request) {
try {
try {
User user = (User)request.getSession().getAttribute("User");
try {
//如果Vector中有用户==》移除==》记录==>这样如果切换到别的浏览器同一账号登录且之前账号没有退出就不准确了
//如果Vector中没用户==》不记录
userService.updateEndLoginTime(user.getUser_id());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
request.getSession().removeAttribute("User");
response.sendRedirect(request.getContextPath() + "user/login");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* description: 登录处理<br>
* version: 1.0 <br>
* date: 2020/4/13 11:09 <br>
* author: objcat <br>
*
* @param telephone(登录手机号)、password(密码)
* @return ModelAndView
*/
@SystemControllerLog(module = "用户登录", submodule = "用户登录", type = "登录", operation = "login")
@PostMapping(value = "/login")
@ResponseBody
public JSONObject login(@RequestParam(value = "telephone") String telephone,
@RequestParam(value = "password") String password,
HttpSession session) {
JSONObject response = new JSONObject();
User user = userService.selectUserByTelephone(telephone);
if (null != user) {
if (user.getStatus() == 0) {
response.put("code", 3);
response.put("msg", "用户禁止登录");
} else {
if (MD5Util.getMD5(password).equals(user.getPassword())) {
Integer status = user.getStatus();
if (status == 2) {
response.put("code", 4);
response.put("msg", "账户已被注销");
} else {
session.setAttribute("User", user);
response.put("code", 1);
response.put("msg", "用户登录成功");
Integer login_count = user.getLogin_count() + 1;
String end_login_time = DateUtil.getNowTime();
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("telephone", telephone);
paramMap.put("end_login_time", end_login_time);
paramMap.put("login_count", login_count);
userService.updateUserLoginCountByPhone(paramMap);
}
} else {
response.put("code", 2);
response.put("msg", "登录密码错误");
}
}
} else {
response.put("code", -1);
response.put("msg", "用户不存在");
}
return response;
}
/**
* description: 跳转忘记密码页面 <br>
* version: 1.0 <br>
* date: 2020/4/13 11:08 <br>
* author: objcat <br>
*
* @return ModelAndView
*/
@SystemControllerLog(module = "用户登录", submodule = "用户登录-忘记密码", type = "忘记密码", operation = "forgotpwd")
@GetMapping(value = "/forgotpwd")
public ModelAndView forgotpwd(ModelAndView mv) {
mv.setViewName("user/forgotPassword");
return mv;
}
@SystemControllerLog(module = "用户登录", submodule = "用户登录", type = "查询", operation = "jumpLogin")
@GetMapping(value = "/jumpLogin")
public String login(String b64, HttpSession session) {
System.err.println("=====b64-encode:" + b64 + "====================================================");
b64 = Base64.decode(b64);
System.err.println("=====b64-decode:" + b64 + "====================================================");
b64 = b64.substring(4, 15);
System.err.println("=====phone:" + b64 + "========================================================");
User user = userService.selectUserByTelephone(b64);
if (null != user) {
if (user.getStatus() == 0) {
return "user/login";
} else {
Integer status = user.getStatus();
if (status == 2) {
return "user/login";
} else {
session.setAttribute("User", user);
Integer login_count = user.getLogin_count() + 1;
String end_login_time = DateUtil.getNowTime();
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("telephone", b64);
paramMap.put("end_login_time", end_login_time);
paramMap.put("login_count", login_count);
userService.updateUserLoginCountByPhone(paramMap);
}
}
} else {
return "user/login";
}
return "redirect:/monitor";
}
public static void main(String[] args) {
System.err.println(Base64.encode("$$$#13813866138===1553241639885#$$$"));
}
/**
* description: 登录处理<br>
* version: 1.0 <br>
* date: 2020/4/13 11:09 <br>
* author: objcat <br>
*
* @param
* @return ModelAndView
*/
// @SystemControllerLog(module = "统计用户在线数量", submodule = "用户在线数量统计", type = "查询", operation = "onlinestatistical")
@PostMapping(value = "/onlinestatistical")
@ResponseBody
public JSONObject onlinestatistical( HttpSession session) {
JSONObject response = new JSONObject();
try {
User user = (User)session.getAttribute("User");
Map<String, Object>result = userService.onlinestatistical(user);
response.put("onlinedata", result);
response.put("code",1);
return response;
} catch (Exception e) {
// TODO: handle exception
response.put("code",-1 );
response.put("msg","查询失败");
return response;
}
}
}

+ 430
- 0
src/main/java/com/stonedt/intelligence/controller/MonitorController.java View File

@@ -0,0 +1,430 @@
package com.stonedt.intelligence.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.dao.SolutionGroupDao;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.ArticleService;
import com.stonedt.intelligence.service.EarlyWarningService;
import com.stonedt.intelligence.service.MonitorService;
import com.stonedt.intelligence.service.OpinionConditionService;
import com.stonedt.intelligence.service.ProjectService;
import com.stonedt.intelligence.util.UserUtil;
import com.stonedt.intelligence.aop.SystemControllerLog;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* description: MonitorController <br>
* date: 2020/4/13 10:53 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/monitor")
public class MonitorController {
@Autowired
OpinionConditionService opinionConditionService;
@Autowired
private ArticleService articleService;
@Autowired
MonitorService monitorService;
@Autowired
ProjectService projectService;
@Autowired
private UserUtil userUtil;
@Autowired
private EarlyWarningService warningService;
@Autowired
private SolutionGroupDao solutionGroupDao;
@Value("${insertnewwords.url}")
private String insert_new_words_url;
/**
* @param groupid 方案组id
* @param projectid 方案id
* @param monitorsearch 搜索关键词
* @param start 开始时间
* @param end 结束时间
* @param emotion 情感
* @param sort 排序方式
* @param match 匹配方式
* @param precise 精准
* @param merge 合并
* @param page 分页参数
* @param menu 顶部菜单导航
* @param mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 页面跳转 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:17 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "")*/
@GetMapping(value = "")
public ModelAndView monitor(@RequestParam(value = "groupid", required = false) String groupid,
@RequestParam(value = "projectid", required = false) String projectid,
@RequestParam(value = "monitorsearch", required = false) String monitorsearch,
@RequestParam(value = "start", required = false) String start,
@RequestParam(value = "end", required = false) String end,
@RequestParam(value = "emotion", required = false) String emotion,
@RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "match", required = false) String match,
@RequestParam(value = "precise", required = false) String precise,
@RequestParam(value = "merge", required = false) String merge,
@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "menu", required = false) String menu,
@RequestParam(value = "searchflag", required = false, defaultValue = "false") boolean searchflag,
@RequestParam(value = "searchword", required = false) String searchword, ModelAndView mv,
HttpServletRequest request) {
boolean projectFlag = monitorService.boolUserProjectByUserId(request);
String search = request.getParameter("search");
mv.addObject("search", StringUtils.isBlank(search) ? "" : search);
mv.addObject("menu", "monitor");
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectid);
mv.addObject("searchflag", searchflag);
mv.addObject("searchword", searchword);
mv.addObject("page", page);
mv.addObject("projectFlag", projectFlag);
mv.setViewName("monitor/monitor");
return mv;
}
/**
* @param projectid 方案id
* @param monitorsearch 搜索关键词
* @param start 开始时间
* @param end 结束时间
* @param emotion 情感
* @param sort 排序
* @param match 匹配方式
* @param precise 精准
* @param merge 合并
* @param page 分页参数
* @return java.lang.String
* @description: 获取文章列表 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:22 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "listarticle")*/
@PostMapping(value = "/listarticle")
@ResponseBody
public String listArticle(@RequestParam("projectid") Integer projectid,
@RequestParam("monitorsearch") String monitorsearch, @RequestParam("start") String start,
@RequestParam("end") String end, @RequestParam("emotion") String emotion, @RequestParam("sort") String sort,
@RequestParam("match") String match, @RequestParam("precise") String precise,
@RequestParam("merge") String merge, @RequestParam("page") Integer page) {
return "";
}
/**
* @param [articleid, groupid, projectid, menu, mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转文章详情页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:32 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "数据监测", submodule = "数据监测-详情", type = "详情" /*type = "查询"*/, operation = "detail")
@GetMapping(value = "/detail/{articleid}")
public ModelAndView skiparticle(@PathVariable() String articleid, String groupid, String projectid,
String relatedWord,String publish_time, String menu, String page, ModelAndView mv, HttpServletRequest request) {
// String groupid = request.getParameter("groupid");
// String projectid = request.getParameter("projectid");
// String menu = request.getParameter("menu");
// String page = request.getParameter("page");
// String searchkeyword = request.getParameter("searchkeyword");
if (StringUtils.isBlank(groupid))
groupid = "";
if (StringUtils.isBlank(projectid))
projectid = "";
if (StringUtils.isBlank(articleid))
articleid = "";
if (StringUtils.isBlank(relatedWord))
relatedWord = "";
if (StringUtils.isBlank(publish_time))
publish_time = "";
if (StringUtils.isBlank(menu))
menu = "monitor";
mv.addObject("articleid", articleid);
// mv.addObject("searchkeyword", searchkeyword);
// mv.addObject("currentPageByDetail", page);
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectid);
mv.addObject("relatedword", relatedWord);
mv.addObject("publish_time", publish_time);
mv.addObject("menu", "monitor");
mv.setViewName("monitor/detail");
return mv;
}
/**
* @param [articleid]
* @return java.lang.String
* @description: 获取文章详情数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:35 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-详情", type = "查询", operation = "articleDetail")*/
@PostMapping(value = "/articleDetail")
@ResponseBody
public String articleDetail(String articleId, Long projectId, String articleIds, String relatedword,String publish_time,
HttpServletRequest resRequest) {
long startTime = System.currentTimeMillis();
long userId = userUtil.getUserId(resRequest);
try {
warningService.updateWarningArticle(articleId, userId);
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Object> articleDetail = articleService.articleDetail(articleId, projectId, relatedword,publish_time);
System.err.println("请求详情获取时间:" + (System.currentTimeMillis() - startTime) / 1000d + "s");
return JSONObject.toJSONString(articleDetail);
}
/**
* 文章详情 相关文章
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-详情", type = "查询", operation = "relatedArticles")*/
@PostMapping(value = "/relatedArticles")
@ResponseBody
public String relatedArticles(String keywords) {
List<Map<String, Object>> relatedArticles = articleService.relatedArticles(keywords);
return JSON.toJSONString(relatedArticles);
}
/**
* @param [paramJson]
* @return com.alibaba.fastjson.JSONObject
* @description: 第一次进入数据监测加载默认用户条件 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 18:03 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "getCondition")
@PostMapping(value = "/getCondition")
@ResponseBody
public JSONObject getCondition(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getCondition(paramJson);
return response;
}
/**
* @param [paramJson]
* @return com.alibaba.fastjson.JSONObject
* @description: 获取文章列表 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 19:34 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "getarticle")*/
@PostMapping(value = "/getarticle")
@ResponseBody
public JSONObject getArticleList(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getArticleList(paramJson);
return response;
}
/**
*
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "getarticle")*/
@PostMapping(value = "/getanalysisarticle")
@ResponseBody
public JSONObject getanalysisarticle(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getAnalysisArticleList(paramJson);
return response;
}
/**
*
* @param paramJson
* @return
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-行业标签", type = "查询", operation = "getindustry")*/
@PostMapping(value = "/getindustry")
@ResponseBody
public JSONObject getArticleIndustry(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getArticleIndustryList(paramJson);
return response;
}
/**
* wangyi
* @param paramJson
* @return
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-事件标签", type = "查询", operation = "getevent")*/
@PostMapping(value = "/getevent")
@ResponseBody
public JSONObject getArticleEvent(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getArticleEventList(paramJson);
return response;
}
/**
* wangyi
* @param paramJson
* @return
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-省份", type = "查询", operation = "getprovince")*/
@PostMapping(value = "/getprovince")
@ResponseBody
public JSONObject getArticleProvince(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getArticleProvinceList(paramJson);
return response;
}
/**
* wangyi
* @param paramJson
* @return
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-市", type = "查询", operation = "getcity")*/
@PostMapping(value = "/getcity")
@ResponseBody
public JSONObject getArticleCity(@RequestBody JSONObject paramJson) {
JSONObject response = monitorService.getArticleCityList(paramJson);
return response;
}
/**
* @param [paramJson]
* @return com.alibaba.fastjson.JSONObject
* @description: App获取文章列表 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 19:34 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "getarticle")*/
@PostMapping(value = "/getapparticle")
@ResponseBody
public JSONObject getAppArticleList(
@RequestParam(value = "times", required = false, defaultValue = "") String times,
@RequestParam(value = "timee", required = false, defaultValue = "") String timee,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "searchType", required = false, defaultValue = "1") Integer searchType,
@RequestParam(value = "code", required = false, defaultValue = "") String code,
@RequestParam(value = "similar", required = false, defaultValue = "0") String similar,
@RequestParam(value = "matchingmode", required = false, defaultValue = "1") String matchingmode,
@RequestParam(value = "emotionalIndex", required = false, defaultValue = "") String emotionalIndex,
@RequestParam(value = "searchkeyword", required = false, defaultValue = "") String searchkeyword,
@RequestParam(value = "groupid", required = false, defaultValue = "") String groupid,
@RequestParam(value = "group_id", required = false, defaultValue = "") String group_id,
@RequestParam(value = "projectid", required = false, defaultValue = "") String projectid,
@RequestParam(value = "projectId", required = false, defaultValue = "") String projectId,
@RequestParam(value = "timeType", required = false, defaultValue = "4") String timeType,
@RequestParam(value = "precise", required = false, defaultValue = "0") String precise) {
JSONObject paramJson = new JSONObject();
paramJson.put("times", times);
paramJson.put("timee", timee);
paramJson.put("page", page);
paramJson.put("searchType", searchType);
paramJson.put("code", code);
paramJson.put("similar", similar);
paramJson.put("matchingmode", matchingmode);
paramJson.put("emotionalIndex", emotionalIndex);
paramJson.put("searchkeyword", searchkeyword);
//paramJson.put("groupid", groupid);
//paramJson.put("group_id", group_id);
paramJson.put("projectId", projectId);
paramJson.put("projectid", projectid);
paramJson.put("timeType", timeType);
paramJson.put("precise", precise);
JSONObject response = monitorService.getArticleList(paramJson);
//String groupName = solutionGroupDao.getGroupName(Long.parseLong(groupid));
Map<String,Object> map = solutionGroupDao.getGroupNameByprojectId(projectId);
response.getJSONObject("data").put("groupName", map.get("group_name").toString());
try {
RestTemplate template = new RestTemplate();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("text", searchkeyword);
String result = template.postForObject(insert_new_words_url, paramMap, String.class);
} catch (Exception e) {
// TODO: handle exception
}
return response;
}
/**
* @param [paramJson]
* @return com.alibaba.fastjson.JSONObject
* @description: 导出数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 19:34 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "导出" /*type = "查询"*/, operation = "exportarticle")
@PostMapping(value = "/exportarticle")
public void exportArticleList(String data, HttpServletResponse response, HttpServletRequest request) {
JSONObject paramJson = JSON.parseObject(data);
monitorService.exportArticleList(new JSONObject(paramJson), response, request);
return;
}
/**
* @param [paramJson]
* @return com.alibaba.fastjson.JSONObject
* @description: 获取文章列表 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 19:34 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "数据监测", submodule = "数据监测-列表", type = "查询", operation = "getgroupname")*/
@PostMapping(value = "/getgroupname")
@ResponseBody
public JSONObject getGroupNameById(@RequestBody JSONObject paramJson, HttpServletRequest request) {
User user = userUtil.getuser(request);
Long user_id = user.getUser_id();
paramJson.put("user_id", user_id);
JSONObject response = monitorService.getGroupNameById(paramJson);
return response;
}
}

+ 790
- 0
src/main/java/com/stonedt/intelligence/controller/ProjectController.java View File

@@ -0,0 +1,790 @@
package com.stonedt.intelligence.controller;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.stonedt.intelligence.aop.SystemControllerLog;
import com.stonedt.intelligence.service.*;
import com.stonedt.intelligence.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.dao.ProjectTaskDao;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.entity.ProjectTask;
import com.stonedt.intelligence.entity.SolutionGroup;
import com.stonedt.intelligence.entity.User;
/**
* description: 监测管理 <br>
* date: 2020/4/13 10:53 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/project")
public class ProjectController {
@Autowired
private SolutionGroupService solutionGroupService;
@Autowired
private ProjectService projectService;
@Autowired
private UserUtil userUtil;
@Autowired
private ProjectUtil projectUtil;
@Autowired
private OpinionConditionService opinionConditionService;
@Autowired
private SystemService systemService;
@Autowired
private ProjectTaskDao projectTaskDao;
@Autowired
MonitorService monitorService;
@Value("${kafuka.url}")
private String kafuka_url;
@Value("${insertnewwords.url}")
private String insert_new_words_url;
// @Autowired
// private RestTemplate template;
/**
* 删除方案组
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-删除方案组", type = "删除", operation = "updateSolutionGroupStatus")
@PostMapping(value = "/updateSolutionGroupStatus")
@ResponseBody
public String updateSolutionGroupStatus(Long groupId) {
Map<String, Object> updateSolutionGroupStatus = solutionGroupService.updateSolutionGroupStatus(groupId);
return JSON.toJSONString(updateSolutionGroupStatus);
}
/**
* 获取方案组下方案的数量
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-查询方案组", type = "查询", operation = "getProjectCountByGroupId")*/
@PostMapping(value = "/getProjectCountByGroupId")
@ResponseBody
public String getProjectCountByGroupId(Long groupId) {
Map<String, Object> projectCountByGroupId = projectService.getProjectCountByGroupId(groupId);
return JSON.toJSONString(projectCountByGroupId);
}
/**
* 获取方案组和方案的名称
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-查询方案组", type = "查询", operation = "names")*/
@PostMapping(value = "/names")
@ResponseBody
public String names(Long projectId, Long groupId) {
Map<String, String> result = new HashMap<String, String>();
if (null != projectId) {
String projectName = projectService.getProjectName(projectId);
result.put("projectName", projectName);
}
if (null != groupId) {
String groupName = solutionGroupService.getGroupName(groupId);
result.put("groupName", groupName);
}
return JSON.toJSONString(result);
}
/***
* @description: 跳转监测管理页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:37 <br>
* @author: huajiancheng <br>
* @params [groupid, projectsearch, page, menu, mv]
* @return org.springframework.web.servlet.ModelAndView
* */
@SystemControllerLog(module = "监测管理", submodule = "监测管理-列表", type = "查询", operation = "")
@GetMapping(value = "")
public ModelAndView project(@RequestParam(value = "groupid", required = false) Long groupid,
@RequestParam(value = "projectsearch", required = false) String projectsearch,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "menu", required = false) String menu,
ModelAndView mv, HttpServletRequest request) {
boolean projectFlag = monitorService.boolUserProjectByUserId(request);
mv.addObject("groupid", groupid);
mv.addObject("currentPage", page);
mv.addObject("projectsearch", projectsearch);
mv.addObject("menu", "project");
mv.addObject("projectFlag", projectFlag);
mv.setViewName("projectCenter/projectlist");
return mv;
}
/**
* @return java.lang.String
* @description: 获取左侧的方案组数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:47 <br>
* @author: huajiancheng <br>
* @params []
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-查询方案组", type = "查询", operation = "groupandproject")*/
@PostMapping(value = "/groupandproject")
@ResponseBody
public String groupandproject(HttpServletRequest request) {
JSONObject response = new JSONObject();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
try {
list = projectUtil.getGroupInfoByUserId(request);
response.put("code", 200);
response.put("msg", "方案组数据返回成功");
response.put("data", list);
} catch (Exception e) {
e.printStackTrace();
response.put("code", 500);
response.put("msg", "方案组数据返回失败");
response.put("data", list);
}
return JSON.toJSONString(response);
}
/***
* @description: 获取对应方案组的方案列表数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:50 <br>
* @author: huajiancheng <br>
* @param groupid 方案组id
* @param projectsearch 方案搜索关键词
* @return java.lang.String
* */
@SystemControllerLog(module = "监测管理", submodule = "方案组监测列表", type = "查询", operation = "listproject")
@PostMapping(value = "/listproject")
@ResponseBody
public JSONObject listproject(@RequestParam(value = "groupid") Long groupid,
@RequestParam(value = "projectsearch", required = false, defaultValue = "") String projectsearch,
@RequestParam(value = "page", defaultValue = "1") Integer page,
HttpServletRequest request) {
JSONObject response = projectUtil.getProjectInfoByGroupIdAndUserId(request, projectsearch, groupid, page, 10);
return response;
}
/**
* @param group_name 方案组名字,
* @param userid 用户id
* @return java.lang.String
* @description: 创建方案组 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:54 <br>
* @author: kanshicheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-新建方案组", type = "新增", operation = "mkdirgroup")
@PostMapping(value = "/mkdirgroup")
@ResponseBody
public String mkdirgroup(@RequestParam("group_name") String group_name, HttpSession session, HttpServletRequest request) {
SolutionGroup sg = new SolutionGroup();
sg.setGroupName(group_name);
sg.setGroupId(SnowflakeUtil.getId());
User u = userUtil.getuser(request);
if (u.getUser_id() != null) {
sg.setUserId(u.getUser_id());
}
//新增方案组数据
int i = solutionGroupService.addSolutionGroup(sg);
if (i > 0) {
return "success";
} else {
return "fail";
}
}
/**
* @param group_name 方案组名字,
* @param userid 用户id
* @return java.lang.String
* @description: 修改方案组 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:54 <br>
* @author: kanshicheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-修改方案组", type = "修改", operation = "editgroup")
@PostMapping(value = "/editgroup")
@ResponseBody
public JSONObject editgroup(@RequestParam("group_name") String group_name,
@RequestParam("group_id") Long group_id, HttpServletRequest request) {
SolutionGroup sg = new SolutionGroup();
sg.setGroupName(group_name);
sg.setGroupId(group_id);
User user = userUtil.getuser(request);
if (user.getUser_id() != null) {
sg.setUserId(user.getUser_id());
}
JSONObject response = solutionGroupService.editSolutionGroup(sg);
return response;
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转新增方案页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:57 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-新增方案", type = "新增", operation = "addproject")
@GetMapping(value = "/addproject")
public ModelAndView addproject(ModelAndView mv, HttpServletRequest request,
@RequestParam("groupid") Long groupid) {
String groupId = request.getParameter("groupid");
mv.setViewName("projectCenter/createProject");
mv.addObject("menu", "project");
mv.addObject("groupId", groupId);
mv.addObject("groupid", groupid);
return mv;
}
/**
* @param [request]
* @return com.alibaba.fastjson.JSONObject
* @description: 新增方案前检查方案组数量 <br>
* @version: 1.0 <br>
* @date: 2020/4/15 15:47 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-查询方案组", type = "查询", operation = "verifygroup")*/
@PostMapping(value = "/verifygroup")
@ResponseBody
public JSONObject verifygroup(HttpServletRequest request) {
JSONObject response = new JSONObject();
List<Map<String, Object>> list = projectUtil.getGroupInfoByUserId(request);
if (list.size() <= 0) {
response.put("code", 500);
} else {
response.put("code", 200);
}
return response;
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转方案详情页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:57 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-方案详情", type = "查询", operation = "detail")
@GetMapping(value = "/detail")
public ModelAndView detailproject(@RequestParam("groupid") Long groupid, ModelAndView mv, @RequestParam("projectid") Long projectid) {
mv.addObject("groupid", String.valueOf(groupid));
mv.addObject("projectid", String.valueOf(projectid));
mv.setViewName("projectCenter/projectlistDetail");
Map<String, Object> map = projectService.getProjectByProId(projectid);
mv.addObject("projectDetail", map);
mv.addObject("menu", "project");
mv.addObject("detail_projectid", projectid);
return mv;
}
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-方案详情", type = "查询", operation = "detail")*/
@PostMapping(value = "/detail")
@ResponseBody
public String detail(Long projectid) {
Map<String, Object> map = projectService.getProjectByProId(projectid);
return JSON.toJSONString(map);
}
/**
* @param paramJson 用户输入的方案数据
* @return java.lang.String
* @description: 提交新增的方案数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 13:59 <br>
* @author: kanshicheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-新增方案", type = "提交新增", operation = "commitproject")
@PostMapping(value = "/commitproject")
@ResponseBody
public JSONObject commitproject(@RequestBody JSONObject paramJson, HttpServletRequest request) {
JSONObject response = new JSONObject();
JSONObject kafukaJson = new JSONObject();
kafukaJson = paramJson;
JSONObject CommonJson = new JSONObject();
CommonJson = paramJson;
JSONObject idJson = new JSONObject();
User user = userUtil.getuser(request);
Long user_id = user.getUser_id();
String project_name = paramJson.getString("project_name");
Long group_id = paramJson.getLong("group_id");
Map<String, Object> verifyMap = new HashMap<String, Object>();
verifyMap.put("user_id", user_id);
verifyMap.put("del_status", 0);
verifyMap.put("project_name", project_name);
verifyMap.put("group_id", group_id);
Integer existCount = projectService.getProjectCount(verifyMap);
if (existCount <= 0) {
Project p = new Project();
//公共id
String stop_word = paramJson.getString("stop_word");
String regional_word = paramJson.getString("regional_word");
String event_word = paramJson.getString("event_word");
String character_word = paramJson.getString("character_word");
String subject_word = paramJson.getString("subject_word");
stop_word = projectUtil.dealProjectWords(stop_word);
regional_word = projectUtil.dealProjectWords(regional_word);
event_word = projectUtil.dealProjectWords(event_word);
character_word = projectUtil.dealProjectWords(character_word);
subject_word = projectUtil.dealProjectWords(subject_word);
Long projectid = SnowflakeUtil.getId();
p.setProjectId(projectid);
p.setProjectName(paramJson.getString("project_name"));
p.setProjectType(paramJson.getInteger("project_type"));
p.setProjectDescription(paramJson.getString("project_description"));
p.setSubjectWord(subject_word);
p.setCharacterWord(character_word);
p.setEventWord(event_word);
p.setRegionalWord(regional_word);
p.setStopWord(stop_word);
p.setGroupId(paramJson.getLong("group_id"));
p.setUserId(userUtil.getuser(request).getUser_id());
//新增方案
int i = projectService.insertProject(p);
if (i > 0) {
Map<String, Object> paramOpinionMap = new HashMap<String, Object>();
String create_time = DateUtil.getNowTime();
Long opinion_condition_id = SnowflakeUtil.getId();
paramOpinionMap.put("create_time", create_time);
paramOpinionMap.put("opinion_condition_id", opinion_condition_id);
paramOpinionMap.put("project_id", projectid);
paramOpinionMap.put("time", 4);
if (stop_word.equals("")) {
paramOpinionMap.put("precise", 0);
} else {
paramOpinionMap.put("precise", 1);
}
paramOpinionMap.put("emotion", "[1,2,3]");
paramOpinionMap.put("similar", 0);
paramOpinionMap.put("sort", 1);
paramOpinionMap.put("matchs", 1);
Integer opinionConditionCount = opinionConditionService.addOpinionConditionById(paramOpinionMap);
Map<String, Object> warningMap = new HashMap<String, Object>();
Long warning_setting_id = SnowflakeUtil.getId();
warningMap.put("create_time", create_time);
warningMap.put("project_id", projectid);
warningMap.put("warning_setting_id", warning_setting_id);
warningMap.put("warning_status", 0);
warningMap.put("warning_name", "预警");
warningMap.put("warning_word", "");
warningMap.put("warning_classify", "1,2,3,4,5,6,7,8,9,10,11");
warningMap.put("warning_content", 0);
warningMap.put("warning_similar", 0);
warningMap.put("warning_match", 2);
warningMap.put("warning_deduplication", 0);
warningMap.put("weekend_warning", 1);
warningMap.put("warning_interval", "{\"type\":\"1\",\"time\":\"1\"}");
warningMap.put("warning_source", "{\"type\":\"1\",\"email\":\"\"}");
warningMap.put("warning_receive_time", "{\"start\":\"00:00\",\"end\":\"23:00\"}");
Integer warningCount = systemService.addWarning(warningMap);
idJson.put("project_id", projectid);
idJson.put("group_id", group_id);
if (opinionConditionCount > 0 && warningCount > 0) {
response.put("code", 200);
response.put("msg", "方案新增成功");
response.put("data", idJson);
} else {
response.put("code", 500);
response.put("msg", "方案新增失败");
response.put("data", idJson);
}
ProjectTask projectTask = new ProjectTask();
projectTask.setAnalysis_flag(0);
// projectTask.setCharacter_word(paramJson.getString("character_word"));
// projectTask.setEvent_word(paramJson.getString("event_word"));
// projectTask.setProject_id(projectid);
// projectTask.setProject_type(paramJson.getInteger("project_type"));
// projectTask.setRegional_word(paramJson.getString("regional_word"));
// projectTask.setStop_word(paramJson.getString("stop_word"));
// projectTask.setSubject_word(paramJson.getString("subject_word"));
projectTask.setCharacter_word(character_word);
projectTask.setEvent_word(event_word);
projectTask.setProject_id(projectid);
projectTask.setProject_type(paramJson.getInteger("project_type"));
projectTask.setRegional_word(regional_word);
projectTask.setStop_word(stop_word);
projectTask.setSubject_word(subject_word);
projectTask.setVolume_flag(0);
projectTaskDao.saveProjectTask(projectTask);
String message = "";
if(CommonJson.getIntValue("project_type") == 1){
message = ProjectWordUtil.CommononprojectKeyWord(kafukaJson.getString("subject_word"));
}else {
if(kafukaJson.getString("subject_word").indexOf("\\|")!=-1||kafukaJson.getString("subject_word").indexOf("+")!=-1) {
message = ProjectWordUtil.CommononprojectKeyWord(kafukaJson.getString("subject_word"));
}else {
kafukaJson.remove("project_type");
kafukaJson.remove("group_id");
kafukaJson.remove("project_name");
for (Map.Entry entry : kafukaJson.entrySet()) {
String value = String.valueOf(entry.getValue());
if (!value.equals("")) {
if (value.endsWith(",")) {
value = value.substring(0, value.lastIndexOf(","));
}
if (!message.equals("")) {
message = message + "," + value;
} else {
message = value;
}
if (message.endsWith(",")) {
message = message.substring(0, message.lastIndexOf(","));
}
}
}
}
}
String kafukaResponse = MyHttpRequestUtil.doPostKafka("ikHotWords", message, kafuka_url);
RestTemplate template = new RestTemplate();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("text", message);
String result = template.postForObject(insert_new_words_url, paramMap, String.class);
System.out.println("result========================="+result);
} else {
response.put("code", 500);
response.put("msg", "方案新增失败");
}
} else {
response.put("code", 500);
response.put("msg", "方案名已存在");
}
return response;
}
/**
* @param [mv, projectid]
* @return org.springframework.web.servlet.ModelAndView
* @description: 修改方案,跳转修改方案页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/15 15:15 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-修改方案", type = "修改", operation = "editproject")
@GetMapping(value = "/editproject")
public ModelAndView editproject(ModelAndView mv, @RequestParam("projectid") Long projectid,
@RequestParam("groupid") Long groupid,
HttpServletRequest request) {
String groupId = request.getParameter("groupid");
if (StringUtils.isBlank(groupId)) groupId = "";
String projectId = request.getParameter("projectid");
if (StringUtils.isBlank(projectId)) projectId = "";
mv.addObject("groupId", groupId);
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectId);
mv.addObject("edit_groupid", groupid);
mv.setViewName("projectCenter/editProject");
mv.addObject("menu", "project");
mv.addObject("edit_projectid", projectid);
return mv;
}
/**
* @param [mv, projectid]
* @return org.springframework.web.servlet.ModelAndView
* @description: 修改方案,跳转修改方案页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/15 15:15 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-修改方案", type = "修改", operation = "getedit")*/
@GetMapping(value = "/getedit")
@ResponseBody
public String getedit(@RequestParam("projectid") Long projectid) {
JSONObject response = new JSONObject();
Map<String, Object> project = projectService.getProjectByProId(projectid);
Map<String, Object> opinionParamMap = new HashMap<String, Object>();
opinionParamMap.put("projectid", projectid);
Map<String, Object> opinionResponseMap = projectService.getOpinionConditionById(opinionParamMap);
String precise = String.valueOf(opinionResponseMap.get("precise"));
project.put("precise", precise);
if (project != null) {
response.put("code", 200);
response.put("msg", "获取方案信息成功");
response.put("data", project);
} else {
response.put("code", 500);
response.put("msg", "获取方案信息失败");
response.put("data", project);
}
return JSON.toJSONString(response);
}
/***
* @description: 提交用户修改的方案数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 14:02 <br>
* @author: huajiancheng <br>
* @param [paramJson 用户修改的方案数据 ]
* @return java.lang.String
* */
@SystemControllerLog(module = "监测管理", submodule = "监测管理-修改方案", type = "提交修改", operation = "commiteditproject")
@PostMapping(value = "/commiteditproject")
@ResponseBody
public JSONObject commiteditproject(@RequestBody JSONObject paramJson, HttpServletRequest request) {
JSONObject response = new JSONObject();
if (paramJson.getIntValue("project_type") == 1) {
paramJson.put("character_word", "");
paramJson.put("event_word", "");
paramJson.put("regional_word", "");
} else {
String regional_word = paramJson.getString("regional_word");
String event_word = paramJson.getString("event_word");
String character_word = paramJson.getString("character_word");
regional_word = projectUtil.dealProjectWords(regional_word);
event_word = projectUtil.dealProjectWords(event_word);
character_word = projectUtil.dealProjectWords(character_word);
paramJson.put("regional_word", regional_word);
paramJson.put("event_word", event_word);
paramJson.put("character_word", character_word);
}
String stop_word = paramJson.getString("stop_word");
String subject_word = paramJson.getString("subject_word");
stop_word = projectUtil.dealProjectWords(stop_word);
subject_word = projectUtil.dealProjectWords(subject_word);
paramJson.put("stop_word", stop_word);
paramJson.put("subject_word", subject_word);
User user = userUtil.getuser(request);
Long user_id = user.getUser_id();
Map<String, Object> editParam = paramJson;
JSONObject kafukaJson = new JSONObject();
kafukaJson = paramJson;
JSONObject CommonJson = new JSONObject();
CommonJson = paramJson;
String update_time = DateUtil.nowTime();
editParam.put("user_id", user_id);
editParam.put("update_time", update_time);
String project_id = paramJson.getString("project_id");
String precise = paramJson.getString("precise");
Map<String, Object> opinionConditionParam = new HashMap<String, Object>();
opinionConditionParam.put("projectid", project_id);
if (precise.equals("0")) {
opinionConditionParam.put("precise", 0);
} else {
opinionConditionParam.put("precise", 1);
}
@SuppressWarnings("unused")
Integer opinronCount = projectService.updateOpinionConditionById(opinionConditionParam);
Integer count = projectService.editProjectInfo(editParam);
if (count > 0) {
String message = "";
if(CommonJson.getIntValue("project_type") == 1){
message = ProjectWordUtil.CommononprojectKeyWord(kafukaJson.getString("subject_word"));
}else {
if(kafukaJson.getString("subject_word").indexOf("\\|")!=-1||kafukaJson.getString("subject_word").indexOf("+")!=-1) {
message = ProjectWordUtil.CommononprojectKeyWord(kafukaJson.getString("subject_word"));
}else {
// 将词发给卡夫卡
kafukaJson.remove("project_type");
kafukaJson.remove("group_id");
kafukaJson.remove("project_id");
kafukaJson.remove("project_name");
kafukaJson.remove("update_time");
kafukaJson.remove("user_id");
for (Map.Entry entry : kafukaJson.entrySet()) {
String value = String.valueOf(entry.getValue());
if (!value.equals("")) {
if (value.endsWith(",")) {
value = value.substring(0, value.lastIndexOf(","));
}
if (!message.equals("")) {
message = message + "," + value;
} else {
message = value;
}
if (message.endsWith(",")) {
message = message.substring(0, message.lastIndexOf(","));
}
}
}
}
}
String kafukaResponse = MyHttpRequestUtil.doPostKafka("ikHotWords", message, kafuka_url);
RestTemplate template = new RestTemplate();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("text", message);
try {
String result = template.postForObject(insert_new_words_url, paramMap, String.class);
System.out.println("result========================="+result);
} catch (Exception e) {
// TODO: handle exception
}
response.put("code", 200);
response.put("msg", "方案信息修改成功!");
} else {
response.put("code", 500);
response.put("msg", "方案信息修改失败!");
}
return response;
}
/**
* @param []
* @return com.alibaba.fastjson.JSONObject
* @description: 获取方案组和方案列表数据 <br>
* @version: 1.0 <br>
* @date: 2020/4/14 17:52 <br>
* @author: huajiancheng <br>
*/
/*@SystemControllerLog(module = "监测管理", submodule = "监测管理-查询方案组", type = "查询", operation = "getGroupAndProject")*/
@PostMapping(value = "getGroupAndProject")
@ResponseBody
public String getGroupAndProject(HttpServletRequest request) {
JSONObject response = projectUtil.getProjectAndGroupInfoByUserId(request);
return JSON.toJSONString(response);
}
/**
* @param [request]
* @return java.lang.String
* @description: 删除方案 <br>
* @version: 1.0 <br>
* @date: 2020/4/16 10:54 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-删除方案", type = "删除", operation = "delProject")
@PostMapping(value = "delProject")
@ResponseBody
public String delProject(@RequestParam(value = "groupid", required = true) Long groupid,
@RequestParam(value = "projectid", required = true) String projectid,
HttpServletRequest request) {
List<String> projectids = new ArrayList<String>();
JSONObject response = new JSONObject();
if (projectid.contains(",")) {
projectids = Arrays.asList(projectid.split(","));
} else {
projectids = Arrays.asList(projectid.split(","));
}
User user = userUtil.getuser(request);
Long user_id = user.getUser_id();
for (int i = 0; i < projectids.size(); i++) {
String id = projectids.get(i);
Map<String, Object> delParam = new HashMap<String, Object>();
delParam.put("user_id", user_id);
delParam.put("del_status", 1);
delParam.put("project_id", id);
Integer count = projectService.delProject(delParam);
if (count > 0) {
response.put("delstatus", 200);
response.put("msg", "方案删除成功!");
} else {
response.put("delstatus", 500);
response.put("msg", "方案删除失败!");
}
}
response = projectUtil.getProjectInfoByGroupIdAndUserId(request, "", groupid, 1, 10);
return JSON.toJSONString(response);
}
@SystemControllerLog(module = "监测管理", submodule = "监测管理-删除方案", type = "删除", operation = "delProjectDetail")
@PostMapping(value = "/delProjectDetail")
@ResponseBody
public String delProjectDetail(String projectid, HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
long user_id = userUtil.getUserId(request);
Map<String, Object> delParam = new HashMap<String, Object>();
delParam.put("user_id", user_id);
delParam.put("del_status", 1);
delParam.put("project_id", projectid);
Integer count = projectService.delProject(delParam);
if (count > 0) {
result.put("delstatus", 200);
result.put("msg", "方案删除成功!");
} else {
result.put("delstatus", 500);
result.put("msg", "方案删除失败!");
}
return JSON.toJSONString(result);
}
/**
* 批量删除方案
*/
@SystemControllerLog(module = "监测管理", submodule = "监测管理-删除方案", type = "删除", operation = "batchUpdateProject")
@PostMapping(value = "/batchUpdateProject")
@ResponseBody
public String batchUpdateProject(String projectIds, HttpServletRequest request) {
long userId = userUtil.getUserId(request);
Map<String, Object> batchUpdateProject = projectService.batchUpdateProject(userId, projectIds);
return JSON.toJSONString(batchUpdateProject);
}
@PostMapping(value = "/keywords")
@ResponseBody
public String getAllKeywords(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "size", required = false, defaultValue = "20") Integer size) {
JSONObject response = projectService.getAllKeywords();
return response.toJSONString();
}
}

+ 577
- 0
src/main/java/com/stonedt/intelligence/controller/PublicOptionContoller.java View File

@@ -0,0 +1,577 @@
package com.stonedt.intelligence.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stonedt.intelligence.entity.PublicoptionDetailEntity;
import com.stonedt.intelligence.entity.PublicoptionEntity;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.PublicOptionService;
import com.stonedt.intelligence.util.TextUtil;
import com.stonedt.intelligence.aop.SystemControllerLog;
/**
* 事件分析
* @author wangyi
*
*/
@Controller
@RequestMapping("/publicoption")
public class PublicOptionContoller {
@Autowired
private PublicOptionService publicOptionService;
/**
* 舆情研判分析详情任务列表
* @param request
* @param mv
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "事件分析页面", type = "查询", operation = "")
@GetMapping(value = "")
public ModelAndView displayboardlist(HttpServletRequest request,ModelAndView mv) {
mv.addObject("menu", "public_option");
mv.addObject("publicoptionleft_menu", "public_optionlist");
mv.setViewName("publicoption/eventAnalysisList");
return mv;
}
/**
* 展示舆情研判列表
* @param request
* @param mv
* @param session
* @param pagenum
* @param searchkeyword
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "展示事件列表", type = "查询", operation = "")
@PostMapping(value = "/list")
@ResponseBody
public String list(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "pagenum", required = false, defaultValue = "1") Integer pagenum,
@RequestParam(value = "searchkeyword", required = false, defaultValue = "") String searchkeyword) {
Map<String, Object> result = new HashMap<String, Object>();
User user = (User) session.getAttribute("User");
PageHelper.startPage(pagenum, 10);
List<PublicoptionEntity> datalist = publicOptionService.getlist(user.getUser_id(), searchkeyword);
PageInfo<PublicoptionEntity> pageInfo = new PageInfo<>(datalist);
result.put("list", datalist);
result.put("pageCount", pageInfo.getPages());
result.put("dataCount", pageInfo.getTotal());
return JSON.toJSONString(result);

}
/**
* 根据id查询基本数据
* @param request
* @param mv
* @param session
* @param id
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "查询基本数据", type = "查询", operation = "")
@PostMapping(value = "/getdatabyid")
@ResponseBody
public String getbyid(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "1") Integer id) {
Map<String, Object> result = new HashMap<String, Object>();
PublicoptionEntity publicoption =publicOptionService.getdatabyid2(id);
result.put("publicoption", publicoption);
return JSON.toJSONString(result);

}
/**
* 任务报告列表
* @param request
* @param mv
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "任务报告列表", type = "查询", operation = "")
@GetMapping(value = "reportlist")
public ModelAndView reportlist(HttpServletRequest request,ModelAndView mv) {
mv.addObject("menu", "public_option");
mv.addObject("publicoptionleft_menu", "reportlist");
mv.setViewName("publicoption/eventAnalysisReport");
return mv;
}
/**
* 研判分析详情
* @param request
* @param mv
* @param id
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "任务报告详情", type = "查询", operation = "")
@GetMapping(value = "reportdetail/{id}")
public ModelAndView reportdetail(HttpServletRequest request,ModelAndView mv,
@PathVariable(required = false) Integer id,HttpSession session) {
Map<String, Object> mapParam=new HashMap<String, Object>();
User user=(User)session.getAttribute("User");
mapParam.put("userId", user.getUser_id());
mapParam.put("id", id);
PublicoptionDetailEntity dcd= publicOptionService.getdetail(mapParam);
mv.addObject("publicoptionleft_menu", "public_optionlist");
mv.addObject("menu", "public_option");
mapParam.put("reportId", id);
PublicoptionEntity publicoption =publicOptionService.getdatabyid(mapParam);
mv.addObject("publicoption", publicoption);
if(dcd!=null) {
JSONObject parseObject = JSONObject.parseObject(JSON.toJSONString(dcd));
Set<String> keySet = parseObject.keySet();
for (String string : keySet) {
String string2 = TextUtil.processQuotationMarks(parseObject.get(string).toString());
mv.addObject(string,JSONObject.parse(string2));
}
}
mv.setViewName("publicoption/eventAnalysisDetail");
return mv;
}
/**
* 更新舆情研判分析数据
* @param request
* @param mv
* @param session
* @param id
* @param eventname
* @param eventkeywords
* @param eventstarttime
* @param eventendtime
* @param eventstopwords
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "更新事件分析数据", type = "更新", operation = "")
@PostMapping(value = "/updatedatabyid")
@ResponseBody
public String updatedatabyid(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "id", required = false, defaultValue = "1") Integer id,
@RequestParam(value = "eventname", required = false, defaultValue = "") String eventname,
@RequestParam(value = "eventkeywords", required = false, defaultValue = "") String eventkeywords,
@RequestParam(value = "eventstarttime", required = false, defaultValue = "") String eventstarttime,
@RequestParam(value = "eventendtime", required = false, defaultValue = "") String eventendtime,
@RequestParam(value = "eventstopwords", required = false, defaultValue = "") String eventstopwords
) {
String result =publicOptionService.updatabyid(id,eventname,eventkeywords,eventstarttime,eventendtime,eventstopwords);
return result;

}
/**
* 创建舆情研判数据
* @param request
* @param mv
* @param session
* @param eventname
* @param eventkeywords
* @param eventstarttime
* @param eventendtime
* @param eventstopwords
* @return
*/
@SystemControllerLog(module = "事件分析", submodule = "创建事件数据", type = "创建", operation = "")
@PostMapping(value = "/addpublicoptiondata")
@ResponseBody
public String addpublicoptiondata(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "eventname", required = false, defaultValue = "") String eventname,
@RequestParam(value = "eventkeywords", required = false, defaultValue = "") String eventkeywords,
@RequestParam(value = "eventstarttime", required = false, defaultValue = "") String eventstarttime,
@RequestParam(value = "eventendtime", required = false, defaultValue = "") String eventendtime,
@RequestParam(value = "eventstopwords", required = false, defaultValue = "") String eventstopwords
) {
User user = (User) session.getAttribute("User");
String result =publicOptionService.addpublicoptiondata(user.getUser_id(),eventname,eventkeywords,eventstarttime,eventendtime,eventstopwords);
return result;

}




@SystemControllerLog(module = "事件分析", submodule = "删除事件数据", type = "删除", operation = "")
@PostMapping(value = "/deletepublicoptioninfo")
@ResponseBody
public String deletepublicoptioninfo(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "Ids", required = false, defaultValue = "") String Ids
) {
User user = (User) session.getAttribute("User");
Long user_id = user.getUser_id();
String result = publicOptionService.DeleteupinfoByIds(Ids,request);
return result;

}
/**
*
* @param request
* @param mv
* @param session
* @param pagenum
* @param searchkeyword
* @return
*/
@PostMapping(value = "/publicoptionreportlist")
@ResponseBody
public String publicoptionreportlist(HttpServletRequest request, ModelAndView mv, HttpSession session,
@RequestParam(value = "pagenum", required = false, defaultValue = "1") Integer pagenum,
@RequestParam(value = "searchkeyword", required = false, defaultValue = "") String searchkeyword) {
Map<String, Object> result = new HashMap<String, Object>();
User user = (User) session.getAttribute("User");
PageHelper.startPage(pagenum, 10);
List<PublicoptionEntity> datalist = publicOptionService.getpublicoptionreportlist(user.getUser_id(), searchkeyword);
PageInfo<PublicoptionEntity> pageInfo = new PageInfo<>(datalist);
result.put("list", datalist);
result.put("pageCount", pageInfo.getPages());
result.put("dataCount", pageInfo.getTotal());
return JSON.toJSONString(result);

}
/**
* 溯源分析页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/backanalysis")
public ModelAndView backanalysis(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getBackAnalysisById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("backAnalysis", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "backanalysis");
mv.setViewName("publicoption/backanalysis");
return mv;
}
/**
* 获取报告的资讯列表
* @param publicoptionEntity
* @return
*/
@PostMapping(value = "/loadInformation")
@ResponseBody
public ResponseEntity<JSONObject> loadInformation(PublicoptionEntity publicoptionEntity){
JSONObject data=publicOptionService.loadInformation(publicoptionEntity);
return new ResponseEntity<JSONObject>(data, HttpStatus.OK);
}
/**
* 事件脉络页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/eventContext")
public ModelAndView eventContext(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getEventContextById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="[]";
}
obj.put("eventContext", JSON.parseArray(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "eventContext");
mv.setViewName("publicoption/eventContext");
return mv;
}
/**
* 事件跟踪页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/eventTrace")
public ModelAndView eventTrace(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getEventTraceById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("eventTrace", JSON.parseObject(backAnalysisStr));
String backAnalysisStraa = publicOptionService.getBackAnalysisById(publicoption.getId());
if(backAnalysisStraa==null || "".equals(backAnalysisStraa)) {
backAnalysisStraa="{}";
}
obj.put("backAnalysis", JSON.parseObject(backAnalysisStraa));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "eventTrace");
mv.setViewName("publicoption/eventTrace");
return mv;
}

/**
* 热点分析页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/hotAnalysis")
public ModelAndView hotAnalysis(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getHotAnalysisById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="[]";
}
obj.put("hotAnalysis", JSON.parseArray(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "hotAnalysis");
mv.setViewName("publicoption/hotAnalysis");
return mv;
}
/**
* 重点网民分析页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/netizensAnalysis")
public ModelAndView netizensAnalysis(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getNetizensAnalysisById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("netizensAnalysis", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "netizensAnalysis");
mv.setViewName("publicoption/netizensAnalysis");
return mv;
}
/**
* 统计页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/statistics")
public ModelAndView statistics(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getStatisticsById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("statistics", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "statistics");
mv.setViewName("publicoption/statistics");
return mv;
}
/**
* 传播分析页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/propagationAnalysis")
public ModelAndView propagationAnalysis(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getPropagationAnalysisById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("propagationAnalysis", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "propagationAnalysis");
mv.setViewName("publicoption/propagationAnalysis");
return mv;
}
/**
* 专题分析页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/thematicAnalysis")
public ModelAndView thematicAnalysis(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getThematicAnalysisById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("thematicAnalysis", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "thematicAnalysis");
mv.setViewName("publicoption/thematicAnalysis");
return mv;
}
/**
* 内容解读页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/unscrambleContent")
public ModelAndView unscrambleContent(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
String backAnalysisStr = publicOptionService.getUnscrambleContentById(publicoption.getId());
if(backAnalysisStr==null || "".equals(backAnalysisStr)) {
backAnalysisStr="{}";
}
obj.put("unscrambleContent", JSON.parseObject(backAnalysisStr));
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "unscrambleContent");
mv.setViewName("publicoption/unscrambleContent");
return mv;
}
/**
* 司法舆情分析研判对象页面
* @param session
* @param mv
* @return
*/
@GetMapping(value = "/popular_feelings_analys")
public ModelAndView popular_feelings_analys(HttpSession session, ModelAndView mv) {
JSONArray data=new JSONArray();
User user=(User)session.getAttribute("User");
List<PublicoptionEntity> list = publicOptionService.getpublicoptionreportlist(user.getUser_id(), "");
for (PublicoptionEntity publicoption : list) {
String jsonString = JSON.toJSONString(publicoption);
JSONObject obj = JSON.parseObject(jsonString);
data.add(obj);
}
mv.addObject("data", data.toJSONString());
mv.addObject("publicoptionleft_menu", "reportlist");
mv.addObject("menu", "public_option");
mv.addObject("childmenu", "popular_feelings_analys");
mv.setViewName("publicoption/popular_feelings_analys");
return mv;
}
}

+ 131
- 0
src/main/java/com/stonedt/intelligence/controller/ReportController.java View File

@@ -0,0 +1,131 @@
package com.stonedt.intelligence.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.stonedt.intelligence.aop.SystemControllerLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.stonedt.intelligence.entity.ReportDetail;
import com.stonedt.intelligence.service.ReportCustomService;
import com.stonedt.intelligence.service.ReportDetailService;
import com.stonedt.intelligence.util.UserUtil;
/**
* description: 数据报告控制器 <br>
* date: 2020/4/13 10:53 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/report")
public class ReportController {
@Autowired
private UserUtil userUtil;
@Autowired
private ReportCustomService reportCustomService;
@Autowired
private ReportDetailService reportDetailService;
/**
* 获取当前用户的数据报告列表
* pageNum 页数,reportType 报告类型(1日报 2周报 3月报), nameSearch 搜索词
*/
/*@SystemControllerLog(module = "分析报告", submodule = "分析报告-列表", type = "查询", operation = "listReportCustom")*/
@PostMapping(value = "/listReportCustom")
@ResponseBody
public String name(Integer pageNum, Integer reportType, String nameSearch, Long projectId) {
Map<String, Object> listReportCustom = reportCustomService.listReportCustom(pageNum, reportType, projectId, nameSearch);
return JSON.toJSONString(listReportCustom);
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转报告列表页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:54 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "分析报告", submodule = "分析报告-列表", type = "查询", operation = "")
@GetMapping(value = "")
public ModelAndView reportlist(ModelAndView mv, HttpServletRequest request) {
String groupid = request.getParameter("groupid");
String projectid = request.getParameter("projectid");
String search = request.getParameter("search");
String type = request.getParameter("type");
String page = request.getParameter("page");
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectid);
mv.addObject("search", search);
mv.addObject("type", type);
mv.addObject("page", page);
mv.addObject("menu", "report");
mv.setViewName("report/reportList");
return mv;
}
/**
* 数据报告详情页面
*/
@SystemControllerLog(module = "分析报告", submodule = "分析报告-详情", type = "查询报告详情", operation = "")
@GetMapping(value = "/{id}")
public ModelAndView reportdetail(@PathVariable()String id, ModelAndView mv, HttpServletRequest request) {
String groupid = request.getParameter("groupid");
String projectid = request.getParameter("projectid");
mv.addObject("id", id);
mv.addObject("groupid", groupid);
mv.addObject("projectid", projectid);
mv.addObject("menu", "report");
mv.setViewName("report/report");
return mv;
}
/**
* 报告详情数据
*/
/*@SystemControllerLog(module = "分析报告", submodule = "分析报告-详情", type = "查询", operation = "reportDetail")*/
@PostMapping(value = "/reportDetail")
@ResponseBody
public String reportDetail(Long reportId) {
ReportDetail reportDetail = reportDetailService.getReportDetail(reportId);
return JSON.toJSONString(reportDetail);
}
/**
* 批量删除报告
*/
@SystemControllerLog(module = "分析报告", submodule = "分析报告-列表", type = "删除报告", operation = "batchUpdateReportCustom")
@PostMapping(value = "/batchUpdateReportCustom")
@ResponseBody
public String batchUpdateReportCustom(String reportIds, HttpServletRequest request) {
long userId = userUtil.getUserId(request);
Map<String, Object> batchUpdateProject = reportCustomService.batchUpdateReportCustom(userId, reportIds);
return JSON.toJSONString(batchUpdateProject);
}
/**
* 报告编制状态修改
*/
@SystemControllerLog(module = "分析报告", submodule = "分析报告-列表", type = "编制分析报告", operation = "batchUpdateReportCustom")
@PostMapping(value = "/batchUpdateReportCustomStatus")
@ResponseBody
public String batchUpdateReportCustomStatus(String reportIds, HttpServletRequest request) {
long userId = userUtil.getUserId(request);
Map<String, Object> batchUpdateProject = reportCustomService.batchUpdateReportCustomStatus(userId, reportIds);
return JSON.toJSONString(batchUpdateProject);
}
}

+ 47
- 0
src/main/java/com/stonedt/intelligence/controller/SearchController.java View File

@@ -0,0 +1,47 @@
package com.stonedt.intelligence.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* description: 全文搜索控制器 <br>
* date: 2020/4/13 10:53 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/search")
public class SearchController {
// @Autowired
// private FullSearchService fullSearchService;
/**
* @description: 跳转全文搜索页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:51 <br>
* @author: huajiancheng <br>
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* */
@GetMapping(value = "")
public ModelAndView fullsearch(ModelAndView mv) {
mv.setViewName("search/fullSearch");
mv.addObject("menu", "search");
return mv;
}
/**
* 12小时热点内容
*/
// @PostMapping(value = "/twelveHotArticle")
// @ResponseBody
// public String twelveHotArticle() {
// List<Map<String, Object>> twelveHotArticle = fullSearchService.twelveHotArticle();
// return JSON.toJSONString(twelveHotArticle);
// }
}

+ 380
- 0
src/main/java/com/stonedt/intelligence/controller/SystemController.java View File

@@ -0,0 +1,380 @@
package com.stonedt.intelligence.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.stonedt.intelligence.aop.SystemControllerLog;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.stonedt.intelligence.entity.OpinionCondition;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.entity.SolutionGroup;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.entity.WarningSetting;
import com.stonedt.intelligence.service.EarlyWarningService;
import com.stonedt.intelligence.service.OpinionConditionService;
import com.stonedt.intelligence.service.ProjectService;
import com.stonedt.intelligence.service.SolutionGroupService;
import com.stonedt.intelligence.service.SystemService;
import com.stonedt.intelligence.service.UserService;
import com.stonedt.intelligence.util.ProjectUtil;
import com.stonedt.intelligence.util.ResultUtil;
import com.stonedt.intelligence.util.UserUtil;
/**
* description: 系统设置、系统消息控制器 <br>
*/
@Controller
@RequestMapping(value = "/system")
@PropertySource(value = "file:./config/config.properties", encoding = "UTF-8")
public class SystemController {
@Autowired
private UserUtil userUtil;
@Autowired
private ProjectUtil projectUtil;
@Autowired
private SystemService systemService;
@Autowired
private OpinionConditionService opinionConditionService;
@Autowired
private SolutionGroupService solutionGroupService;
@Autowired
private ProjectService projectService;
@Autowired
private EarlyWarningService earlyWarningService;
@Value("${product.manual.path}")
private String productManualPath;
@Autowired
private UserService userService;
/**
* 在线查看产品使用手册
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-产品手册", type = "查询", operation = "productmanual/online")
@GetMapping(value = "/productmanual/online")
public String onlineProductManual(Model model) {
model.addAttribute("pdfPath", "/pdf/" + productManualPath);
return "setting/pdf_online";
}
/**
* 下载产品使用手册
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-产品手册", type = "下载", operation = "uploadProductManual")
@GetMapping(value = "/uploadProductManual")
public ResponseEntity<InputStreamResource> uploadProductManual() {
ResponseEntity<InputStreamResource> uploadProductManual = systemService.uploadProductManual();
return uploadProductManual;
}
/**
* 根据用户id获取所有的方案组
*/
// @SystemControllerLog(module = "系统设置", submodule = "系统设置-产品手册", type = "查询", operation = "listSolutionGroupByUserId")
@PostMapping(value = "/listSolutionGroupByUserId")
@ResponseBody
public String listSolutionGroupByUserId(HttpServletRequest request) {
long userId = userUtil.getUserId(request);
List<SolutionGroup> listSolutionGroupByUserId = solutionGroupService.listSolutionGroupByUserId(userId);
return JSON.toJSONString(listSolutionGroupByUserId);
}
/**
* 根据方案组id获取所有的方案
*/
@PostMapping(value = "/listProjectByGroupId")
@ResponseBody
public String listProjectByGroupId(Long groupId) {
List<Project> listProjectByGroupId = projectService.listProjectByGroupId(groupId);
return JSON.toJSONString(listProjectByGroupId);
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转预警配置页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:44 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "查询", operation = "warning")
@GetMapping(value = "/warning")
public ModelAndView warning(HttpServletRequest request, ModelAndView mv) {
String groupid = request.getParameter("groupid");
String page = request.getParameter("page");
List<Map<String, Object>> groupInfo = projectUtil.getGroupInfoByUserId(request);
Map<String, Object> map = new HashMap<String, Object>();
map.put("group_id", "");
map.put("group_name", "全部方案组");
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
list.add(map);
for (int i = 0; i < groupInfo.size(); i++) {
list.add(groupInfo.get(i));
}
mv.addObject("groupInfoList", list);
mv.addObject("groupid", groupid);
mv.addObject("page", page);
mv.addObject("settingLeft", "warning");
mv.setViewName("setting/warning");
return mv;
}
/**
* 预警列表
*
* @param request
* @param pageNum
* @param warning_project_name
* @return
*/
/*@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "查询", operation = "listWarning")*/
@PostMapping(value = "/listWarning")
public @ResponseBody
ResultUtil getWarningList(HttpServletRequest request, @RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
@RequestParam(value = "groupId", required = false) String groupId) {
Long id = null;
if (StringUtils.isNotBlank(groupId)) {
id = Long.valueOf(groupId);
}
long userId = userUtil.getUserId(request);
Map<String, Object> listWarning = systemService.listWarning(page, userId, id);
return ResultUtil.build(200, "", JSON.toJSONString(listWarning));
}
/**
* 修改预警开关
*
* @param warning_status
* @param project_id
* @return
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "修改开关", operation = "updateWarningStatusById")
@PostMapping(value = "/updateWarningStatusById")
public @ResponseBody
ResultUtil updateWarningStatusById(@RequestParam(value = "warning_status", defaultValue = "1", required = false) Integer warning_status,
@RequestParam(value = "project_id", required = false) String project_id) {
boolean updateWarning = systemService.updateWarningStatusById(warning_status, Long.valueOf(project_id));
if (updateWarning) {
return ResultUtil.build(200, "");
}
return ResultUtil.build(500, "");
}
/*@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "查询", operation = "updateWarningStatusById")*/
@PostMapping(value = "/getwords")
public @ResponseBody
ResultUtil getWarningWordsId(@RequestParam(value = "project_id", required = false) String project_id) {
boolean wordFlag = systemService.getWarningWordById(Long.valueOf(project_id)); // 词为空
if (wordFlag) {
return ResultUtil.build(500, "预警词为空不能打开预警开关!");
}
return ResultUtil.build(200, "");
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转预警消息列表页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:44 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-消息列表", type = "查询", operation = "warningmsg")
@GetMapping(value = "/warningmsg")
public ModelAndView warningMessage(HttpServletRequest request, ModelAndView mv) {
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
mv.addObject("groupid", groupId);
mv.addObject("projectid", projectId);
mv.addObject("settingLeft", "warningmsg");
mv.setViewName("setting/warningMessage");
return mv;
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转预警修改 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:44 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "修改", operation = "warningedit")
@GetMapping(value = "/warningedit")
public ModelAndView warningedit(HttpServletRequest request, ModelAndView mv) {
String groupid = request.getParameter("groupid");
String page = request.getParameter("page");
String project_id = request.getParameter("project_id");
Map<String, Object> projectMap = new HashMap<String, Object>();
projectMap.put("del_status", 0);
projectMap.put("project_id", project_id);
projectMap.put("group_id", groupid);
Map<String, Object> projectInfo = projectService.getProjectInfoById(projectMap);
String warningWord = "";
if (projectInfo != null) {
String subject_word = String.valueOf(projectInfo.get("subject_word"));
String subject_words[] = subject_word.split(",");
for (int i = 0; i < subject_words.length; i++) {
if (i > 2) {
break;
}
warningWord += subject_words[i] + ",";
}
if (warningWord.endsWith(",")) {
warningWord = warningWord.substring(0, warningWord.lastIndexOf(","));
}
}
WarningSetting warning = systemService.getWarningByProjectId(Long.valueOf(project_id));
warning.setWarning_word(warningWord);
mv.addObject("warning", warning);
mv.addObject("warningStr", JSON.toJSONString(warning));
mv.addObject("groupid", groupid);
mv.addObject("project_id", project_id);
mv.addObject("page", page);
mv.addObject("settingLeft", "warning");
mv.setViewName("setting/warningEdit");
return mv;
}
/**
* 编辑预警信息
*
* @param warningSetting
* @return
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-配置列表", type = "提交修改", operation = "updateWarning")
@PostMapping("/updateWarning")
public @ResponseBody
ResultUtil saveWarningEdit(WarningSetting warningSetting) {
ResultUtil updateWarning = systemService.updateWarning(warningSetting);
return updateWarning;
}
/**
* 预警弹框
*/
//@SystemControllerLog(module = "系统设置", submodule = "系统设置-预警设置-消息列表", type = "窗口查询", operation = "getWarningArticle")
@PostMapping("/getWarningArticle")
public @ResponseBody
ResultUtil getWarningArticle(@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
Integer openFlag, HttpServletRequest request) {
String project_id = request.getParameter("project_id");
long userId = userUtil.getUserId(request);
Map<String, Object> warningArticle = null;
if (project_id != null && !project_id.equals("")) {
Long valueOf = Long.valueOf(project_id);
warningArticle = earlyWarningService.getWarningArticle(pageNum, userId, valueOf, openFlag);
} else {
warningArticle = earlyWarningService.getWarningArticle(pageNum, userId, null, openFlag);
}
return ResultUtil.build(200, "", warningArticle);
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转偏好页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:44 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-偏好设置", type = "查询", operation = "preference")
@GetMapping(value = "/preference")
public ModelAndView preference(ModelAndView mv, HttpServletRequest request) {
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
mv.setViewName("setting/preference");
mv.addObject("groupId", groupId);
mv.addObject("projectId", projectId);
mv.addObject("settingLeft", "preference");
return mv;
}
/**
* 根据方案id获取偏好设置信息
*/
/*@SystemControllerLog(module = "系统设置", submodule = "系统设置-偏好设置", type = "查询", operation = "getOpinionConditionByProjectId")*/
@PostMapping(value = "/getOpinionConditionByProjectId")
@ResponseBody
public String getOpinionConditionByProjectId(Long projectId) {
OpinionCondition opinionConditionByProjectId = opinionConditionService.getOpinionConditionByProjectId(projectId);
return JSON.toJSONString(opinionConditionByProjectId);
}
/**
* 保存偏好设置
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-偏好设置", type = "修改", operation = "updateOpinionCondition")
@PostMapping(value = "/updateOpinionCondition")
@ResponseBody
public String updateOpinionCondition(@RequestBody OpinionCondition opinionCondition) {
Map<String, Object> updateOpinionCondition = opinionConditionService.updateOpinionCondition(opinionCondition);
return JSON.toJSONString(updateOpinionCondition);
}
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转反馈建议页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:44 <br>
* @author: huajiancheng <br>
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-反馈建议", type = "查询", operation = "feedback")
@GetMapping(value = "/feedback")
public ModelAndView feedback(ModelAndView mv) {
mv.setViewName("setting/feedback");
mv.addObject("settingLeft", "feedback");
return mv;
}
/**
*
* @param pageNum
* @param openFlag
* @param request
* @return
*/
@PostMapping("/getSystemTitle")
public @ResponseBody
ResultUtil getSystemTitle(HttpServletRequest request,HttpSession session) {
User user = (User) session.getAttribute("User");
Map<String, String> userObj = userService.getUserById(user.getUser_id());
return ResultUtil.build(200, "", userObj);
}
}

+ 196
- 0
src/main/java/com/stonedt/intelligence/controller/UserAuthController.java View File

@@ -0,0 +1,196 @@
package com.stonedt.intelligence.controller;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.WechatConstant;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.UserService;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.WechatUtil;

@RestController
@RequestMapping(value = "/dist")
public class UserAuthController {
@Autowired
private UserService userService;
@RequestMapping("/getdata")
public ModelAndView weChat(HttpServletRequest request,HttpSession session,
@RequestParam(value = "code", required = false, defaultValue = "") String code,
@RequestParam(value = "state", required = false, defaultValue = "") String state) throws IOException {
/*System.out.println("code:"+code);*/
ModelAndView mv = new ModelAndView();
// String url = WechatConstant.AUTH_TOKEN + "appid="+WechatConstant.AppID+"&secret="+WechatConstant.AppSecret+"&code="+code+"&grant_type=authorization_code";
// String access_tokenjsonstr = MyHttpRequestUtil.HttpGet(url);
// System.out.println("access_tokenjsonstr:"+access_tokenjsonstr);
// //String access_token = JSONObject.parseObject(access_tokenjsonstr).get("access_token").toString();
// JSONObject parseObject = JSONObject.parseObject(access_tokenjsonstr);
// String openid = parseObject.get("openid").toString();
String openid = "o_IsB0wG396kjZOk6vp9Nncy2p2k";
User user = userService.selectUserByopenid(openid);
//根据open获取用户信息
String userInfo = WechatUtil.getUserInfo(openid);
JSONObject parseObject2 = JSONObject.parseObject(userInfo);
//用户关注了微信公众号且绑定了账号
if(parseObject2.containsKey("nickname")&&user!=null) {
session.setAttribute("User", user);
//4.开设了账号,绑定系统的二维码,跳转到数据监测页面
mv =new ModelAndView(new RedirectView("yqmontitor"));
return mv;
}else {
Map<String,Object> map = userService.selectUserApplyByopenid(openid);
if(map!=null) {
mv.setViewName("userapply/success");
}else {
mv.addObject("openid", openid);
mv.setViewName("userapply/apply");
}
}
//1.用户无账号,关注微信公众号
//2.用户存在账号,未关注微信公众号
//3.用户有账号,已关注了微信公众号,未绑定
//关注了微信,但是未开通账号
// if(!parseObject2.containsKey("nickname")&&user==null) {
// //跳转到绑定号码提交页面
// mv.addObject("openid", openid);
// mv.setViewName("userapply/apply");
// }
return mv;
}

/**
* 手机端跳转到数据监测页面
* @param request
* @return
* @throws IOException
*/
@RequestMapping("/monitor")
public ModelAndView view(HttpServletRequest request) throws IOException {
String authUrl = WechatUtil.authUrl("http://app.stonedt.com/dist/getdata");
System.out.println(authUrl);
return new ModelAndView(new RedirectView(authUrl));
}
@RequestMapping("/yqmontitor")
public ModelAndView yqmontitor(HttpServletRequest request) throws IOException {
ModelAndView mv = new ModelAndView();
mv.setViewName("monitor/monitor");
return mv;
}

/**
* 跳转到申请页面
* @param request
* @return
* @throws IOException
*/
@RequestMapping("/apply")
public ModelAndView yqapply(HttpServletRequest request) throws IOException {
String authUrl = WechatUtil.authUrl("http://app.stonedt.com/dist/yqapply");
System.out.println(authUrl);
return new ModelAndView(new RedirectView(authUrl));
}
@RequestMapping("/yqapply")
public ModelAndView yqapply(HttpServletRequest request,HttpSession session,
@RequestParam(value = "code", required = false, defaultValue = "") String code,
@RequestParam(value = "state", required = false, defaultValue = "") String state) throws IOException {
ModelAndView mv = new ModelAndView();
String url = WechatConstant.AUTH_TOKEN + "appid="+WechatConstant.AppID+"&secret="+WechatConstant.AppSecret+"&code="+code+"&grant_type=authorization_code";
String access_tokenjsonstr = MyHttpRequestUtil.HttpGet(url);
System.out.println("access_tokenjsonstr:"+access_tokenjsonstr);
String access_token = JSONObject.parseObject(access_tokenjsonstr).get("access_token").toString();
JSONObject parseObject = JSONObject.parseObject(access_tokenjsonstr);
String openid = parseObject.get("openid").toString();
//String openid = "o_IsB0wG396kjZOk6vp9Nncy2p2k";
User user = userService.selectUserByopenid(openid);
//根据open获取用户信息
String userInfo = WechatUtil.getUserInfo(openid);
JSONObject parseObject2 = JSONObject.parseObject(userInfo);
//用户关注了微信公众号且绑定了账号
if(parseObject2.containsKey("nickname")&&user!=null) {
//审核通过,提醒用户,是否跳转到舆情监测列表页面
//4.开设了账号,绑定系统的二维码,跳转到数据监测页面
mv =new ModelAndView(new RedirectView("yqmontitor"));
return mv;
}
Map<String,Object> map = userService.selectUserApplyByopenid(openid);
if(map!=null) {
mv.setViewName("userapply/success");
}else {
mv.addObject("openid", openid);
mv.setViewName("userapply/apply");
}
//1.用户无账号,关注微信公众号
//2.用户存在账号,未关注微信公众号
//3.用户有账号,已关注了微信公众号,未绑定
//关注了微信,但是未开通账号
// if(parseObject2.containsKey("nickname")&&user==null) {
// //跳转到绑定号码提交页面
// mv.addObject("openid", openid);
// mv.setViewName("userapply/apply");
// }
return mv;
}
@RequestMapping("/applydatainfo")
@ResponseBody
public String applydatainfo(HttpServletRequest request,@RequestParam(value = "openid", required = false, defaultValue = "")String openid
,@RequestParam(value = "name", required = false, defaultValue = "")String name
,@RequestParam(value = "telephone", required = false, defaultValue = "")String telephone
,@RequestParam(value = "industry", required = false, defaultValue = "")String industry
,@RequestParam(value = "company", required = false, defaultValue = "")String company) throws IOException {
String code = "{\"code\":200}";
try {
openid = openid.substring(1, openid.length()-1);
userService.addapply(openid,name,telephone,industry,company);
} catch (Exception e) {
code = "{\"code\":500}";
}
return code;
}
/**
* 跳转到热点数据页面
* @param request
* @return
* @throws IOException
*/
@RequestMapping("/hotdata")
public ModelAndView hotdata(HttpServletRequest request) throws IOException {
ModelAndView mv = new ModelAndView();
mv.setViewName("hot/hotpage");
return mv;
}

}

+ 137
- 0
src/main/java/com/stonedt/intelligence/controller/UserController.java View File

@@ -0,0 +1,137 @@
package com.stonedt.intelligence.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
import com.stonedt.intelligence.aop.SystemControllerLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.UserService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MD5Util;
import com.stonedt.intelligence.util.ResultUtil;
import com.stonedt.intelligence.util.SnowFlake;
import cn.hutool.core.lang.Snowflake;
/**
* description: UserController <br>
* date: 2020/4/13 10:52 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/user")
public class UserController {
@Autowired
private UserService userService;
private SnowFlake snowFlake = new SnowFlake();
/**
* description: 账号管理跳转,userid为用户的id<br>
* version: 1.0 <br>
* date: 2020/4/13 11:19 <br>
* author: objcat <br>
*
* @return
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-账号管理", type = "查询", operation = "")
@GetMapping(value = "/{userid}")
public ModelAndView skipUserManage(@PathVariable("userid") String userid, ModelAndView mv) {
mv.setViewName("setting/userCenter");
mv.addObject("userid", userid);
mv.addObject("settingLeft", "user");
return mv;
}
/**
* description: 查询个人信息<br>
* version: 1.0 <br>
* date: 2020/4/13 11:15 <br>
* author: objcat <br>
*
* @return
*/
/* @SystemControllerLog(module = "系统设置", submodule = "系统设置-账号管理", type = "查询", operation = "detail")*/
@PostMapping(value = "/detail")
public @ResponseBody
ResultUtil detail(HttpSession session) {
User user = (User) session.getAttribute("User");
Map<String, String> userObj = userService.getUserById(user.getUser_id());
return ResultUtil.build(200, "", userObj);
}
/**
* description: 修改个人密码 <br>
* version: 1.0 <br>
* date: 2020/4/13 11:25 <br>
* author: objcat <br>
*
* @return
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-账号管理", type = "修改密码", operation = "detail")
@PostMapping(value = "/edit")
public @ResponseBody
ResultUtil editUserInfo(@RequestParam("oldPassword") String oldPassword,
@RequestParam("newPassword") String newPassword, HttpSession session) {
User user = (User) session.getAttribute("User");
if (MD5Util.getMD5(oldPassword).equals(user.getPassword())) {
boolean updateUserPwdById = userService.updateUserPwdById(user.getUser_id(), MD5Util.getMD5(newPassword));
if (updateUserPwdById) {
return ResultUtil.build(200, "密码修改成功!");
} else {
return ResultUtil.build(201, "密码修改失败!");
}
} else {
return ResultUtil.build(203, "旧密码输入错误!");
}
}
/**
* postman测试添加账号 暂未拦截
*/
@SystemControllerLog(module = "系统设置", submodule = "系统设置-账号管理", type = "新增", operation = "save")
@PostMapping(value = "/save")
@ResponseBody
public String save(User user) {
long id = snowFlake.getId();
user.setCreate_time(DateUtil.nowTime());
user.setUser_id(id);
// user.setTelephone(telephone);
user.setPassword(MD5Util.getMD5(user.getPassword()));
// user.setEmail(email);
user.setEnd_login_time(DateUtil.nowTime());
user.setStatus(1);
// user.setUsername(username);
// user.setWechat_number(wechat_number);
// user.setOpenid(openid);
user.setLogin_count(0);
user.setIdentity(1);
// user.setOrganization_id(organization_id);
Boolean saveUser = userService.saveUser(user);
Map<String, Object> map = new HashMap<String, Object>();
map.put("state", saveUser);
map.put("message", "");
return JSON.toJSONString(map);
}
@SystemControllerLog(module = "获取微信二维码", submodule = "", type = "查询", operation = "")
@GetMapping(value = "/getwechatqrcode")
public @ResponseBody
ResultUtil wechatqrcode(HttpSession session) {
User user = (User) session.getAttribute("User");
Map<String, String> userObj = userService.getqrcode(user.getTelephone());
return ResultUtil.build(200, "", userObj);
}
}

+ 93
- 0
src/main/java/com/stonedt/intelligence/controller/VolumeController.java View File

@@ -0,0 +1,93 @@
package com.stonedt.intelligence.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.stonedt.intelligence.service.VolumeMonitorService;
/**
* description: 声量监测控制器 <br>
* date: 2020/4/13 15:55 <br>
* author: xiaomi <br>
* version: 1.0 <br>
*/
@Controller
@RequestMapping(value = "/volume")
public class VolumeController {
/**
* @param [mv]
* @return org.springframework.web.servlet.ModelAndView
* @description: 跳转声量监测页面 <br>
* @version: 1.0 <br>
* @date: 2020/4/13 15:58 <br>
* @author: huajiancheng <br>
*/
@Autowired
private VolumeMonitorService volumeMonitorService;
// @Autowired
// private UserUtil userUtil;
//
// @Autowired
// private ProjectService projectService;
@GetMapping(value = "")
public ModelAndView tovolume(ModelAndView mv, HttpServletRequest request) {
String groupId = request.getParameter("groupid");
String projectId = request.getParameter("projectid");
if (StringUtils.isBlank(groupId)) groupId = "";
if (StringUtils.isBlank(projectId)) projectId = "";
mv.addObject("groupId", groupId);
mv.addObject("projectId", projectId);
mv.addObject("groupid", groupId);
mv.addObject("projectid", projectId);
mv.setViewName("volume/volumeMonitor");
mv.addObject("menu", "volume");
return mv;
}
@PostMapping("/getproject")
@ResponseBody
public Map<String, Object> getproject(@RequestParam("projectid") String projectid,@RequestParam("time_period") Integer time_period,HttpServletRequest request) {
Map<String,Object> map = new HashMap<String, Object>();
map.put("project_id", projectid);
map.put("time_period", time_period);
// User user = userUtil.getuser(request);
// Long user_id = user.getUser_id();
// Map<String, Object> jsona = new HashMap<String, Object>();
// Map<String, Object> queryUserid = projectService.queryUserid(user_id);
// if (MapUtils.isEmpty(queryUserid)) {
// System.err.println(jsona+"---");
// return jsona;
// }
Map<String, Object> getproject = volumeMonitorService.getproject(map);
return getproject;
}
@PostMapping("/projectname")
@ResponseBody
public Map<String, Object> getprojectname(@RequestParam("projectid") String projectid,@RequestParam("groupId") String groupId){
Map<String,Object> hashMap = new HashMap<String, Object>();
hashMap.put("project_id", projectid);
hashMap.put("group_id", groupId);
Map<String, Object> getprojectName = volumeMonitorService.getprojectName(hashMap);
if (getprojectName != null) {
return getprojectName;
}
return new HashMap<String, Object>();
}
}

+ 41
- 0
src/main/java/com/stonedt/intelligence/controller/WechatController.java View File

@@ -0,0 +1,41 @@
package com.stonedt.intelligence.controller;
import com.stonedt.intelligence.service.WechatService;
import com.stonedt.intelligence.util.CheckoutUtil;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/monitor")
public class WechatController {
@Autowired
private WechatService wechatService;
@RequestMapping("/weChatToken")
public void weChat(HttpServletRequest request, HttpServletResponse response) throws IOException {
wechatService.dealevent(request,response);
}
}

+ 25
- 0
src/main/java/com/stonedt/intelligence/dao/AnalysisDao.java View File

@@ -0,0 +1,25 @@
package com.stonedt.intelligence.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.Analysis;
@Mapper
public interface AnalysisDao {
Analysis getAanlysisByProjectidAndTimeperiod(@Param("projectId") Long projectId,
@Param("timePeriod")Integer timePeriod);
// 历史代码
int insert(Analysis a);
Analysis getInfoByProjectid(@Param("projectid") Long projectid,
@Param("timePeriod")Integer timePeriod);
Analysis getAnalysisMonitorProjectid(@Param("projectId")Long projectId,
@Param("timePeriod")Integer timePeriod);
}

+ 13
- 0
src/main/java/com/stonedt/intelligence/dao/AnalysisQuartzDao.java View File

@@ -0,0 +1,13 @@
package com.stonedt.intelligence.dao;
import org.apache.ibatis.annotations.Mapper;
import com.stonedt.intelligence.entity.AnalysisQuartzDo;
@Mapper
public interface AnalysisQuartzDao {
Boolean updateAnalysisPopularInformation(AnalysisQuartzDo analysisQuartzDo);
Boolean updateAnalysisExceptPopularInformation(AnalysisQuartzDo analysisQuartzDo);
}

+ 23
- 0
src/main/java/com/stonedt/intelligence/dao/DatafavoriteDao.java View File

@@ -0,0 +1,23 @@
package com.stonedt.intelligence.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.stonedt.intelligence.entity.DatafavoriteEntity;

@Mapper
public interface DatafavoriteDao {

int adddata(DatafavoriteEntity favorite);

List<DatafavoriteEntity> getdatafavoriteByUser(@Param("user_id")Long user_id);

void updatedata(DatafavoriteEntity favorite);

DatafavoriteEntity selectdata(Map<String, Object> map);

}

+ 15
- 0
src/main/java/com/stonedt/intelligence/dao/DisplayBoardDao.java View File

@@ -0,0 +1,15 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import io.lettuce.core.dynamic.annotation.Param;
@Mapper
public interface DisplayBoardDao {
List<Map<String, Object>> searchDisplayBiardByUser(@Param("user_id")Long user_id);
}

+ 73
- 0
src/main/java/com/stonedt/intelligence/dao/IFullSearchDao.java View File

@@ -0,0 +1,73 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.FullPolymerization;
import com.stonedt.intelligence.entity.FullType;
import com.stonedt.intelligence.entity.FullWord;
/**
* 全文搜索数据接口
*/
@Mapper
public interface IFullSearchDao {
/**
* 获取全文搜索一级分类列表
*/
List<FullType> listFullTypeOne();
/**
* 获取所有三级分类
* @return
*/
List<FullType> listFullTypeThree();
/**
* 根据一级分类id获取全文搜索二级分类列表
* @param firstFullVal
* @return
*/
List<FullType> listFullTypeBysecond(@Param("type_one_id")Integer type_one_id);
/**
* 根据二级分类vid获取全文搜索三级分类列表
* @param type_two_id
* @return
*/
List<FullType> listFullTypeBythird(@Param("type_two_id")Integer type_two_id);
/**
* 获取聚合分类
* @return
*/
List<FullPolymerization> listFullPolymerization();
/**
* 获取全文搜索一级分类列表 通过id list
* @param idList
* @return
*/
List<FullType> listFullTypeOneByIdList(@Param("list")List<Integer> idList);
/**
* 获取用户搜索词的数量
*/
Integer getUserWordCount(@Param("userId")Long userId);
/**
* 保存用户搜索词记录
*/
Boolean saveFullWord(FullWord fullWord);
String getBreadCrumbsByFullType(Integer fulltype);
String getBreadCrumbsByPolyId(Integer polyid);
String getBreadCrumbsByOnlyId(Integer onlyid);
List<Map<String,Object>> getSearchWordById(@Param("map") Map<String,Object> map);
}

+ 30
- 0
src/main/java/com/stonedt/intelligence/dao/OpinionConditionDao.java View File

@@ -0,0 +1,30 @@
package com.stonedt.intelligence.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.OpinionCondition;
import java.util.Map;
/**
*
*/
@Mapper
public interface OpinionConditionDao {
OpinionCondition getOpinionConditionByProjectId(@Param("projectId")Long projectId);
int updateOpinionCondition(OpinionCondition opinionCondition);
int addOpinionConditionById(@Param("map") Map<String,Object> map);
Integer updateOpinionConditionByMap(@Param("map") Map<String,Object> map);
Integer updateOpinionConditionById(@Param("map") Map<String,Object> map);
Map<String,Object> getOpinionConditionById(@Param("map") Map<String,Object> map);
}

+ 64
- 0
src/main/java/com/stonedt/intelligence/dao/ProjectDao.java View File

@@ -0,0 +1,64 @@
package com.stonedt.intelligence.dao;
import org.apache.ibatis.annotations.Mapper;
import com.stonedt.intelligence.entity.Project;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProjectDao {
Project getProject(@Param("projectId") Long projectId);
int batchUpdateProject(@Param("userId")Long userId, @Param("list")List<Long> list);
String getProjectName(@Param("projectId") Long projectId);
Map<String,Object> getProjectByProId(@Param("projectId") Long projectId);
List<Map<String, Object>> getGroupInfoByUserId(@Param("user_id") Long user_id, @Param("del_status") Integer del_status);
List<Map<String,Object>> getProjectInfoByGroupIdAndUserId(@Param("map") Map<String,Object> map);
List<Project> getInfoByGroupId(Long groupId);
int insertProject(Project p);
List<Map<String,Object>> getProjectAndGroupInfoByUserId(@Param("map") Map<String,Object> map);
List<Project> listProjects();
Map<String,Object> getProjectByProjectId(@Param("map") Map<String,Object> map);
int timingProject(Map<String, Object> map);//声量监测
Integer delProject(@Param("map") Map<String,Object> map);
Integer editProjectInfo(@Param("map") Map<String,Object> map);
Integer getProjectCount(@Param("map") Map<String,Object> map);
List<Project> listProjectByGroupId(@Param("groupId")Long groupId);
Map<String,Object> getProjectInfo(@Param("map") Map<String,Object> map);
Map<String,Object> queryUserid(Long user_id);
Map<String,Object> getGroupNameById(@Param("map") Map<String,Object> map);
Integer getProjectCountByGroupId(@Param("groupId")Long groupId);
List<Map<String,Object>> getAllKeywords();
Map<String,Object> getProjectInfoById(@Param("map") Map<String,Object> map);
Integer getProjectCountById(@Param("map") Map<String,Object> map);
List<Map<String, Object>> getprojectByUser2(@Param("user_id")Long user_id, @Param("type")Integer type);
List<String> getKeywordsByUser2(@Param("user_id")Long user_id, @Param("type")Integer type);
}

+ 29
- 0
src/main/java/com/stonedt/intelligence/dao/ProjectTaskDao.java View File

@@ -0,0 +1,29 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.ProjectTask;
/**
*
* @date 2020年4月30日 上午11:41:58
*/
@Mapper
public interface ProjectTaskDao {
List<ProjectTask> listProjectTaskByAnalysisFlag();
Boolean updateProjectTaskAnalysisFlag(@Param("projectId")Long projectId);
List<ProjectTask> listProjectTaskByVolumeFlag();
Boolean updateProjectTaskVolumeFlag(@Param("projectId")Long projectId);
Boolean saveProjectTask(ProjectTask projectTask);
Boolean updateProjectTaskAnalysisToUnDealFlag(@Param("projectId") long projectId);
}

+ 57
- 0
src/main/java/com/stonedt/intelligence/dao/PublicOptionDao.java View File

@@ -0,0 +1,57 @@
package com.stonedt.intelligence.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.stonedt.intelligence.entity.PublicoptionDetailEntity;
import com.stonedt.intelligence.entity.PublicoptionEntity;
@Mapper
public interface PublicOptionDao {

List<PublicoptionEntity> getlist(@Param("user_id")Long user_id, @Param("searchkeyword")String searchkeyword);

PublicoptionEntity getdatabyid(Map<String, Object> mapParam);
PublicoptionEntity getdatabyid2(Integer id);

int updatedatabyid(PublicoptionEntity publicoption);

int addpublicoptiondata(PublicoptionEntity publicoption);


Integer DeleteupinfoByIds(Map<String, Object> delParam);

List<PublicoptionDetailEntity> getdetail(Map<String, Object> mapParam);

List<PublicoptionEntity> getUnfinishedPublicoptionevent();

void updateStatusbyid(@Param("id")Integer id, @Param("status")Integer status);

void savepublicoptionDetail(Map<String, Object> map);

List<PublicoptionEntity> getpublicoptionreportlist(Long user_id, String searchkeyword);

String getBackAnalysisById(Integer id);

String getEventContextById(Integer id);

String getEventTraceById(Integer id);

String getHotAnalysisById(Integer id);

String getNetizensAnalysisById(Integer id);

String getStatisticsById(Integer id);

String getPropagationAnalysisById(Integer id);

String getThematicAnalysisById(Integer id);

String getUnscrambleContentById(Integer id);

List<Map<String, Object>> getpublicoptionnetizensAnalysisData(@Param("user_id")Long user_id);
}

+ 32
- 0
src/main/java/com/stonedt/intelligence/dao/ReportCustomDao.java View File

@@ -0,0 +1,32 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.ReportCustom;
/**
*
*/
@Mapper
public interface ReportCustomDao {
List<ReportCustom> listReportCustom(@Param("reportType")Integer reportType,
@Param("projectId")Long projectId, @Param("nameSearch")String nameSearch);
int saveReportCustom(ReportCustom reportCustom);
List<ReportCustom> listReportCustomByStatus(@Param("report_status")Integer report_status);
int updateReportCustomStatus(ReportCustom reportCustom);
int batchUpdateReportCustom(@Param("userId")Long userId, @Param("list")List<Long> list);
int batchUpdateReportCustomStatus(@Param("userId")long userId, @Param("reportId")String reportId);
List<Map<String, Object>> searchReportByUserAndType2(@Param("user_id")Long user_id, @Param("report_type")Integer report_type);
}

+ 18
- 0
src/main/java/com/stonedt/intelligence/dao/ReportDetailDao.java View File

@@ -0,0 +1,18 @@
package com.stonedt.intelligence.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.ReportDetail;
/**
*
*/
@Mapper
public interface ReportDetailDao {
int saveReportDetail(ReportDetail reportDetail);
ReportDetail getReportDetail(@Param("reportId")Long reportId);
}

+ 37
- 0
src/main/java/com/stonedt/intelligence/dao/SolutionGroupDao.java View File

@@ -0,0 +1,37 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.SolutionGroup;
@Mapper
public interface SolutionGroupDao {
String getGroupName(@Param("groupId") Long groupId);
Integer getGroupCount(@Param("sg") SolutionGroup sg);
int addSolutionGroup(SolutionGroup sg);
Integer editSolutionGroup(@Param("sg") SolutionGroup sg);
SolutionGroup getSolutionByGroupId(String group_id);
int updateSolutionGroupById(SolutionGroup sg);
int deleteById(int id);
List<SolutionGroup> getAllInfo();
SolutionGroup getFirstInfo();
List<SolutionGroup> listSolutionGroupByUserId(@Param("userId")Long userId);
Boolean updateSolutionGroupStatus(@Param("groupId") Long groupId);
Map<String, Object> getGroupNameByprojectId(@Param("projectid") String projectid);
}

+ 13
- 0
src/main/java/com/stonedt/intelligence/dao/SynthesizeDao.java View File

@@ -0,0 +1,13 @@
package com.stonedt.intelligence.dao;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface SynthesizeDao {
void insertSynthesize(@Param("map")Map<String, Object> map);
}

+ 78
- 0
src/main/java/com/stonedt/intelligence/dao/SystemDao.java View File

@@ -0,0 +1,78 @@

package com.stonedt.intelligence.dao;
/**
* <p></p>
* <p>Title: SystemDao</p>
* <p>Description: </p>
* @author Mapeng
* @date Apr 16, 2020
*/

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.stonedt.intelligence.entity.WarningSetting;


@Mapper
public interface SystemDao {
WarningSetting getWarningByProjectid(@Param("projectId")Long projectId);

List<WarningSetting> listWarning(@Param("userId")Long userId, @Param("group_id")Long group_id);
List<WarningSetting> listWarningMsg();
boolean updateWarningStatusById(@Param(value = "warning_status")Integer warning_status, @Param(value = "project_id")Long project_id);

WarningSetting getWarningWord( @Param(value = "project_id")Long project_id);

WarningSetting getWarningByProjectId(@Param(value = "project_id")Long project_id);
boolean updateWarning(WarningSetting warningSetting);
boolean saveWarningPopup(Map<String, Object> warning_popup);
List<Map<String, Object>> getWarningArticle(@Param("user_id")Long user_id, @Param("project_id")Long project_id,
@Param("openFlag")Integer openFlag);
boolean updateWarningArticle(@Param("article_id")String article_id,@Param("user_id")Long user_id);

Integer addWarning(@Param("map") Map<String,Object> map);

boolean updateWordWarningStatusById(Integer warning_status, Long id);




int deleteWordWarning(@Param("id")Long id);

boolean readSign(Map<String, Object> readsign);

void delReadSign(Map<String, Object> readsign);

Map<String, Object> selectReadSign(Map<String, Object> selectreadsign);


void deletekeyAttention(Integer id);



void deleteguideAssess(Integer id);

}




+ 13
- 0
src/main/java/com/stonedt/intelligence/dao/SystemLogDao.java View File

@@ -0,0 +1,13 @@
package com.stonedt.intelligence.dao;

import org.apache.ibatis.annotations.Mapper;

import com.stonedt.intelligence.entity.SystemLogEntity;


@Mapper
public interface SystemLogDao {

void addData(SystemLogEntity systemlog);

}

+ 118
- 0
src/main/java/com/stonedt/intelligence/dao/UserDao.java View File

@@ -0,0 +1,118 @@
package com.stonedt.intelligence.dao;
import com.stonedt.intelligence.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* description: 用户实现层 <br>
* date: 2020/4/14 13:54 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
@Mapper
public interface UserDao {
/**
* @param [telephone,手机号码]
* @return com.stonedt.intelligence.entity.User
* @description: 根据手机号查用户是否存在 <br>
* @version: 1.0 <br>
* @date: 2020/4/14 13:56 <br>
* @author: huajiancheng <br>
*/
User selectUserByTelephone(@Param("telephone") String telephone);
/**
* @param [map,参数列表,手机号,登录次数等]
* @return java.lang.Integer
* @description: updateUserLoginCountByPhone <br>
* @version: 1.0 <br>
* @date: 2020/4/14 13:56 <br>
* @author: huajiancheng <br>
*/
Integer updateUserLoginCountByPhone(@Param("map") Map<String, Object> map);
/**
* 查询用户信息
* @param user_id
* @return
*/
Map<String, String> getUserById(@Param("user_id")Long user_id);
/**
* 修改密码
* @param user_id
* @param password
* @return
*/
boolean updateUserPwdById(@Param("user_id")Long user_id,@Param("password")String password);
boolean updateUseropenidById(@Param("user_id")Long user_id,@Param("openid")String openid);
Boolean saveUser(User user);
boolean updateUseropenidstatusById(@Param("openid")String openid);
/**
* 获取绑定微信公众号的用户列表
* @return
*/
List<User> getUserByWechatUser();
List<User> getAllUser();
boolean addticket(@Param("telephone")String telephone, @Param("ticket")String ticket);
Map<String, String> getqrcode(@Param("telephone")String telephone);
User selectUserByopenid(@Param("openid")String openid);
/**
* 申请试用
* @param openid
* @param name
* @param telephone
* @param industry
* @param company
* @return
*/
int addapply(@Param("openid")String openid, @Param("name")String name, @Param("telephone")String telephone,
@Param("industry")String industry,
@Param("company")String company);
/**
* 判断当前用户是否已经申请过
* @param openid
* @return
*/
Map<String, Object> selectUserApplyByopenid(@Param("openid")String openid);
List<Map<String, Object>> getUserByorganizationid(@Param("id")Integer id);
Map<String, Object> getUserInfoById(@Param("user_id")Long user_id);
void updateOnline(User user);
void setAlloffline();
List<Map<String, Object>> getAllcommentator(@Param("user_id")Long user_id);
List<User> getAllUserNotDelete();
Map<String, Object> onlinestatistical(@Param("user_id")Long user_id);
void updateLoginFailCountAndTime(Map<String, Object> mapParam);
void editIs_change_pas(Long userId);
void updateEndLoginTime(Long userId);
}

+ 24
- 0
src/main/java/com/stonedt/intelligence/dao/UserLogDao.java View File

@@ -0,0 +1,24 @@
package com.stonedt.intelligence.dao;
import com.stonedt.intelligence.entity.SysLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* description: UserLogDao <br>
* date: 2020/5/9 14:49 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
@Mapper
public interface UserLogDao {
Integer saveUserLog(SysLog sysLog);
Map<String, Object> getUserOrganizationById(@Param("map") Map<String, Object> map);
Map<String, Object> getMoudleByName(@Param("module_name") String module_name);
Map<String, Object> getSubMoudleByName(@Param("submodule_name") String module_name);
}

+ 24
- 0
src/main/java/com/stonedt/intelligence/dao/VolumeMonitorDao.java View File

@@ -0,0 +1,24 @@
package com.stonedt.intelligence.dao;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.stonedt.intelligence.entity.VolumeMonitor;
/**
* @author 作者 ZouFangHao:
* @version 创建时间:2020年4月15日 下午5:29:15
* 类说明
*/
@Mapper
public interface VolumeMonitorDao {
VolumeMonitor getproject(Map<String, Object> map);
Map<String, Object> getprojectName(Map<String, Object> map);
}

+ 17
- 0
src/main/java/com/stonedt/intelligence/dao/WarningarticleDao.java View File

@@ -0,0 +1,17 @@
package com.stonedt.intelligence.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.stonedt.intelligence.entity.AnalysisQuartzDo;
import io.lettuce.core.dynamic.annotation.Param;
@Mapper
public interface WarningarticleDao {
List<Map<String, Object>> selectWAlsitByUser(@Param("user_id")Long user_id);
}

+ 323
- 0
src/main/java/com/stonedt/intelligence/entity/Analysis.java View File

@@ -0,0 +1,323 @@
package com.stonedt.intelligence.entity;
import java.util.Date;
public class Analysis {
private Integer id;
private String create_time;
private Long analysis_id;
private Long project_id;
private Integer time_period;
private String data_overview;
private String relative_news;
private String emotional_proportion;
private String plan_word_hit;
private String keyword_emotion_trend;
private String hot_event_ranking;
private String highword_cloud;
private String keyword_index;
private String media_activity_analysis;
private String hot_spot_ranking;
private String data_source_distribution;
private String data_source_analysis;
private String keyword_exposure_rank;
private String selfmedia_volume_rank;
private String ner;
private String category_rank;
private String industrial_distribution;//行业分布统计
private String event_statistics;//事件统计
public String getCategory_rank() {
return category_rank;
}
public void setCategory_rank(String category_rank) {
this.category_rank = category_rank;
}
private Date CreateTime;
private String updateTime;
private Long AnalysisId;
public Analysis() {
super();
// TODO Auto-generated constructor stub
}
private Long ProjectId;
private String RelativeNews;
private String KeywordIndex;
private String EmotionalProportion;
private String PlanWordHit;
private String PopularInformation;
private String PopularEvent;
private String HotCompany;
private String HotPeople;
private String HotSpot;
private Integer TimePeriod;
private String keyword_emotion_statistical;
public String getNer() {
return ner;
}
public void setNer(String ner) {
this.ner = ner;
}
public String getSelfmedia_volume_rank() {
return selfmedia_volume_rank;
}
public void setSelfmedia_volume_rank(String selfmedia_volume_rank) {
this.selfmedia_volume_rank = selfmedia_volume_rank;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getAnalysis_id() {
return analysis_id;
}
public void setAnalysis_id(Long analysis_id) {
this.analysis_id = analysis_id;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getTime_period() {
return time_period;
}
public void setTime_period(Integer time_period) {
this.time_period = time_period;
}
public String getData_overview() {
return data_overview;
}
public void setData_overview(String data_overview) {
this.data_overview = data_overview;
}
public String getRelative_news() {
return relative_news;
}
public void setRelative_news(String relative_news) {
this.relative_news = relative_news;
}
public String getEmotional_proportion() {
return emotional_proportion;
}
public void setEmotional_proportion(String emotional_proportion) {
this.emotional_proportion = emotional_proportion;
}
public String getPlan_word_hit() {
return plan_word_hit;
}
public void setPlan_word_hit(String plan_word_hit) {
this.plan_word_hit = plan_word_hit;
}
public String getKeyword_index() {
return keyword_index;
}
public void setKeyword_index(String keyword_index) {
this.keyword_index = keyword_index;
}
public String getMedia_activity_analysis() {
return media_activity_analysis;
}
public void setMedia_activity_analysis(String media_activity_analysis) {
this.media_activity_analysis = media_activity_analysis;
}
public String getHot_spot_ranking() {
return hot_spot_ranking;
}
public void setHot_spot_ranking(String hot_spot_ranking) {
this.hot_spot_ranking = hot_spot_ranking;
}
public String getData_source_distribution() {
return data_source_distribution;
}
public void setData_source_distribution(String data_source_distribution) {
this.data_source_distribution = data_source_distribution;
}
public String getData_source_analysis() {
return data_source_analysis;
}
public void setData_source_analysis(String data_source_analysis) {
this.data_source_analysis = data_source_analysis;
}
public String getKeyword_exposure_rank() {
return keyword_exposure_rank;
}
public void setKeyword_exposure_rank(String keyword_exposure_rank) {
this.keyword_exposure_rank = keyword_exposure_rank;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCreateTime() {
return CreateTime;
}
public void setCreateTime(Date createTime) {
CreateTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public Long getAnalysisId() {
return AnalysisId;
}
public void setAnalysisId(Long analysisId) {
AnalysisId = analysisId;
}
public Long getProjectId() {
return ProjectId;
}
public void setProjectId(Long projectId) {
ProjectId = projectId;
}
public String getRelativeNews() {
return RelativeNews;
}
public void setRelativeNews(String relativeNews) {
RelativeNews = relativeNews;
}
public String getKeywordIndex() {
return KeywordIndex;
}
public void setKeywordIndex(String keywordIndex) {
KeywordIndex = keywordIndex;
}
public String getEmotionalProportion() {
return EmotionalProportion;
}
public void setEmotionalProportion(String emotionalProportion) {
EmotionalProportion = emotionalProportion;
}
public String getPlanWordHit() {
return PlanWordHit;
}
public void setPlanWordHit(String planWordHit) {
PlanWordHit = planWordHit;
}
public String getPopularInformation() {
return PopularInformation;
}
public void setPopularInformation(String popularInformation) {
PopularInformation = popularInformation;
}
public String getPopularEvent() {
return PopularEvent;
}
public void setPopularEvent(String popularEvent) {
PopularEvent = popularEvent;
}
public String getHotCompany() {
return HotCompany;
}
public void setHotCompany(String hotCompany) {
HotCompany = hotCompany;
}
public String getHotPeople() {
return HotPeople;
}
public void setHotPeople(String hotPeople) {
HotPeople = hotPeople;
}
public String getHotSpot() {
return HotSpot;
}
public void setHotSpot(String hotSpot) {
HotSpot = hotSpot;
}
public Integer getTimePeriod() {
return TimePeriod;
}
public void setTimePeriod(Integer timePeriod) {
TimePeriod = timePeriod;
}
public String getKeyword_emotion_trend() {
return keyword_emotion_trend;
}
public void setKeyword_emotion_trend(String keyword_emotion_trend) {
this.keyword_emotion_trend = keyword_emotion_trend;
}
public String getKeyword_emotion_statistical() {
return keyword_emotion_statistical;
}
public void setKeyword_emotion_statistical(String keyword_emotion_statistical) {
this.keyword_emotion_statistical = keyword_emotion_statistical;
}
public String getHot_event_ranking() {
return hot_event_ranking;
}
public void setHot_event_ranking(String hot_event_ranking) {
this.hot_event_ranking = hot_event_ranking;
}
public String getHighword_cloud() {
return highword_cloud;
}
public void setHighword_cloud(String highword_cloud) {
this.highword_cloud = highword_cloud;
}
public String getIndustrial_distribution() {
return industrial_distribution;
}
public void setIndustrial_distribution(String industrial_distribution) {
this.industrial_distribution = industrial_distribution;
}
public String getEvent_statistics() {
return event_statistics;
}
public void setEvent_statistics(String event_statistics) {
this.event_statistics = event_statistics;
}
public Analysis(Integer id, String create_time, Long analysis_id, Long project_id, Integer time_period,
String data_overview, String relative_news, String emotional_proportion, String plan_word_hit,
String keyword_emotion_trend, String hot_event_ranking, String highword_cloud, String keyword_index,
String media_activity_analysis, String hot_spot_ranking, String data_source_distribution,
String data_source_analysis, String keyword_exposure_rank, String selfmedia_volume_rank, String ner, String category_rank) {
super();
this.id = id;
this.create_time = create_time;
this.analysis_id = analysis_id;
this.project_id = project_id;
this.time_period = time_period;
this.data_overview = data_overview;
this.relative_news = relative_news;
this.emotional_proportion = emotional_proportion;
this.plan_word_hit = plan_word_hit;
this.keyword_emotion_trend = keyword_emotion_trend;
this.hot_event_ranking = hot_event_ranking;
this.highword_cloud = highword_cloud;
this.keyword_index = keyword_index;
this.media_activity_analysis = media_activity_analysis;
this.hot_spot_ranking = hot_spot_ranking;
this.data_source_distribution = data_source_distribution;
this.data_source_analysis = data_source_analysis;
this.keyword_exposure_rank = keyword_exposure_rank;
this.selfmedia_volume_rank = selfmedia_volume_rank;
this.ner = ner;
this.category_rank = category_rank;
}
}

+ 237
- 0
src/main/java/com/stonedt/intelligence/entity/AnalysisQuartzDo.java View File

@@ -0,0 +1,237 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
public class AnalysisQuartzDo implements Serializable {
private static final long serialVersionUID = 7689436409703760069L;
private Integer id;
private String create_time;
private Long analysis_id;
private Long project_id;
private Integer time_period;
private String data_overview;
private String emotional_proportion;
private String plan_word_hit;
private String keyword_emotion_trend;
private String hot_event_ranking;
private String highword_cloud;
private String keyword_index;
private String media_activity_analysis;
private String hot_spot_ranking;
private String data_source_distribution;
private String data_source_analysis;
private String keyword_exposure_rank;
private String selfmedia_volume_rank;
private String ner;// 实体
private String category_rank;//分类统计
private String industrial_distribution;//行业分布
private String event_statistics;//事件统计
private String relative_news;
private String popular_information;
private String popular_event;
private String hot_company;
private String hot_people;
private String hot_spot;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getAnalysis_id() {
return analysis_id;
}
public void setAnalysis_id(Long analysis_id) {
this.analysis_id = analysis_id;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getTime_period() {
return time_period;
}
public void setTime_period(Integer time_period) {
this.time_period = time_period;
}
public String getData_overview() {
return data_overview;
}
public void setData_overview(String data_overview) {
this.data_overview = data_overview;
}
public String getEmotional_proportion() {
return emotional_proportion;
}
public void setEmotional_proportion(String emotional_proportion) {
this.emotional_proportion = emotional_proportion;
}
public String getPlan_word_hit() {
return plan_word_hit;
}
public void setPlan_word_hit(String plan_word_hit) {
this.plan_word_hit = plan_word_hit;
}
public String getKeyword_emotion_trend() {
return keyword_emotion_trend;
}
public void setKeyword_emotion_trend(String keyword_emotion_trend) {
this.keyword_emotion_trend = keyword_emotion_trend;
}
public String getHot_event_ranking() {
return hot_event_ranking;
}
public void setHot_event_ranking(String hot_event_ranking) {
this.hot_event_ranking = hot_event_ranking;
}
public String getHighword_cloud() {
return highword_cloud;
}
public void setHighword_cloud(String highword_cloud) {
this.highword_cloud = highword_cloud;
}
public String getKeyword_index() {
return keyword_index;
}
public void setKeyword_index(String keyword_index) {
this.keyword_index = keyword_index;
}
public String getMedia_activity_analysis() {
return media_activity_analysis;
}
public void setMedia_activity_analysis(String media_activity_analysis) {
this.media_activity_analysis = media_activity_analysis;
}
public String getHot_spot_ranking() {
return hot_spot_ranking;
}
public void setHot_spot_ranking(String hot_spot_ranking) {
this.hot_spot_ranking = hot_spot_ranking;
}
public String getData_source_distribution() {
return data_source_distribution;
}
public void setData_source_distribution(String data_source_distribution) {
this.data_source_distribution = data_source_distribution;
}
public String getData_source_analysis() {
return data_source_analysis;
}
public void setData_source_analysis(String data_source_analysis) {
this.data_source_analysis = data_source_analysis;
}
public String getKeyword_exposure_rank() {
return keyword_exposure_rank;
}
public void setKeyword_exposure_rank(String keyword_exposure_rank) {
this.keyword_exposure_rank = keyword_exposure_rank;
}
public String getSelfmedia_volume_rank() {
return selfmedia_volume_rank;
}
public void setSelfmedia_volume_rank(String selfmedia_volume_rank) {
this.selfmedia_volume_rank = selfmedia_volume_rank;
}
public String getNer() {
return ner;
}
public void setNer(String ner) {
this.ner = ner;
}
public String getRelative_news() {
return relative_news;
}
public void setRelative_news(String relative_news) {
this.relative_news = relative_news;
}
public String getPopular_information() {
return popular_information;
}
public void setPopular_information(String popular_information) {
this.popular_information = popular_information;
}
public String getPopular_event() {
return popular_event;
}
public void setPopular_event(String popular_event) {
this.popular_event = popular_event;
}
public String getHot_company() {
return hot_company;
}
public void setHot_company(String hot_company) {
this.hot_company = hot_company;
}
public String getHot_people() {
return hot_people;
}
public void setHot_people(String hot_people) {
this.hot_people = hot_people;
}
public String getHot_spot() {
return hot_spot;
}
public void setHot_spot(String hot_spot) {
this.hot_spot = hot_spot;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getCategory_rank() {
return category_rank;
}
public void setCategory_rank(String category_rank) {
this.category_rank = category_rank;
}
public String getIndustrial_distribution() {
return industrial_distribution;
}
public void setIndustrial_distribution(String industrial_distribution) {
this.industrial_distribution = industrial_distribution;
}
public String getEvent_statistics() {
return event_statistics;
}
public void setEvent_statistics(String event_statistics) {
this.event_statistics = event_statistics;
}
}

+ 106
- 0
src/main/java/com/stonedt/intelligence/entity/DataMonitorVO.java View File

@@ -0,0 +1,106 @@
package com.stonedt.intelligence.entity;
import java.util.List;
/**
*
* @author ZhaoHengxing
* @date 2019年9月10日 下午2:43:03
*/
public class DataMonitorVO {
private String article_public_id;
private String title;
private String publish_time;
private String content;
private String related_words;
private String key_words;
private String emotionalIndex;
private String sourcewebsitename;
private String similarvolume;
private String source_url;
private String vedioUrl;
private List<String> imglist;
private String videoorientationurl;
public String getVideoorientationurl() {
return videoorientationurl;
}
public void setVideoorientationurl(String videoorientationurl) {
this.videoorientationurl = videoorientationurl;
}
public String getVedioUrl() {
return vedioUrl;
}
public void setVedioUrl(String vedioUrl) {
this.vedioUrl = vedioUrl;
}
public List<String> getImglist() {
return imglist;
}
public void setImglist(List<String> imglist) {
this.imglist = imglist;
}
public String getArticle_public_id() {
return article_public_id;
}
public void setArticle_public_id(String article_public_id) {
this.article_public_id = article_public_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPublish_time() {
return publish_time;
}
public void setPublish_time(String publish_time) {
this.publish_time = publish_time;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getRelated_words() {
return related_words;
}
public void setRelated_words(String related_words) {
this.related_words = related_words;
}
public String getKey_words() {
return key_words;
}
public void setKey_words(String key_words) {
this.key_words = key_words;
}
public String getEmotionalIndex() {
return emotionalIndex;
}
public void setEmotionalIndex(String emotionalIndex) {
this.emotionalIndex = emotionalIndex;
}
public String getSourcewebsitename() {
return sourcewebsitename;
}
public void setSourcewebsitename(String sourcewebsitename) {
this.sourcewebsitename = sourcewebsitename;
}
public String getSimilarvolume() {
return similarvolume;
}
public void setSimilarvolume(String similarvolume) {
this.similarvolume = similarvolume;
}
public String getSource_url() {
return source_url;
}
public void setSource_url(String source_url) {
this.source_url = source_url;
}
}

+ 18
- 0
src/main/java/com/stonedt/intelligence/entity/DatafavoriteEntity.java View File

@@ -0,0 +1,18 @@
package com.stonedt.intelligence.entity;

import lombok.Data;
@Data
public class DatafavoriteEntity {
private int id;
private String title;
private String article_public_id;
private String publish_time;
private Long user_id;
private String favoritetime;
private int status;
private int emotionalIndex;
private Long projectid;
private Long groupid;
private String source_name;
}

+ 72
- 0
src/main/java/com/stonedt/intelligence/entity/FullPolymerization.java View File

@@ -0,0 +1,72 @@

package com.stonedt.intelligence.entity;

import java.io.Serializable;

/**
* <p>聚合分类菜单</p>
* <p>Title: FullPolymerization</p>
* <p>Description: </p>
* @author Mapeng
* @date Jul 6, 2020
*/

public class FullPolymerization implements Serializable{

/**
*
*/
private static final long serialVersionUID = 1L;
private Integer id;
private String create_time;
private Integer type;
private String name;
private String value;
private String icon;
private Integer is_show;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getIs_show() {
return is_show;
}
public void setIs_show(Integer is_show) {
this.is_show = is_show;
}
}

+ 75
- 0
src/main/java/com/stonedt/intelligence/entity/FullType.java View File

@@ -0,0 +1,75 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* 全文搜索分类菜单实体
*/
public class FullType implements Serializable{
private static final long serialVersionUID = -5086646339123925205L;
private Integer id;
private Integer only_id;
private String create_time;
private Integer type;
private String name;
private String value;
private Integer type_one_id;
private Integer type_two_id;
private String icon;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOnly_id() {
return only_id;
}
public void setOnly_id(Integer only_id) {
this.only_id = only_id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getType_one_id() {
return type_one_id;
}
public void setType_one_id(Integer type_one_id) {
this.type_one_id = type_one_id;
}
public Integer getType_two_id() {
return type_two_id;
}
public void setType_two_id(Integer type_two_id) {
this.type_two_id = type_two_id;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
}

+ 41
- 0
src/main/java/com/stonedt/intelligence/entity/FullWord.java View File

@@ -0,0 +1,41 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* 全文搜索词实体
*/
public class FullWord implements Serializable{
private static final long serialVersionUID = 7223774137282862600L;
private Integer id;
private String create_time;
private Long user_id;
private String search_word;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public String getSearch_word() {
return search_word;
}
public void setSearch_word(String search_word) {
this.search_word = search_word;
}
}

+ 265
- 0
src/main/java/com/stonedt/intelligence/entity/OpinionCondition.java View File

@@ -0,0 +1,265 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* 偏好设置实体类
*/
public class OpinionCondition implements Serializable{
private static final long serialVersionUID = 8839974637709449961L;
private Integer id;
private String create_time;
private Long opinion_condition_id;
private Long project_id;
private Integer time;
private Integer precise;
private String emotion;
private Integer similar;
private Integer sort;
private Integer matchs;
private String times;
private String timee;
private String classify;//数据来源
private String websitename;/*网站名称*/
private String author;/*作者名称*/
private String organization;/*涉及机构*/
private String categorylable;/*文章分类*/
private String enterprisetype;/*涉及企业*/
private String hightechtype;/*高科技型企业*/
private String policylableflag;/*涉及政策*/
private String datasource_type;/*数据品类*/
private String eventIndex;/*涉及事件*/
private String industryIndex;/*涉及行业*/
private String province;/*涉及省份*/
private String city;/*涉及城市*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getTimes() {
return times;
}
public void setTimes(String times) {
this.times = times;
}
public String getTimee() {
return timee;
}
public void setTimee(String timee) {
this.timee = timee;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getOpinion_condition_id() {
return opinion_condition_id;
}
public void setOpinion_condition_id(Long opinion_condition_id) {
this.opinion_condition_id = opinion_condition_id;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getTime() {
return time;
}
public void setTime(Integer time) {
this.time = time;
}
public Integer getPrecise() {
return precise;
}
public void setPrecise(Integer precise) {
this.precise = precise;
}
public String getEmotion() {
return emotion;
}
public void setEmotion(String emotion) {
this.emotion = emotion;
}
public Integer getSimilar() {
return similar;
}
public void setSimilar(Integer similar) {
this.similar = similar;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getMatchs() {
return matchs;
}
public void setMatchs(Integer matchs) {
this.matchs = matchs;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getWebsitename() {
return websitename;
}
public void setWebsitename(String websitename) {
this.websitename = websitename;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization;
}
public String getCategorylable() {
return categorylable;
}
public void setCategorylable(String categorylable) {
this.categorylable = categorylable;
}
public String getEnterprisetype() {
return enterprisetype;
}
public void setEnterprisetype(String enterprisetype) {
this.enterprisetype = enterprisetype;
}
public String getHightechtype() {
return hightechtype;
}
public void setHightechtype(String hightechtype) {
this.hightechtype = hightechtype;
}
public String getPolicylableflag() {
return policylableflag;
}
public void setPolicylableflag(String policylableflag) {
this.policylableflag = policylableflag;
}
public String getDatasource_type() {
return datasource_type;
}
public void setDatasource_type(String datasource_type) {
this.datasource_type = datasource_type;
}
public String getEventIndex() {
return eventIndex;
}
public void setEventIndex(String eventIndex) {
this.eventIndex = eventIndex;
}
public String getIndustryIndex() {
return industryIndex;
}
public void setIndustryIndex(String industryIndex) {
this.industryIndex = industryIndex;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}

+ 115
- 0
src/main/java/com/stonedt/intelligence/entity/Project.java View File

@@ -0,0 +1,115 @@
package com.stonedt.intelligence.entity;
import java.util.Date;
public class Project {
private Integer id;
private Date createTime;
private Long projectId;
private String projectName;
private Date updateTime;
private Integer projectType;
private String projectDescription;
private String subjectWord;
private String characterWord;
private String eventWord;
private String regionalWord;
private String stopWord;
private Integer delStatus;
private Long groupId;
private Long userId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getProjectType() {
return projectType;
}
public void setProjectType(Integer projectType) {
this.projectType = projectType;
}
public String getProjectDescription() {
return projectDescription;
}
public void setProjectDescription(String projectDescription) {
this.projectDescription = projectDescription;
}
public String getSubjectWord() {
return subjectWord;
}
public void setSubjectWord(String subjectWord) {
this.subjectWord = subjectWord;
}
public String getCharacterWord() {
return characterWord;
}
public void setCharacterWord(String characterWord) {
this.characterWord = characterWord;
}
public String getEventWord() {
return eventWord;
}
public void setEventWord(String eventWord) {
this.eventWord = eventWord;
}
public String getRegionalWord() {
return regionalWord;
}
public void setRegionalWord(String regionalWord) {
this.regionalWord = regionalWord;
}
public String getStopWord() {
return stopWord;
}
public void setStopWord(String stopWord) {
this.stopWord = stopWord;
}
public Integer getDelStatus() {
return delStatus;
}
public void setDelStatus(Integer delStatus) {
this.delStatus = delStatus;
}
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
}

+ 124
- 0
src/main/java/com/stonedt/intelligence/entity/ProjectTask.java View File

@@ -0,0 +1,124 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
*
* @date 2020年4月30日 上午11:39:19
*/
public class ProjectTask implements Serializable{
private static final long serialVersionUID = 146255634538848352L;
private Integer id;
private String create_time;
private Long project_id;
private Integer project_type;
private String subject_word;
private String character_word;
private String event_word;
private String regional_word;
private String stop_word;
private Integer analysis_flag;
private Integer volume_flag;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getProject_type() {
return project_type;
}
public void setProject_type(Integer project_type) {
this.project_type = project_type;
}
public String getSubject_word() {
return subject_word;
}
public void setSubject_word(String subject_word) {
this.subject_word = subject_word;
}
public String getCharacter_word() {
return character_word;
}
public void setCharacter_word(String character_word) {
this.character_word = character_word;
}
public String getEvent_word() {
return event_word;
}
public void setEvent_word(String event_word) {
this.event_word = event_word;
}
public String getRegional_word() {
return regional_word;
}
public void setRegional_word(String regional_word) {
this.regional_word = regional_word;
}
public String getStop_word() {
return stop_word;
}
public void setStop_word(String stop_word) {
this.stop_word = stop_word;
}
public Integer getAnalysis_flag() {
return analysis_flag;
}
public void setAnalysis_flag(Integer analysis_flag) {
this.analysis_flag = analysis_flag;
}
public Integer getVolume_flag() {
return volume_flag;
}
public void setVolume_flag(Integer volume_flag) {
this.volume_flag = volume_flag;
}
}

+ 108
- 0
src/main/java/com/stonedt/intelligence/entity/PublicoptionDetailEntity.java View File

@@ -0,0 +1,108 @@
package com.stonedt.intelligence.entity;

import java.util.Date;

import lombok.Data;

public class PublicoptionDetailEntity {
private Integer id;
private Integer publicoption_id;
private String back_analysis;
private String event_context;
private String event_trace;
private String hot_analysis;
private String netizens_analysis;
private String statistics;
private String propagation_analysis;
private String thematic_analysis;
private String unscramble_content;
private Date create_time;
private Integer detail_status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPublicoption_id() {
return publicoption_id;
}
public void setPublicoption_id(Integer publicoption_id) {
this.publicoption_id = publicoption_id;
}
public String getBack_analysis() {
return back_analysis;
}
public void setBack_analysis(String back_analysis) {
this.back_analysis = back_analysis;
}
public String getEvent_context() {
return event_context;
}
public void setEvent_context(String event_context) {
this.event_context = event_context;
}
public String getEvent_trace() {
return event_trace;
}
public void setEvent_trace(String event_trace) {
this.event_trace = event_trace;
}
public String getHot_analysis() {
return hot_analysis;
}
public void setHot_analysis(String hot_analysis) {
this.hot_analysis = hot_analysis;
}
public String getNetizens_analysis() {
return netizens_analysis;
}
public void setNetizens_analysis(String netizens_analysis) {
this.netizens_analysis = netizens_analysis;
}
public String getStatistics() {
return statistics;
}
public void setStatistics(String statistics) {
this.statistics = statistics;
}
public String getPropagation_analysis() {
return propagation_analysis;
}
public void setPropagation_analysis(String propagation_analysis) {
this.propagation_analysis = propagation_analysis;
}
public String getThematic_analysis() {
return thematic_analysis;
}
public void setThematic_analysis(String thematic_analysis) {
this.thematic_analysis = thematic_analysis;
}
public String getUnscramble_content() {
return unscramble_content;
}
public void setUnscramble_content(String unscramble_content) {
this.unscramble_content = unscramble_content;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Integer getDetail_status() {
return detail_status;
}
public void setDetail_status(Integer detail_status) {
this.detail_status = detail_status;
}
@Override
public String toString() {
return "PublicoptionDetailEntity [id=" + id + ", publicoption_id=" + publicoption_id + ", back_analysis="
+ back_analysis + ", event_context=" + event_context + ", event_trace=" + event_trace
+ ", hot_analysis=" + hot_analysis + ", netizens_analysis=" + netizens_analysis + ", statistics="
+ statistics + ", propagation_analysis=" + propagation_analysis + ", thematic_analysis="
+ thematic_analysis + ", unscramble_content=" + unscramble_content + ", create_time=" + create_time
+ ", detail_status=" + detail_status + "]";
}
}

+ 109
- 0
src/main/java/com/stonedt/intelligence/entity/PublicoptionEntity.java View File

@@ -0,0 +1,109 @@
package com.stonedt.intelligence.entity;

/**
*
* @author wangyi
*
*/
public class PublicoptionEntity {
private int id;
private String eventname;//任务名称
private String eventkeywords;//任务关键词
private String eventstopwords;//任务屏蔽词
private String eventstarttime;//任务开始时间
private String eventendtime;//任务结束时间
private String createtime;//创建时间
private int status;//1.创建失败2.正在创建3.创建成功
private String updatetime;//更新时间
private Long user_id;
private String netizens_analysis;
private Integer page;
private String emotionalIndex;
public String getEmotionalIndex() {
return emotionalIndex;
}
public void setEmotionalIndex(String emotionalIndex) {
this.emotionalIndex = emotionalIndex;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
@Override
public String toString() {
return "PublicoptionEntity [id=" + id + ", eventname=" + eventname + ", eventkeywords=" + eventkeywords
+ ", eventstopwords=" + eventstopwords + ", eventstarttime=" + eventstarttime + ", eventendtime="
+ eventendtime + ", createtime=" + createtime + ", status=" + status + ", updatetime=" + updatetime
+ ", user_id=" + user_id + ", netizens_analysis=" + netizens_analysis + "]";
}
public String getNetizens_analysis() {
return netizens_analysis;
}
public void setNetizens_analysis(String netizens_analysis) {
this.netizens_analysis = netizens_analysis;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEventname() {
return eventname;
}
public void setEventname(String eventname) {
this.eventname = eventname;
}
public String getEventkeywords() {
return eventkeywords;
}
public void setEventkeywords(String eventkeywords) {
this.eventkeywords = eventkeywords;
}
public String getEventstopwords() {
return eventstopwords;
}
public void setEventstopwords(String eventstopwords) {
this.eventstopwords = eventstopwords;
}
public String getEventstarttime() {
return eventstarttime;
}
public void setEventstarttime(String eventstarttime) {
this.eventstarttime = eventstarttime;
}
public String getEventendtime() {
return eventendtime;
}
public void setEventendtime(String eventendtime) {
this.eventendtime = eventendtime;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getUpdatetime() {
return updatetime;
}
public void setUpdatetime(String updatetime) {
this.updatetime = updatetime;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}

}

+ 212
- 0
src/main/java/com/stonedt/intelligence/entity/ReportCustom.java View File

@@ -0,0 +1,212 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* 数据报告列表实体类
*/
public class ReportCustom implements Serializable{
private static final long serialVersionUID = 8128613465315245208L;
private Integer id;
private String create_time;
private Long report_id;
private String report_name;
private Integer report_type;
private String report_starttime;
private String report_endtime;
private Integer report_status;
private Integer report_topping;
private String report_time;
private Integer del_status;
private Integer number_period;
private Integer processes;
private Integer module_sum;
private Long template_id;
private String template_info;
private Long project_id;
private String keyword;
private String stopword;
private Long user_id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getReport_id() {
return report_id;
}
public void setReport_id(Long report_id) {
this.report_id = report_id;
}
public String getReport_name() {
return report_name;
}
public void setReport_name(String report_name) {
this.report_name = report_name;
}
public Integer getReport_type() {
return report_type;
}
public void setReport_type(Integer report_type) {
this.report_type = report_type;
}
public String getReport_starttime() {
return report_starttime;
}
public void setReport_starttime(String report_starttime) {
this.report_starttime = report_starttime;
}
public String getReport_endtime() {
return report_endtime;
}
public void setReport_endtime(String report_endtime) {
this.report_endtime = report_endtime;
}
public Integer getReport_status() {
return report_status;
}
public void setReport_status(Integer report_status) {
this.report_status = report_status;
}
public Integer getReport_topping() {
return report_topping;
}
public void setReport_topping(Integer report_topping) {
this.report_topping = report_topping;
}
public String getReport_time() {
return report_time;
}
public void setReport_time(String report_time) {
this.report_time = report_time;
}
public Integer getDel_status() {
return del_status;
}
public void setDel_status(Integer del_status) {
this.del_status = del_status;
}
public Integer getNumber_period() {
return number_period;
}
public void setNumber_period(Integer number_period) {
this.number_period = number_period;
}
public Integer getProcesses() {
return processes;
}
public void setProcesses(Integer processes) {
this.processes = processes;
}
public Integer getModule_sum() {
return module_sum;
}
public void setModule_sum(Integer module_sum) {
this.module_sum = module_sum;
}
public Long getTemplate_id() {
return template_id;
}
public void setTemplate_id(Long template_id) {
this.template_id = template_id;
}
public String getTemplate_info() {
return template_info;
}
public void setTemplate_info(String template_info) {
this.template_info = template_info;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getStopword() {
return stopword;
}
public void setStopword(String stopword) {
this.stopword = stopword;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
}

+ 225
- 0
src/main/java/com/stonedt/intelligence/entity/ReportDetail.java View File

@@ -0,0 +1,225 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* 数据报告详情数据实体类
*/
public class ReportDetail implements Serializable{
private static final long serialVersionUID = -6050219486204498740L;
private Integer id;
private String create_time;
private Long report_id;
private String data_overview;
private String emotion_analysis;
private String hot_event_ranking;
private String media_activity_analysis;
private String self_media_ranking;
private String high_word_index;
private String hot_spot_ranking;
private String netizen_word_cloud;
private String media_cord_cloud;
private String hot_people;
private String hot_spots;
private String topic_clustering;
private String social_v_ranking;
private String report_name;
private Integer report_type;
private String report_starttime;
private String report_endtime;
private String report_time;
private String highword_cloud;
private String keyword_index;
private String highword_cloud_index;
private String ner;
public String getNer() {
return ner;
}
public void setNer(String ner) {
this.ner = ner;
}
public String getHighword_cloud_index() {
return highword_cloud_index;
}
public void setHighword_cloud_index(String highword_cloud_index) {
this.highword_cloud_index = highword_cloud_index;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getReport_id() {
return report_id;
}
public void setReport_id(Long report_id) {
this.report_id = report_id;
}
public String getData_overview() {
return data_overview;
}
public void setData_overview(String data_overview) {
this.data_overview = data_overview;
}
public String getEmotion_analysis() {
return emotion_analysis;
}
public void setEmotion_analysis(String emotion_analysis) {
this.emotion_analysis = emotion_analysis;
}
public String getHot_event_ranking() {
return hot_event_ranking;
}
public void setHot_event_ranking(String hot_event_ranking) {
this.hot_event_ranking = hot_event_ranking;
}
public String getMedia_activity_analysis() {
return media_activity_analysis;
}
public void setMedia_activity_analysis(String media_activity_analysis) {
this.media_activity_analysis = media_activity_analysis;
}
public String getSelf_media_ranking() {
return self_media_ranking;
}
public void setSelf_media_ranking(String self_media_ranking) {
this.self_media_ranking = self_media_ranking;
}
public String getHigh_word_index() {
return high_word_index;
}
public void setHigh_word_index(String high_word_index) {
this.high_word_index = high_word_index;
}
public String getHot_spot_ranking() {
return hot_spot_ranking;
}
public void setHot_spot_ranking(String hot_spot_ranking) {
this.hot_spot_ranking = hot_spot_ranking;
}
public String getNetizen_word_cloud() {
return netizen_word_cloud;
}
public void setNetizen_word_cloud(String netizen_word_cloud) {
this.netizen_word_cloud = netizen_word_cloud;
}
public String getMedia_cord_cloud() {
return media_cord_cloud;
}
public void setMedia_cord_cloud(String media_cord_cloud) {
this.media_cord_cloud = media_cord_cloud;
}
public String getHot_people() {
return hot_people;
}
public void setHot_people(String hot_people) {
this.hot_people = hot_people;
}
public String getHot_spots() {
return hot_spots;
}
public void setHot_spots(String hot_spots) {
this.hot_spots = hot_spots;
}
public String getTopic_clustering() {
return topic_clustering;
}
public void setTopic_clustering(String topic_clustering) {
this.topic_clustering = topic_clustering;
}
public String getSocial_v_ranking() {
return social_v_ranking;
}
public void setSocial_v_ranking(String social_v_ranking) {
this.social_v_ranking = social_v_ranking;
}
public String getReport_name() {
return report_name;
}
public void setReport_name(String report_name) {
this.report_name = report_name;
}
public Integer getReport_type() {
return report_type;
}
public void setReport_type(Integer report_type) {
this.report_type = report_type;
}
public String getReport_starttime() {
return report_starttime;
}
public void setReport_starttime(String report_starttime) {
this.report_starttime = report_starttime;
}
public String getReport_endtime() {
return report_endtime;
}
public void setReport_endtime(String report_endtime) {
this.report_endtime = report_endtime;
}
public String getReport_time() {
return report_time;
}
public void setReport_time(String report_time) {
this.report_time = report_time;
}
public String getHighword_cloud() {
return highword_cloud;
}
public void setHighword_cloud(String highword_cloud) {
this.highword_cloud = highword_cloud;
}
public String getKeyword_index() {
return keyword_index;
}
public void setKeyword_index(String keyword_index) {
this.keyword_index = keyword_index;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}

+ 49
- 0
src/main/java/com/stonedt/intelligence/entity/SolutionGroup.java View File

@@ -0,0 +1,49 @@
package com.stonedt.intelligence.entity;
import java.util.Date;
public class SolutionGroup {
private Integer id;
private Date createTime;
private Long groupId;
private String groupName;
private Long userId;
private Integer delStatus;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Integer getDelStatus() {
return delStatus;
}
public void setDelStatus(Integer delStatus) {
this.delStatus = delStatus;
}
}

+ 178
- 0
src/main/java/com/stonedt/intelligence/entity/SysLog.java View File

@@ -0,0 +1,178 @@
package com.stonedt.intelligence.entity;
import java.io.Serializable;
/**
* description: SysLog <br>
* date: 2020/5/9 17:05 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
public class SysLog implements Serializable {
private String operation; // 请求名称
private String type; // 注解上的操作类型
private String article_public_id;
private Long user_id;
private String module_name;
private String submodule_name; // 子模块名称
private String method_name;
private String times;
private String timee;
private String create_time;
private String username;
private String organization_id;
private String organization_name;
private String parameters;
private String class_name;
private Integer module_id;
private Integer submodule_id;
private Integer status;
public SysLog() {
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getArticle_public_id() {
return article_public_id;
}
public void setArticle_public_id(String article_public_id) {
this.article_public_id = article_public_id;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public String getModule_name() {
return module_name;
}
public void setModule_name(String module_name) {
this.module_name = module_name;
}
public String getMethod_name() {
return method_name;
}
public void setMethod_name(String method_name) {
this.method_name = method_name;
}
public String getTimes() {
return times;
}
public void setTimes(String times) {
this.times = times;
}
public String getTimee() {
return timee;
}
public void setTimee(String timee) {
this.timee = timee;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getOrganization_id() {
return organization_id;
}
public void setOrganization_id(String organization_id) {
this.organization_id = organization_id;
}
public String getOrganization_name() {
return organization_name;
}
public void setOrganization_name(String organization_name) {
this.organization_name = organization_name;
}
public String getParameters() {
return parameters;
}
public void setParameters(String parameters) {
this.parameters = parameters;
}
public String getClass_name() {
return class_name;
}
public void setClass_name(String class_name) {
this.class_name = class_name;
}
public Integer getModule_id() {
return module_id;
}
public void setModule_id(Integer module_id) {
this.module_id = module_id;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getSubmodule_name() {
return submodule_name;
}
public void setSubmodule_name(String submodule_name) {
this.submodule_name = submodule_name;
}
public Integer getSubmodule_id() {
return submodule_id;
}
public void setSubmodule_id(Integer submodule_id) {
this.submodule_id = submodule_id;
}
}

+ 22
- 0
src/main/java/com/stonedt/intelligence/entity/SystemLogEntity.java View File

@@ -0,0 +1,22 @@
package com.stonedt.intelligence.entity;

import lombok.Data;

@Data
public class SystemLogEntity {
private int id;
private String user_browser;//用户浏览器
private Integer user_id;//用户id
private String user_browser_version;//用户浏览器版本
private String operatingSystem;//操作系统
private String username;//用户名
private String loginip;//登陆ip
private String module;//模块
private String submodule;//子模块
private String type;//类型
private String createtime;//创建时间
}

+ 148
- 0
src/main/java/com/stonedt/intelligence/entity/User.java View File

@@ -0,0 +1,148 @@
package com.stonedt.intelligence.entity;
/**
* description: 用户信息实体 <br>
* date: 2020/4/14 11:25 <br>
* author: huajiancheng <br>
* version: 1.0 <br>
*/
public class User {
private Integer id;
private String create_time;
private Long user_id;
private String telephone;
private String password;
private String email;
private String end_login_time;
private Integer status;
private String username;
private String wechat_number;
private String openid;
private Integer login_count;
private Integer identity;
private String organization_id;
private Integer isOnline;
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public User() {
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEnd_login_time() {
return end_login_time;
}
public void setEnd_login_time(String end_login_time) {
this.end_login_time = end_login_time;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getWechat_number() {
return wechat_number;
}
public void setWechat_number(String wechat_number) {
this.wechat_number = wechat_number;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public Integer getLogin_count() {
return login_count;
}
public void setLogin_count(Integer login_count) {
this.login_count = login_count;
}
public Integer getIdentity() {
return identity;
}
public void setIdentity(Integer identity) {
this.identity = identity;
}
public String getOrganization_id() {
return organization_id;
}
public void setOrganization_id(String organization_id) {
this.organization_id = organization_id;
}
}

+ 137
- 0
src/main/java/com/stonedt/intelligence/entity/VolumeMonitor.java View File

@@ -0,0 +1,137 @@
package com.stonedt.intelligence.entity;
/**
* @author 作者 ZouFangHao:
* @version 创建时间:2020年4月15日 下午5:25:32
* 类说明 声量监测实体类
*/
public class VolumeMonitor {
private Integer id;
private String create_time;
private Long volume_monitor_id;
private Long project_id;
private Integer time_period;
private String keyword_emotion_statistical;
private String keyword_source_distribution;
private String keyword_news_rank;
private String topic_cluster_analysis;
private String keyword_emotion_trend;
private String highword_cloud;
private String keyword_exposure_rank;
private String keyword_correlation_news;
private String user_portrait_label;
private String social_user_volume_rank;
private String media_user_volume_rank;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getVolume_monitor_id() {
return volume_monitor_id;
}
public void setVolume_monitor_id(Long volume_monitor_id) {
this.volume_monitor_id = volume_monitor_id;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getTime_period() {
return time_period;
}
public void setTime_period(Integer time_period) {
this.time_period = time_period;
}
public String getKeyword_emotion_statistical() {
return keyword_emotion_statistical;
}
public void setKeyword_emotion_statistical(String keyword_emotion_statistical) {
this.keyword_emotion_statistical = keyword_emotion_statistical;
}
public String getKeyword_source_distribution() {
return keyword_source_distribution;
}
public void setKeyword_source_distribution(String keyword_source_distribution) {
this.keyword_source_distribution = keyword_source_distribution;
}
public String getKeyword_news_rank() {
return keyword_news_rank;
}
public void setKeyword_news_rank(String keyword_news_rank) {
this.keyword_news_rank = keyword_news_rank;
}
public String getTopic_cluster_analysis() {
return topic_cluster_analysis;
}
public void setTopic_cluster_analysis(String topic_cluster_analysis) {
this.topic_cluster_analysis = topic_cluster_analysis;
}
public String getKeyword_emotion_trend() {
return keyword_emotion_trend;
}
public void setKeyword_emotion_trend(String keyword_emotion_trend) {
this.keyword_emotion_trend = keyword_emotion_trend;
}
public String getHighword_cloud() {
return highword_cloud;
}
public void setHighword_cloud(String highword_cloud) {
this.highword_cloud = highword_cloud;
}
public String getKeyword_exposure_rank() {
return keyword_exposure_rank;
}
public void setKeyword_exposure_rank(String keyword_exposure_rank) {
this.keyword_exposure_rank = keyword_exposure_rank;
}
public String getKeyword_correlation_news() {
return keyword_correlation_news;
}
public void setKeyword_correlation_news(String keyword_correlation_news) {
this.keyword_correlation_news = keyword_correlation_news;
}
public String getUser_portrait_label() {
return user_portrait_label;
}
public void setUser_portrait_label(String user_portrait_label) {
this.user_portrait_label = user_portrait_label;
}
public String getSocial_user_volume_rank() {
return social_user_volume_rank;
}
public void setSocial_user_volume_rank(String social_user_volume_rank) {
this.social_user_volume_rank = social_user_volume_rank;
}
public String getMedia_user_volume_rank() {
return media_user_volume_rank;
}
public void setMedia_user_volume_rank(String media_user_volume_rank) {
this.media_user_volume_rank = media_user_volume_rank;
}
@Override
public String toString() {
return "VolumeMonitor [id=" + id + ", create_time=" + create_time + ", volume_monitor_id=" + volume_monitor_id
+ ", project_id=" + project_id + ", time_period=" + time_period + ", keyword_emotion_statistical="
+ keyword_emotion_statistical + ", keyword_source_distribution=" + keyword_source_distribution
+ ", keyword_news_rank=" + keyword_news_rank + ", topic_cluster_analysis=" + topic_cluster_analysis
+ ", keyword_emotion_trend=" + keyword_emotion_trend + ", highword_cloud=" + highword_cloud
+ ", keyword_exposure_rank=" + keyword_exposure_rank + ", keyword_correlation_news="
+ keyword_correlation_news + ", user_portrait_label=" + user_portrait_label
+ ", social_user_volume_rank=" + social_user_volume_rank + ", media_user_volume_rank="
+ media_user_volume_rank + "]";
}
}

+ 160
- 0
src/main/java/com/stonedt/intelligence/entity/WarningSetting.java View File

@@ -0,0 +1,160 @@

package com.stonedt.intelligence.entity;
/**
* <p>预警信息</p>
* <p>Title: WarningSetting</p>
* <p>Description: </p>
* @author Mapeng
* @date Apr 16, 2020
*/

public class WarningSetting {

private Integer id; // 自增id;
private String create_time; // '创建时间';
private Long warning_setting_id; // '预警设置公共id';
private Long project_id; // '方案id';
private Integer warning_status; // '预警开关 ( 0:关,1:开 )';
private String warning_name; // '预警名称';
private String warning_word; // '预警词(英文逗号分隔)';
private String warning_classify; // '来源类型(1-11)(英文逗号分隔)';
private Integer warning_content; // '预警内容(0:全部 1:敏感)';
private Integer warning_similar; // '相似文章合并(0:取消合并 1:合并)';
private Integer warning_match; // '匹配方式(1:全文 2:标题 3:正文)';
private Integer warning_deduplication; // '预警去重(0:关闭 1:开启)';
private String warning_source; // '预警来源json([type]1:系统推送 2:邮箱推送 [email]:邮箱地址,可为空)';
private String warning_receive_time;// '接收时间json [start]:开始时间 [end]:结束时间';
private Integer weekend_warning; // '周末预警(0:关闭 1:开启)';
private String warning_interval; // '预警间隔json([type]1:实时预警 2:定时预警 [time]:时间,可为空)';
private String project_name; //方案名称
private String group_name; //方案组名称
private Long user_id; //用户id
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public Long getWarning_setting_id() {
return warning_setting_id;
}
public void setWarning_setting_id(Long warning_setting_id) {
this.warning_setting_id = warning_setting_id;
}
public Long getProject_id() {
return project_id;
}
public void setProject_id(Long project_id) {
this.project_id = project_id;
}
public Integer getWarning_status() {
return warning_status;
}
public void setWarning_status(Integer warning_status) {
this.warning_status = warning_status;
}
public String getWarning_name() {
return warning_name;
}
public void setWarning_name(String warning_name) {
this.warning_name = warning_name;
}
public String getWarning_word() {
return warning_word;
}
public void setWarning_word(String warning_word) {
this.warning_word = warning_word;
}
public String getWarning_classify() {
return warning_classify;
}
public void setWarning_classify(String warning_classify) {
this.warning_classify = warning_classify;
}
public Integer getWarning_content() {
return warning_content;
}
public void setWarning_content(Integer warning_content) {
this.warning_content = warning_content;
}
public Integer getWarning_similar() {
return warning_similar;
}
public void setWarning_similar(Integer warning_similar) {
this.warning_similar = warning_similar;
}
public Integer getWarning_match() {
return warning_match;
}
public void setWarning_match(Integer warning_match) {
this.warning_match = warning_match;
}
public Integer getWarning_deduplication() {
return warning_deduplication;
}
public void setWarning_deduplication(Integer warning_deduplication) {
this.warning_deduplication = warning_deduplication;
}
public String getWarning_source() {
return warning_source;
}
public void setWarning_source(String warning_source) {
this.warning_source = warning_source;
}
public String getWarning_receive_time() {
return warning_receive_time;
}
public void setWarning_receive_time(String warning_receive_time) {
this.warning_receive_time = warning_receive_time;
}
public Integer getWeekend_warning() {
return weekend_warning;
}
public void setWeekend_warning(Integer weekend_warning) {
this.weekend_warning = weekend_warning;
}
public String getWarning_interval() {
return warning_interval;
}
public void setWarning_interval(String warning_interval) {
this.warning_interval = warning_interval;
}
public String getProject_name() {
return project_name;
}
public void setProject_name(String project_name) {
this.project_name = project_name;
}
public String getGroup_name() {
return group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
@Override
public String toString() {
return "WarningSetting [id=" + id + ", create_time=" + create_time + ", warning_setting_id="
+ warning_setting_id + ", project_id=" + project_id + ", warning_status=" + warning_status
+ ", warning_name=" + warning_name + ", warning_word=" + warning_word + ", warning_classify="
+ warning_classify + ", warning_content=" + warning_content + ", warning_similar=" + warning_similar
+ ", warning_match=" + warning_match + ", warning_deduplication=" + warning_deduplication
+ ", warning_source=" + warning_source + ", warning_receive_time=" + warning_receive_time
+ ", weekend_warning=" + weekend_warning + ", warning_interval=" + warning_interval + ", project_name="
+ project_name + ", group_name=" + group_name + ", user_id=" + user_id + "]";
}
}

+ 67
- 0
src/main/java/com/stonedt/intelligence/interceptor/LoginHandlerInterceptor.java View File

@@ -0,0 +1,67 @@
package com.stonedt.intelligence.interceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 拦截器,登录检查
*
* @author Mapeng
* <p>
* Date: 2019年10月11日
*/
@Component
public class LoginHandlerInterceptor implements HandlerInterceptor {
// 目标方法执行之前
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
// Object user = request.getSession().getAttribute("User");
// // 如果获取的request的session中的loginUser参数为空(未登录),就返回登录页,否则放行访问
// if (user == null) {
// // 未登录,给出错误信息,
// request.setAttribute("msg","无权限请先登录");
// // 获取request返回页面到登录页
// response.sendRedirect(request.getContextPath() + "/login");
// return false;
// } else {
// // 已登录,放行
// return true;
// }
Object attribute = request.getSession().getAttribute("User");
if (attribute == null) {
if("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))){
// //告诉ajax我是重定向
response.setHeader("REDIRECT", "REDIRECT");
// //告诉ajax我重定向的路径
response.setHeader("CONTENTPATH", "/login");
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
}else{
response.sendRedirect(request.getContextPath() + "/login");
}
return false;
} else {
return true;
}
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// TODO Auto-generated method stub
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
// TODO Auto-generated method stub
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

+ 95
- 0
src/main/java/com/stonedt/intelligence/interceptor/WebConfigurer.java View File

@@ -0,0 +1,95 @@
package com.stonedt.intelligence.interceptor;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
* 配置
* <p>
* Date: 2019年10月11日
*/
@Configuration
public class WebConfigurer implements WebMvcConfigurer {
@Autowired
private LoginHandlerInterceptor loginInterceptor;
// 这个方法是用来配置静态资源的,比如html,js,css,等等
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
WebMvcConfigurer.super.addResourceHandlers(registry);
registry.addResourceHandler("/pdf/**")
.addResourceLocations("file:/");
}
// 这个方法用来注册拦截器,我们自己写好的拦截器需要通过这里添加注册才能生效
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor).
addPathPatterns("/**")
.excludePathPatterns("/jumpLogin", "/user/save")
.excludePathPatterns("/login","/loginredirect","/project/keywords", "/logout", "static/**","/forgotpwd", "/assets/**", "/dist/**", "/common/**","/monitor/weChatToken","/hot/**")
.excludePathPatterns("/fullsearch/listFullTypeByThird", "/fullsearch/hotList","/hot/hotpage/**");
}
/**
* @param [converters]
* @return void
* @description: 利用fastJson替换掉jackson,且解决中文乱码问题,解决Java中的long到js中精度丢失的问题 <br>
* @version: 1.0 <br>
* @date: 2020/4/15 12:43 <br>
* @author: huajiancheng <br>
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setSerializerFeatures(
SerializerFeature.DisableCircularReferenceDetect,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullNumberAsZero,
SerializerFeature.WriteNullStringAsEmpty,
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteNullBooleanAsFalse,
SerializerFeature.WriteNonStringKeyAsString,
SerializerFeature.BrowserCompatible);
//解决Long转json精度丢失的问题
SerializeConfig serializeConfig = SerializeConfig.globalInstance;
serializeConfig.put(BigInteger.class, ToStringSerializer.instance);
serializeConfig.put(Long.class, ToStringSerializer.instance);
serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
fastJsonConfig.setSerializeConfig(serializeConfig);
//处理中文乱码问题
List<MediaType> fastMediaTypes = new ArrayList<>();
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
fastConverter.setSupportedMediaTypes(fastMediaTypes);
fastConverter.setFastJsonConfig(fastJsonConfig);
converters.add(fastConverter);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/", "/monitor");
}
}

+ 3142
- 0
src/main/java/com/stonedt/intelligence/quartz/AnalysisDataRequest.java
File diff suppressed because it is too large
View File


+ 274
- 0
src/main/java/com/stonedt/intelligence/quartz/AnalysisPTQuartz.java View File

@@ -0,0 +1,274 @@
package com.stonedt.intelligence.quartz;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.dao.AnalysisQuartzDao;
import com.stonedt.intelligence.dao.ProjectTaskDao;
import com.stonedt.intelligence.entity.AnalysisQuartzDo;
import com.stonedt.intelligence.entity.ProjectTask;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.SnowFlake;
/**
* 监测分析定时任务
*/
@Component
public class AnalysisPTQuartz {
@Value("${schedule.analysispt.open}")
private Integer schedule_analysispt_open;
@Value("${insertnewwords.url}")
private String insert_new_words_url;
@Autowired
private AnalysisDataRequest analysisDataRequest;
// @Autowired
// private AnalysisService analysisService;
@Autowired
private AnalysisQuartzDao analysisQuartzDao;
@Autowired
private ProjectTaskDao projectTaskDao;
private SnowFlake snowFlake = new SnowFlake();
private final int[] timePeriod = {1, 2, 3, 4};
@Scheduled(cron = "0 0/1 * * * ?")
public void name() {
if (schedule_analysispt_open == 1) {
try {
// 定时业务逻辑
System.out.println("AnalysisPTQuartz 启动");
List<ProjectTask> listProjectTaskByAnalysisFlag = projectTaskDao.listProjectTaskByAnalysisFlag();
for (int i = 0; i < listProjectTaskByAnalysisFlag.size(); i++) {
try {
ProjectTask projectTask = listProjectTaskByAnalysisFlag.get(i);
String keyword = projectTask.getSubject_word();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = projectTask.getStop_word();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = projectTask.getCharacter_word();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = projectTask.getEvent_word();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = projectTask.getRegional_word();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = projectTask.getProject_type();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
keyword = ProjectWordUtil.CommononprojectKeyWord(keyword);
}
Long projectId = projectTask.getProject_id();
for (int j = 0; j < timePeriod.length; j++) {
try {
int time_period = timePeriod[j];
Map<String, String> timeMap = analysisDataRequest.time(time_period);
String times = timeMap.get("start");
String timee = timeMap.get("end");
AnalysisQuartzDo analysisQuartzDo = new AnalysisQuartzDo();
analysisQuartzDo.setCreate_time(DateUtil.nowTime());
analysisQuartzDo.setAnalysis_id(snowFlake.getId());
analysisQuartzDo.setProject_id(projectId);
analysisQuartzDo.setTime_period(time_period);
// 数据概览
String dataOverview = analysisDataRequest.dataOverview(projectId, highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setData_overview(dataOverview);
// 情感占比
String emotional = analysisDataRequest.emotional(highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setEmotional_proportion(emotional);
// 方案命中主体词
String fangan = analysisDataRequest.fangan(keyword, highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setPlan_word_hit(fangan);
// 关键词情感分析数据走势
String keywordsentimentFlagChart = analysisDataRequest.keywordsentimentFlagChart(keyword, highKeyword, stopword, times, timee, time_period, projectType);
analysisQuartzDo.setKeyword_emotion_trend(keywordsentimentFlagChart);
// 热点事件排名
String hotEventRanking = analysisDataRequest.hotEventRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHot_event_ranking(hotEventRanking);
// 关键词高频分布统计
String wordCloud = analysisDataRequest.wordCloud(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHighword_cloud(wordCloud);
// 高频词指数
//String keyWordIndex = analysisDataRequest.keyWordIndex(time_period, keywordsentimentFlagChart, times, timee, stopword, projectType);
String keyWordIndex = analysisDataRequest.keyWordIndex(time_period, keywordsentimentFlagChart, times, timee, stopword, projectType,wordCloud);
analysisQuartzDo.setKeyword_index(keyWordIndex);
// 媒体活跃度分析
String mediaActivityAnalysis = analysisDataRequest.mediaActivityAnalysis(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setMedia_activity_analysis(mediaActivityAnalysis);
// 热点地区排名
String hotSpotRanking = analysisDataRequest.hotSpotRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHot_spot_ranking(hotSpotRanking);
// 数据来源分布
String dataSourceDistribution = analysisDataRequest.dataSourceDistribution(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setData_source_distribution(dataSourceDistribution);
// 数据来源分析
String dataSourceAnalysis = analysisDataRequest.dataSourceAnalysis(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setData_source_analysis(dataSourceAnalysis);
// 关键词曝光度环比排行
String keywordExposure = analysisDataRequest.keywordExposure(keyword, highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setKeyword_exposure_rank(keywordExposure);
// 自媒体渠道声量排名
String selfMediaRanking = analysisDataRequest.selfMediaRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setSelfmedia_volume_rank(selfMediaRanking);
//String dataNer = analysisDataRequest.dataNer(highKeyword, stopword, times, timee, projectType);
//政策法规
String dataPolicy = analysisDataRequest.dataPolicy(highKeyword, stopword, times, timee, projectType);
//JSONObject nersjon = JSONObject.parseObject(dataNer);
JSONObject nersjon = new JSONObject();
nersjon.put("policy", JSONObject.parseObject(dataPolicy).get("policy"));
//行业分布分析
String industrialDistribution = analysisDataRequest.industrialDistribution(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setIndustrial_distribution(industrialDistribution);
//事件统计
String eventStudy = analysisDataRequest.eventStudy(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setEvent_statistics(eventStudy);
//计算统计结果
JSONObject nerdatasjon = analysisDataRequest.dataNerArticleData(highKeyword, stopword, times, timee, projectType,nersjon);
analysisQuartzDo.setNer(nerdatasjon.toJSONString());
//将统计出来的实体存储到分词词典中
// try {
// JSONObject nersjon = JSONObject.parseObject(dataNer);
//
// nersjon.put("policy", JSONObject.parseObject(dataPolicy).get("policy"));
//
// analysisQuartzDo.setNer(nersjon.toJSONString());
//
// Iterator iter = nersjon.entrySet().iterator();
// String message = "";
// while (iter.hasNext()) {
// Map.Entry entry = (Map.Entry) iter.next();
// JSONArray parseArray = JSONArray.parseArray(entry.getValue().toString());
// for (Object object : parseArray) {
// JSONObject parseObject = JSONObject.parseObject(object.toString());
// String datakeyword = parseObject.get("keyword").toString();
// message += datakeyword+",";
// }
// }
// RestTemplate template = new RestTemplate();
// MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
// paramMap.add("text", message);
// String result = template.postForObject(insert_new_words_url, paramMap, String.class);
// } catch (Exception e) {
// e.printStackTrace();
// }
//方案命中分类统计
String datacategory = analysisDataRequest.dataCategory(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setCategory_rank(datacategory);
Boolean updateAnalysisExceptPopularInformation = analysisQuartzDao.updateAnalysisExceptPopularInformation(analysisQuartzDo);
if (updateAnalysisExceptPopularInformation) {
System.err.println("监测分析数据更新");
projectTaskDao.updateProjectTaskAnalysisFlag(projectId);
}
// Analysis analysis = new Analysis();
// analysis.setAnalysisId(snowFlake.getId());
// analysis.setProjectId(projectId);
// analysis.setTimePeriod(time_period);
//高频词
// List<Map<String, Object>> keyWordIndex = analysisDataRequest.keyWordIndex(highKeyword, times, timee, stopword, projectType);
// analysis.setKeywordIndex(JSON.toJSONString(keyWordIndex));
//
// //情感分析
// String emotional = analysisDataRequest.emotional(highKeyword, times, timee, stopword, projectType);
// analysis.setEmotionalProportion(emotional);
//
// //方案词命中
// List<Map<String, Object>> fangan = analysisDataRequest.fangan(keyword, highKeyword, times, timee, stopword, projectType);
// analysis.setPlanWordHit(JSON.toJSONString(fangan));
//
// //热门资讯
// JSONArray ziXun = analysisDataRequest.ZiXun(keyword, highKeyword, times, timee, stopword, projectType);
// analysis.setPopularInformation(JSON.toJSONString(ziXun));
//
// // 热门数据
// String hot = analysisDataRequest.getHot(highKeyword, times, timee, stopword, time_period, projectType);
// JSONObject hotjson = JSONObject.parseObject(hot);
//
// // 热门人物
// JSONArray perArray = JSONArray.parseArray(hotjson.getString("per"));
// String hotData = analysisDataRequest.hotData(perArray, highKeyword, stopword, times, timee, projectType);
// analysis.setHotPeople(hotData);
//
// //热门机构
// JSONArray orgArray = JSONArray.parseArray(hotjson.getString("org"));
// String hotData2 = analysisDataRequest.hotData(orgArray, highKeyword, stopword, times, timee, projectType);
// analysis.setHotCompany(hotData2);
//
// //地区
// JSONArray locArray = JSONArray.parseArray(hotjson.getString("loc"));
// String hotData3 = analysisDataRequest.hotData(locArray, highKeyword, stopword, times, timee, projectType);
// analysis.setHotSpot(hotData3);
//
// int insert = analysisService.insert(analysis);
// if (insert > 0) {
// System.out.println("数据存储成功");
// projectTaskDao.updateProjectTaskAnalysisFlag(projectId);
// } else {
// System.out.println("数据存储失败");
// }
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("AnalysisPTQuartz 结束");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

+ 351
- 0
src/main/java/com/stonedt/intelligence/quartz/AnalysisQuartz.java View File

@@ -0,0 +1,351 @@
package com.stonedt.intelligence.quartz;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.dao.AnalysisQuartzDao;
import com.stonedt.intelligence.entity.AnalysisQuartzDo;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.ProjectUtil;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.SnowFlake;
/**
* 监测分析定时任务
*/
@Component
public class AnalysisQuartz {
// 定时任务开关
@Value("${schedule.analysis.open}")
private Integer schedule_analysis_open;
@Value("${insertnewwords.url}")
private String insert_new_words_url;
@Autowired
private AnalysisQuartzDao analysisQuartzDao;
@Autowired
private ProjectUtil projectUtil;
@Autowired
private AnalysisDataRequest analysisDataRequest;
private SnowFlake snowFlake = new SnowFlake();
private final int[] timePeriod = {1, 2, 3, 4};
/**
* 热门资讯
*/
// @Scheduled(fixedRate = 10000000)
// @Scheduled(cron = "0 0 0/1 * * ?")
// @Scheduled(cron = "0 0/1 * * * ?")
public void popularInformation() {
if (schedule_analysis_open == 1) {
try {
System.err.println("热门资讯 启动");
List<Project> listAllProject = projectUtil.listAllProject();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(30);
for (int k = 0; k < listAllProject.size(); k++) {
try {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
Project project = listAllProject.get(i);
String keyword = project.getSubjectWord();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = project.getStopWord();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = project.getCharacterWord();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = project.getEventWord();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = project.getRegionalWord();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = project.getProjectType();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
//简单方案切换
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
Long projectId = project.getProjectId();
for (int j = 0; j < timePeriod.length; j++) {
try {
int time_period = timePeriod[j];
Map<String, String> timeMap = analysisDataRequest.time(time_period);
String times = timeMap.get("start");
String timee = timeMap.get("end");
AnalysisQuartzDo analysisQuartzDo = new AnalysisQuartzDo();
analysisQuartzDo.setCreate_time(DateUtil.nowTime());
analysisQuartzDo.setAnalysis_id(snowFlake.getId());
analysisQuartzDo.setProject_id(projectId);
analysisQuartzDo.setTime_period(time_period);
//热门资讯
JSONArray ziXun = analysisDataRequest.ZiXun(keyword, highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setPopular_information(JSON.toJSONString(ziXun));
Boolean updateAnalysisPopularInformation = analysisQuartzDao.updateAnalysisPopularInformation(analysisQuartzDo);
if (updateAnalysisPopularInformation) {
System.err.println("热门资讯更新");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("热门资讯 结束");
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 新的监测分析定时任务
*/
//@Scheduled(cron = "0 0 22 * * ?")
@Scheduled(cron = "${schedule.analysispt.cron}")
public void start() {
if (schedule_analysis_open == 1) {
try {
// 定时业务逻辑
System.err.println("AnalysisQuartz 启动");
List<Project> listAllProject = projectUtil.listAllProject();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(30);
for (int k = 0; k < listAllProject.size(); k++) {
try {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
Project project = listAllProject.get(i);
System.out.println("方案id:"+project.getProjectId());
String keyword = project.getSubjectWord();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = project.getStopWord();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = project.getCharacterWord();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = project.getEventWord();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = project.getRegionalWord();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = project.getProjectType();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
keyword = ProjectWordUtil.CommononprojectKeyWord(keyword);
}
Long projectId = project.getProjectId();
for (int j = 0; j < timePeriod.length; j++) {
try {
int time_period = timePeriod[j];
Map<String, String> timeMap = analysisDataRequest.time(time_period);
String times = timeMap.get("start");
String timee = timeMap.get("end");
AnalysisQuartzDo analysisQuartzDo = new AnalysisQuartzDo();
analysisQuartzDo.setCreate_time(DateUtil.nowTime());
analysisQuartzDo.setAnalysis_id(snowFlake.getId());
analysisQuartzDo.setProject_id(projectId);
analysisQuartzDo.setTime_period(time_period);
// 数据概览
String dataOverview = analysisDataRequest.dataOverview(projectId, highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setData_overview(dataOverview);
// 情感占比
String emotional = analysisDataRequest.emotional(highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setEmotional_proportion(emotional);
// 方案命中主体词
String fangan = analysisDataRequest.fangan(keyword, highKeyword, times, timee, stopword, projectType);
analysisQuartzDo.setPlan_word_hit(fangan);
// 关键词情感分析数据走势
String keywordsentimentFlagChart = analysisDataRequest.keywordsentimentFlagChart(keyword, highKeyword, stopword, times, timee, time_period, projectType);
analysisQuartzDo.setKeyword_emotion_trend(keywordsentimentFlagChart);
// 热点事件排名
String hotEventRanking = analysisDataRequest.hotEventRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHot_event_ranking(hotEventRanking);
// 关键词高频分布统计
String wordCloud = analysisDataRequest.wordCloud(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHighword_cloud(wordCloud);
// 高频词指数
//String keyWordIndex = analysisDataRequest.keyWordIndex(time_period, keywordsentimentFlagChart, times, timee, stopword, projectType);
String keyWordIndex = analysisDataRequest.keyWordIndex(time_period, highKeyword, times, timee, stopword, projectType,wordCloud);
analysisQuartzDo.setKeyword_index(keyWordIndex);
// 媒体活跃度分析
String mediaActivityAnalysis = analysisDataRequest.mediaActivityAnalysis(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setMedia_activity_analysis(mediaActivityAnalysis);
// 热点地区排名
String hotSpotRanking = analysisDataRequest.hotSpotRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setHot_spot_ranking(hotSpotRanking);
// 数据来源分布
String dataSourceDistribution = analysisDataRequest.dataSourceDistribution(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setData_source_distribution(dataSourceDistribution);
// 数据来源分析
String dataSourceAnalysis = analysisDataRequest.dataSourceAnalysis(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setData_source_analysis(dataSourceAnalysis);
// 关键词曝光度环比排行
String keywordExposure = analysisDataRequest.keywordExposure(keyword, highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setKeyword_exposure_rank(keywordExposure);
// 自媒体渠道声量排名
String selfMediaRanking = analysisDataRequest.selfMediaRanking(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setSelfmedia_volume_rank(selfMediaRanking);
// 涉及地点排名
// 涉及银行排名
// 涉及机构排名
// 涉及高校院所排名
// 涉及政府部门排名
// 涉及上市公司排名R
// 涉及人物排名
// 涉及医院排名
//String dataNer = analysisDataRequest.dataNer(highKeyword, stopword, times, timee, projectType);
//政策法规
String dataPolicy = analysisDataRequest.dataPolicy(highKeyword, stopword, times, timee, projectType);
//JSONObject nersjon = JSONObject.parseObject(dataNer);
JSONObject nersjon = new JSONObject();
nersjon.put("policy", JSONObject.parseObject(dataPolicy).get("policy"));
//行业分布分析
String industrialDistribution = analysisDataRequest.industrialDistribution(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setIndustrial_distribution(industrialDistribution);
//事件统计
String eventStudy = analysisDataRequest.eventStudy(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setEvent_statistics(eventStudy);
//计算统计结果
JSONObject nerdatasjon = analysisDataRequest.dataNerArticleData(highKeyword, stopword, times, timee, projectType,nersjon);
analysisQuartzDo.setNer(nerdatasjon.toJSONString());
//将统计出来的实体存储到分词词典中
// try {
// JSONObject nersjon = JSONObject.parseObject(dataNer);
//
// nersjon.put("policy", JSONObject.parseObject(dataPolicy).get("policy"));
//
// analysisQuartzDo.setNer(nersjon.toJSONString());
//
// Iterator iter = nersjon.entrySet().iterator();
// String message = "";
// while (iter.hasNext()) {
// Map.Entry entry = (Map.Entry) iter.next();
// JSONArray parseArray = JSONArray.parseArray(entry.getValue().toString());
// for (Object object : parseArray) {
// JSONObject parseObject = JSONObject.parseObject(object.toString());
// String datakeyword = parseObject.get("keyword").toString();
// message += datakeyword+",";
// }
// }
// RestTemplate template = new RestTemplate();
// MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
// paramMap.add("text", message);
// String result = template.postForObject(insert_new_words_url, paramMap, String.class);
// } catch (Exception e) {
// e.printStackTrace();
// }
//方案命中分类统计
String datacategory = analysisDataRequest.dataCategory(highKeyword, stopword, times, timee, projectType);
analysisQuartzDo.setCategory_rank(datacategory);
Boolean updateAnalysisExceptPopularInformation = analysisQuartzDao.updateAnalysisExceptPopularInformation(analysisQuartzDo);
if (updateAnalysisExceptPopularInformation) {
System.err.println("监测分析数据更新");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("AnalysisQuartz 结束");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

+ 155
- 0
src/main/java/com/stonedt/intelligence/quartz/HotDataSchedule.java View File

@@ -0,0 +1,155 @@

package com.stonedt.intelligence.quartz;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.SearchConstant;
import com.stonedt.intelligence.dao.IFullSearchDao;
import com.stonedt.intelligence.entity.FullType;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MD5Util;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.RedisUtil;
import com.stonedt.intelligence.vo.FullSearchParam;

/**
* <p>热门数据缓存</p>
* <p>Title: HotDataSchedule</p>
* <p>Description: </p>
* @author Mapeng
* @date Jul 15, 2020
*/
@Component
public class HotDataSchedule {

@Value("${es.search.url}")
private String es_search_url;
// es热点地址
@Value("${es.hot.search.url}")
private String es_hot_search_url;
@Value("${es.hot.open}")
private Integer schedule_hot_open;
@Autowired
private RedisUtil redisUtil;
@Autowired
private IFullSearchDao fullSearchDao;
@Scheduled(cron = "0 12/30 * * * ?")
public void name() {
if (schedule_hot_open == 1) {
for (int j = 1; j < 11; j++) {
System.err.println("开始更新热门数据全部栏目到redis");
List<FullType> fullSecond = fullSearchDao.listFullTypeBysecond(8);
for (int i = 0; i < fullSecond.size(); i++) {
FullType fullType = fullSecond.get(i);
Integer pageNum = j;
FullSearchParam searchParam = new FullSearchParam();
searchParam.setClassify(fullType.getValue());
searchParam.setSource_name("");
searchParam.setPageNum(pageNum);
searchParam.setPageSize(25);
searchParam.setTimeType(2);
searchParam.setSearchWord("");
setRedis(searchParam);
}
}
System.err.println("更新热门数据全部栏目到redis成功");
for (int j = 1; j < 11; j++) {
System.err.println("开始更新热门具体来源数据到redis");
List<FullType> listFullTypeThree = fullSearchDao.listFullTypeThree();
for (int i = 0; i < listFullTypeThree.size(); i++) {
FullType fullType = listFullTypeThree.get(i);
Integer pageNum = j;
FullSearchParam searchParam = new FullSearchParam();
searchParam.setClassify(fullType.getValue());
searchParam.setSource_name(fullType.getName());
searchParam.setPageNum(pageNum);
searchParam.setPageSize(25);
searchParam.setTimeType(2);
searchParam.setSearchWord("");

setRedis(searchParam);
}
}
System.err.println("完毕");
}
}
public void setRedis(FullSearchParam searchParam){
String times = "", timee = "";
String timetype = searchParam.getTimetype();
timetype = "spider_time";
String searchparam = "spider_time";
JSONObject timeJson = new JSONObject();
switch (searchParam.getTimeType()) {
case 1:
timeJson = DateUtil.dateRoll(new Date(), Calendar.HOUR, -24);
times = timeJson.getString("times");
timee = timeJson.getString("timee");
break;
case 2:
timeJson = DateUtil.getDifferOneDayTimes(-365);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("timee") + " 23:59:59";
break;
case 3:
timeJson = DateUtil.getDifferOneDayTimes(-1);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("times") + " 23:59:59";
break;
case 4:
timeJson = DateUtil.getDifferOneDayTimes(-3);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("timee") + " 23:59:59";
break;
case 5:
timeJson = DateUtil.getDifferOneDayTimes(-7);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("timee") + " 23:59:59";
break;
case 6:
timeJson = DateUtil.getDifferOneDayTimes(-15);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("timee") + " 23:59:59";
break;
case 7:
timeJson = DateUtil.getDifferOneDayTimes(-30);
times = timeJson.getString("times") + " 00:00:00";
timee = timeJson.getString("timee") + " 23:59:59";
break;
case 8:
times = searchParam.getStartTime() + " 00:00:00";
timee = searchParam.getEndTime() + " 23:59:59";
break;
}
if(StringUtils.equals(searchParam.getSource_name(), "全部")) {
searchParam.setSource_name("");
}
String params = "page="+searchParam.getPageNum()+ "&topic="+searchParam.getSearchWord() +
"&searchparam=" + searchparam + "&searchType=0" +
"&source_name="+searchParam.getSource_name() +
"&classify=" + searchParam.getClassify() + "&size=" + searchParam.getPageSize() +
"&times="+times+
"&timee="+timee+
"&timetype="+timetype;
String url = es_hot_search_url + SearchConstant.ES_API_HOT;
String esResponse = MyHttpRequestUtil.sendPostEsSearch(url, params);
boolean set = redisUtil.set(MD5Util.getMD5(searchParam.getPageNum() + searchParam.getClassify() + searchParam.getSource_name() + searchParam.getSearchWord()), esResponse);
if(set) {
System.out.println("来源为:"+searchParam.getSource_name()+"的第:"+searchParam.getPageNum()+"页更新数据到redis成功");
}else {
System.out.println("来源为:"+searchParam.getSource_name()+"的第:"+searchParam.getPageNum()+"页更新数据到redis失败");
}
}
}

+ 808
- 0
src/main/java/com/stonedt/intelligence/quartz/ReportDataSchedule.java View File

@@ -0,0 +1,808 @@
package com.stonedt.intelligence.quartz;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.ReportConstant;
import com.stonedt.intelligence.dao.ProjectDao;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.entity.ReportCustom;
import com.stonedt.intelligence.entity.ReportDetail;
import com.stonedt.intelligence.service.ReportCustomService;
import com.stonedt.intelligence.service.ReportDetailService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.MyMathUtil;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.TextUtil;
/**
* 数据报告定时任务
*/
@Component
public class ReportDataSchedule {
// es搜索地址
@Value("${es.search.url}")
private String es_search_url;
// 定时任务开关
@Value("${schedule.report.open}")
private Integer schedule_report_open;
@Autowired
private ReportCustomService reportCustomService;
@Autowired
private ReportDetailService reportDetailService;
@Autowired
private ProjectDao projectDao;
@Autowired
private AnalysisDataRequest analysisDataRequest;
// @Scheduled(fixedRate = 10000000)
//@Scheduled(cron = "0 0 3 * * ?")
//@Scheduled(cron = "0 0/1 * * * ?")
@Scheduled(cron = "0 0/1 * * * ?")
public void start() {
// 定时业务逻辑
if (schedule_report_open == 1) {
try {
System.err.println("ReportDataSchedule start");
List<ReportCustom> listReportCustomByStatus = reportCustomService.listReportCustomByStatus(1);
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(1);
for (int k = 0; k < listReportCustomByStatus.size(); k++) {
try {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
ReportCustom reportCustom = listReportCustomByStatus.get(i);
Long report_id = reportCustom.getReport_id();
Long project_id = reportCustom.getProject_id();
Project project = projectDao.getProject(project_id);
String keyword = project.getSubjectWord();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = project.getStopWord();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = project.getCharacterWord();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = project.getEventWord();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = project.getRegionalWord();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = project.getProjectType();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
String times = reportCustom.getReport_starttime();
String timee = reportCustom.getReport_endtime();
Integer report_type = reportCustom.getReport_type();
// 1数据概览逻辑处理 2、3资讯和社交数据逻辑处理
String dataOverview = dataOverview(report_type, highKeyword, stopword, times, timee, projectType);
// 4、情感分析
String emotionAnalysis = emotionAnalysis(highKeyword, stopword, times, timee, projectType);
// 5、热点事件排名
String hotEventRanking = hotEventRanking(highKeyword, stopword, times, timee, projectType);
// 10、媒体活跃度分析
String mediaActivityAnalysis = mediaActivityAnalysis(highKeyword, stopword, times, timee, projectType);
// 13、自媒体热度排名
String selfMediaRanking = selfMediaRanking(highKeyword, stopword, times, timee, projectType);
// 14、高频词指数
String highFrequencyWordIndex = highFrequencyWordIndex(highKeyword, stopword, times, timee, "", projectType);
// 15、热点地区排名
String hotSpotRanking = hotSpotRanking(highKeyword, stopword, times, timee, projectType);
// 6、7热点人物和地区
Map<String, String> hotPepoleAndSpot = hotPepoleAndSpot(highKeyword, stopword, times, timee, projectType);
String hotPeople = hotPepoleAndSpot.get("per");
String hotSpot = hotPepoleAndSpot.get("loc");
// 11、网民高频词云
String netizenWordCloud = wordCloud(highKeyword, stopword, times, timee, "2", projectType);
// 12、媒体高频词云
String mediaCordCloud = wordCloud(highKeyword, stopword, times, timee, "7", projectType);
// 13、关键词高频分布统计
String wordCloud = analysisDataRequest.wordCloud(highKeyword, stopword, times, timee, projectType);
// 14、高频词指数
//String keyWordIndex = analysisDataRequest.keyWordIndex(time_period, keywordsentimentFlagChart, times, timee, stopword, projectType);
String keyWordIndex = analysisDataRequest.keyWordReportIndex(report_type, highKeyword, times, timee, stopword, projectType,wordCloud);
//15、实体
String dataNer = analysisDataRequest.dataNer(highKeyword, stopword, times, timee, projectType);
ReportDetail reportDetail = new ReportDetail();
reportDetail.setCreate_time(DateUtil.nowTime());
reportDetail.setReport_id(report_id);
reportDetail.setData_overview(dataOverview);
reportDetail.setEmotion_analysis(emotionAnalysis);
reportDetail.setHot_event_ranking(hotEventRanking);
reportDetail.setMedia_activity_analysis(mediaActivityAnalysis);
reportDetail.setSelf_media_ranking(selfMediaRanking);
reportDetail.setHigh_word_index(highFrequencyWordIndex);
reportDetail.setHot_spot_ranking(hotSpotRanking);
reportDetail.setHot_people(hotPeople);
reportDetail.setHot_spots(hotSpot);
reportDetail.setHighword_cloud_index(keyWordIndex);
reportDetail.setHighword_cloud(wordCloud);
reportDetail.setNetizen_word_cloud(netizenWordCloud);
reportDetail.setMedia_cord_cloud(mediaCordCloud);
reportDetail.setNer(dataNer);
int saveReportDetail = reportDetailService.saveReportDetail(reportDetail);
if (saveReportDetail > 0) {
reportCustom.setReport_status(2);
} else {
reportCustom.setReport_status(3);
}
int updateReportCustomStatus = reportCustomService.updateReportCustomStatus(reportCustom);
if (updateReportCustomStatus > 0) {
System.err.println(DateUtil.nowTime() + " : " + report_id);
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("ReportDataSchedule end");
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 11、网民高频词云 12、媒体高频词云
*/
public String wordCloud(String keyword, String stopword, String times, String timee, String classify, Integer projectType) {
List<Map<String, Object>> result = new ArrayList<>();
try {
String url = es_search_url + ReportConstant.es_api_keyword_list;
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword
+ "&searchType=1&classify=" + classify + "&emotionalIndex=1,2,3" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
if (StringUtils.isNotBlank(sendPostEsSearch)) {
Map<String, Integer> map = new HashMap<>();
JSONObject parseObject = JSON.parseObject(sendPostEsSearch);
JSONArray hitsArray = parseObject.getJSONObject("hits").getJSONArray("hits");
for (int i = 0; i < hitsArray.size(); i++) {
try {
JSONObject jsonObject = hitsArray.getJSONObject(i).getJSONObject("_source").getJSONObject("key_words");
if (jsonObject != null) {
for (Entry<String, Object> entrySet : jsonObject.entrySet()) {
try {
String x = entrySet.getKey().trim();
int value = (int) entrySet.getValue();
if (map.containsKey(x)) {
map.put(x, map.get(x) + value);
} else {
map.put(x, value);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
for (Entry<String, Integer> entrySet : map.entrySet()) {
Map<String, Object> map2 = new HashMap<>();
map2.put("x", entrySet.getKey());
map2.put("value", entrySet.getValue());
result.add(map2);
}
result = result.stream().sorted((map1, map2) -> (int) map2.get("value") - (int) map1.get("value"))
.limit(100).collect(Collectors.toList());
}
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result);
}
/**
* 6、7热点人物和地区
*/
@SuppressWarnings("rawtypes")
public Map<String, String> hotPepoleAndSpot(String keyword, String stopword, String times, String timee, Integer projectType) {
Map<String, String> result = new HashMap<>();
result.put("per", "[]");
result.put("loc", "[]");
try {
String url = es_search_url + ReportConstant.es_api_ner;
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
Map<String, Object> tool = TextUtil.tool(sendPostEsSearch);
Map<String, String> chainCycle = chainCycle(times, timee);
params = "times=" + chainCycle.get("start") + "&timee=" + chainCycle.get("end")
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3" + "&projecttype=" + projectType;
sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
Map<String, Object> tool2 = TextUtil.tool(sendPostEsSearch);
String ringRatioCycletool = TextUtil.RingRatioCycletool(tool, tool2);
if (StringUtils.isNotBlank(ringRatioCycletool)) {
try {
JSONObject parseObject = JSON.parseObject(ringRatioCycletool);
if (parseObject.containsKey("per")) {
JSONArray jsonArray = parseObject.getJSONArray("per");
List<Map> per = JSONObject.parseArray(jsonArray.toJSONString(), Map.class);
per = per.stream().limit(10).collect(Collectors.toList());
result.put("per", JSON.toJSONString(per));
}
if (parseObject.containsKey("loc")) {
JSONArray jsonArray = parseObject.getJSONArray("loc");
List<Map> loc = JSONObject.parseArray(jsonArray.toJSONString(), Map.class);
loc = loc.stream().limit(10).collect(Collectors.toList());
result.put("loc", JSON.toJSONString(loc));
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 获取环比时间周期
*/
public Map<String, String> chainCycle(String times, String timee) {
Map<String, String> result = new HashMap<>();
try {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime start = LocalDateTime.parse(times, dateTimeFormatter);
LocalDateTime end = LocalDateTime.parse(timee, dateTimeFormatter);
Duration between = Duration.between(start, end);
long days = between.toDays();
if (days == 0) {
LocalDateTime minusDays = start.minusDays(1);
result.put("start", minusDays.format(dateTimeFormatter2) + " 00:00:00");
result.put("end", minusDays.format(dateTimeFormatter2) + " 23:59:59");
} else if (days == 7) {
LocalDateTime minusWeeks = start.minusWeeks(1);
LocalDateTime minusWeeks2 = end.minusWeeks(1);
result.put("start", minusWeeks.format(dateTimeFormatter2) + " 00:00:00");
result.put("end", minusWeeks2.format(dateTimeFormatter2) + " 23:59:59");
} else {
LocalDateTime minusMonths = start.minusMonths(1);
result.put("start", minusMonths.with(TemporalAdjusters.firstDayOfMonth()).format(dateTimeFormatter2) + " 00:00:00");
result.put("end", minusMonths.with(TemporalAdjusters.lastDayOfMonth()).format(dateTimeFormatter2) + " 23:59:59");
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 1数据概览逻辑处理 2、3资讯和社交数据逻辑处理
*/
public String dataOverview(Integer report_type, String keyword, String stopword, String times, String timee, Integer projectType) {
Map<String, Object> result = new HashMap<String, Object>();
try {
result.put("report_type", report_type);
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
try {
// 获取总资讯数、网站资讯数、客户端资讯数
String url = es_search_url + ReportConstant.es_api_media_exposure;
String sendPost = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
int total = parseObject.getJSONObject("hits").getIntValue("total");
result.put("total", total);
JSONArray jsonArray = parseObject.getJSONObject("aggregations")
.getJSONObject("top-terms-emotion").getJSONArray("buckets");
int web_count = 0;
int app_count = 0;
// int information_count = 0;
int social_count = 0;
for (int i = 0; i < jsonArray.size(); i++) {
try {
int key = jsonArray.getJSONObject(i).getIntValue("key");
int doc_count = jsonArray.getJSONObject(i).getIntValue("doc_count");
// 总资讯数、网站资讯数、客户端资讯数逻辑处理
if (key == 7) app_count = doc_count;
if (key == 8) web_count = doc_count;
// if (key == 5 || key == 8) information_count += doc_count;
// if (key == 2 || key == 4 || key == 11) social_count += doc_count;
if (key == 2) social_count += doc_count;
} catch (Exception e) {
e.printStackTrace();
}
}
result.put("web_count", web_count);
result.put("app_count", app_count);
String web_rate = MyMathUtil.calculatedRatioWithPercentSign(web_count, total);
String app_rate = MyMathUtil.calculatedRatioWithPercentSign(app_count, total);
result.put("web_rate", web_rate);
result.put("app_rate", app_rate);
// 贴吧数量
String params2 = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&sourceWebsite=百度贴吧&emotionalIndex=1,2,3" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params2);
JSONObject parseObject2 = JSON.parseObject(sendPostEsSearch);
social_count += parseObject2.getJSONObject("hits").getIntValue("total");
result.put("information_count", total - social_count);
result.put("social_count", social_count);
} catch (Exception e) {
e.printStackTrace();
}
try {
// 获取敏感和非敏感资讯数
String url = es_search_url + ReportConstant.es_api_emotion_rate;
String sendPost = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
int emotion_total = parseObject.getJSONObject("hits").getIntValue("total");
JSONArray jsonArray = parseObject.getJSONObject("aggregations")
.getJSONObject("group_by_tags").getJSONArray("buckets");
int sensitive_count = 0;
int non_sensitive_count = 0;
for (int i = 0; i < jsonArray.size(); i++) {
try {
int key = jsonArray.getJSONObject(i).getIntValue("key");
int doc_count = jsonArray.getJSONObject(i).getIntValue("doc_count");
if (key == 1 || key == 2) non_sensitive_count += doc_count;
if (key == 3) sensitive_count += doc_count;
} catch (Exception e) {
e.printStackTrace();
}
}
String sensitive_rate = MyMathUtil.calculatedRatioWithPercentSign(sensitive_count, emotion_total);
String non_sensitive_rate = MyMathUtil.calculatedRatioWithPercentSign(non_sensitive_count, emotion_total);
result.put("sensitive_count", sensitive_count);
result.put("non_sensitive_count", non_sensitive_count);
result.put("sensitive_rate", sensitive_rate);
result.put("non_sensitive_rate", non_sensitive_rate);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result);
}
/**
* 4、情感分析
*/
public String emotionAnalysis(String keyword, String stopword, String times, String timee, Integer projectType) {
try {
Map<String, Object> result = new HashMap<String, Object>();
// 获取总资讯数、网站资讯数、客户端资讯数
String url = es_search_url + ReportConstant.es_api_emotion_rate;
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&classify=1,2,3,4,5,6,7,8,9,10,11&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSON.parseObject(sendPostEsSearch);
JSONArray jsonArray = parseObject.getJSONObject("aggregations")
.getJSONObject("group_by_tags").getJSONArray("buckets");
int positive_count = 0;
int neutral_count = 0;
int negative_count = 0;
for (int i = 0; i < jsonArray.size(); i++) {
try {
int key = jsonArray.getJSONObject(i).getIntValue("key");
int doc_count = jsonArray.getJSONObject(i).getIntValue("doc_count");
if (key == 1) positive_count = doc_count;
if (key == 2) neutral_count = doc_count;
if (key == 3) negative_count = doc_count;
} catch (Exception e) {
e.printStackTrace();
}
}
result.put("positive_count", positive_count);
result.put("neutral_count", neutral_count);
result.put("negative_count", negative_count);
List<Object[]> chart = new ArrayList<Object[]>();
chart.add(new Object[]{"正面", positive_count});
chart.add(new Object[]{"中性", neutral_count});
chart.add(new Object[]{"负面", negative_count});
result.put("chart", chart);
return JSON.toJSONString(result);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* 5、热点事件排名
*/
public String hotEventRanking(String keyword, String stopword, String times, String timee, Integer projectType) {
Map<String, Object> result = new HashMap<String, Object>();
String url = es_search_url + ReportConstant.es_api_similar_ids;
try {
// 全部情感
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
List<Map<String, Object>> all = hotEventRankingProcess(sendPostEsSearch);
result.put("all", all);
} catch (Exception e) {
e.printStackTrace();
result.put("all", new ArrayList<>());
}
try {
// 正面
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
List<Map<String, Object>> positive = hotEventRankingProcess(sendPostEsSearch);
result.put("positive", positive);
} catch (Exception e) {
e.printStackTrace();
result.put("positive", new ArrayList<>());
}
try {
// 负面
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=3" + "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
List<Map<String, Object>> negative = hotEventRankingProcess(sendPostEsSearch);
result.put("negative", negative);
} catch (Exception e) {
e.printStackTrace();
result.put("negative", new ArrayList<>());
}
return JSON.toJSONString(result);
}
/**
* 5、热点事件排名
* 处理热点事件排名接口返回的数据
*/
public List<Map<String, Object>> hotEventRankingProcess(String sendPostEsSearch) throws Exception {
String url2 = es_search_url + ReportConstant.es_api_similar_list;
List<Map<String, Object>> list = new ArrayList<>();
try {
@SuppressWarnings("unchecked")
List<Map<String, String>> listMap = JSON.parseObject(sendPostEsSearch, List.class);
String article_public_idstr = listMap.stream()
.sorted((map1, map2) -> Integer.valueOf(map2.get("similarvolume")) - Integer.valueOf(map1.get("similarvolume")))
.limit(10).map(map -> map.get("article_public_id"))
.collect(Collectors.joining(","));
if (StringUtils.isBlank(article_public_idstr)) {
return list;
}
String params2 = "article_public_idstr=" + article_public_idstr + "&searchType=2";
String sendPostEsSearch2 = MyHttpRequestUtil.sendPostEsSearch(url2, params2);
JSONObject parseObject2 = JSON.parseObject(sendPostEsSearch2);
JSONArray jsonArray2 = parseObject2.getJSONArray("data");
int total = 0;
for (int i = 0; i < jsonArray2.size(); i++) {
try {
JSONObject jsonObject = jsonArray2.getJSONObject(i).getJSONObject("_source");
Map<String, Object> map = new HashMap<>();
String article_public_id = jsonObject.getString("article_public_id");
String title = jsonObject.getString("title");
String content = jsonObject.getString("content");
String publish_time = jsonObject.getString("publish_time");
String source_name = jsonObject.getString("sourcewebsitename");
String key_words = jsonObject.getString("key_words");
int similarvolume = jsonObject.getIntValue("similarvolume");
int emotion = jsonObject.getIntValue("emotionalIndex");
map.put("article_public_id", article_public_id);
map.put("title", title);
map.put("content", content);
map.put("publish_time", publish_time);
map.put("source_name", source_name);
map.put("key_words", key_words);
map.put("emotion", emotion);
map.put("similarvolume", similarvolume);
total += similarvolume;
list.add(map);
} catch (Exception e) {
e.printStackTrace();
}
}
for (int i = 0; i < list.size(); i++) {
try {
int similarvolume = Integer.parseInt(String.valueOf(list.get(i).get("similarvolume")));
list.get(i).put("rate", MyMathUtil.calculatedRatioWithPercentSign(similarvolume, total));
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
/**
* 10、媒体活跃度分析
*/
public String mediaActivityAnalysis(String keyword, String stopword, String times, String timee, Integer projectType) {
try {
Map<String, Object> result = new HashMap<>();
String url = es_search_url + ReportConstant.es_api_media_active;
//String param = "times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword + "&classify=7&emotionalIndex=1,2,3"
String param = "times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
int total = parseObject.getJSONObject("hits").getIntValue("total");
JSONArray buckets = parseObject.getJSONObject("aggregations")
.getJSONObject("top-terms-sourcewebsitename").getJSONArray("buckets");
int total_site = buckets.size();
List<Map<String, Object>> sites = new ArrayList<>();
for (int i = 0; i < total_site; i++) {
try {
if (sites.size() == 10) {
break;
}
try {
Map<String, Object> map = new HashMap<>();
String name = buckets.getJSONObject(i).getString("key");
int count = buckets.getJSONObject(i).getIntValue("doc_count");
String rate = MyMathUtil.calculatedRatioWithPercentSign(count, total);
map.put("name", name);
map.put("count", count);
map.put("rate", rate);
JSONArray jsonArray = buckets.getJSONObject(i).getJSONObject("top_score_hits").getJSONObject("hits").getJSONArray("hits");
if (!jsonArray.isEmpty()) {
String id = jsonArray.getJSONObject(0).getString("_id");
String logo = jsonArray.getJSONObject(0).getJSONObject("_source").getString("websitelogo");
map.put("id", TextUtil.nullAsStringEmpty(id));
map.put("logo", TextUtil.nullAsStringEmpty(logo));
}
sites.add(map);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
result.put("total", total);
result.put("total_site", total_site);
result.put("sites", sites);
return JSON.toJSONString(result);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* 13、自媒体热度排名
*/
public String selfMediaRanking(String keyword, String stopword, String times, String timee, Integer projectType) {
try {
String url = es_search_url + ReportConstant.es_api_media_list;
String param = "classify=7&times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
JSONArray buckets = parseObject.getJSONObject("aggregations")
.getJSONObject("top-terms-aggregation").getJSONArray("buckets");
List<Map<String, Object>> result = new ArrayList<>();
for (int i = 0; i < buckets.size(); i++) {
try {
String name = buckets.getJSONObject(i).getString("key");
if (StringUtils.isNotBlank(name)) {
JSONArray jsonArray = buckets.getJSONObject(i).getJSONObject("top-terms-emotion").getJSONArray("buckets");
for (int j = 0; j < jsonArray.size(); j++) {
try {
if (result.size() == 7) break;
String platform_name = jsonArray.getJSONObject(j).getString("key");
int volume = jsonArray.getJSONObject(j).getIntValue("doc_count");
Map<String, Object> map = new HashMap<>();
map.put("name", name);
map.put("volume", volume);
map.put("platform_name", platform_name);
result.add(map);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
result = result.stream()
.sorted((map1, map2) -> (int) map2.get("volume") - (int) map1.get("volume"))
.limit(7).collect(Collectors.toList());
for (int i = 0; i < result.size(); i++) {
String name = (String) result.get(i).get("name");
String platform_name = (String) result.get(i).get("platform_name");
url = es_search_url + ReportConstant.es_api_wemedia_info;
param = "name=" + name + "&platform_name=" + platform_name;
sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
parseObject = JSONObject.parseObject(sendPostEsSearch);
JSONArray jsonArray2 = parseObject.getJSONArray("data");
if (!jsonArray2.isEmpty()) {
JSONObject jsonObject = jsonArray2.getJSONObject(0).getJSONObject("_source");
String logo = jsonObject.getString("logo");
String slogan = jsonObject.getString("slogan");
String id = jsonObject.getString("id");
int release_count = jsonObject.getIntValue("production_count");
int fans_count = jsonObject.getIntValue("focus_count");
result.get(i).put("logo", TextUtil.nullAsStringEmpty(logo));
result.get(i).put("slogan", TextUtil.nullAsStringEmpty(slogan));
result.get(i).put("id", TextUtil.nullAsStringEmpty(id));
result.get(i).put("release_count", release_count);
result.get(i).put("fans_count", fans_count);
} else {
result.get(i).put("logo", "");
result.get(i).put("slogan", "");
result.get(i).put("id", "");
result.get(i).put("release_count", "");
result.get(i).put("fans_count", "");
}
}
return JSON.toJSONString(result);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* 14、高频词指数
*/
public String highFrequencyWordIndex(String keyword, String stopword, String times, String timee, String classify, Integer projectType) {
List<Map<String, Object>> result = new ArrayList<>();
try {
String url = es_search_url + ReportConstant.es_api_keyword_list;
String params = "times=" + times + "&timee=" + timee
+ "&keyword=" + keyword + "&stopword=" + stopword
+ "&searchType=1&classify=" + classify + "&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
if (StringUtils.isNotBlank(sendPostEsSearch)) {
Map<String, Integer> map = new HashMap<>();
JSONObject parseObject = JSON.parseObject(sendPostEsSearch);
JSONArray hitsArray = parseObject.getJSONObject("hits").getJSONArray("hits");
for (int i = 0; i < hitsArray.size(); i++) {
try {
JSONObject jsonObject = hitsArray.getJSONObject(i).getJSONObject("_source").getJSONObject("key_words");
if (jsonObject != null) {
for (Entry<String, Object> entrySet : jsonObject.entrySet()) {
try {
String x = entrySet.getKey().trim();
int value = (int) entrySet.getValue();
if (map.containsKey(x)) {
map.put(x, map.get(x) + value);
} else {
map.put(x, value);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
for (Entry<String, Integer> entrySet : map.entrySet()) {
try {
Map<String, Object> map2 = new HashMap<>();
map2.put("keyword", entrySet.getKey());
map2.put("value", entrySet.getValue());
result.add(map2);
} catch (Exception e) {
e.printStackTrace();
}
}
result = result.stream().sorted((map1, map2) -> (int) map2.get("value") - (int) map1.get("value"))
.limit(10).collect(Collectors.toList());
int total = result.stream().mapToInt(a -> (int) a.get("value")).sum();
for (int i = 0; i < result.size(); i++) {
int value = (int) result.get(i).get("value");
result.get(i).put("rate", MyMathUtil.calculatedRatioWithPercentSign(value, total));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result);
}
/**
* 15、热点地区排名
*/
public String hotSpotRanking(String keyword, String stopword, String times, String timee, Integer projectType) {
try {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> chart = new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
String url = es_search_url + ReportConstant.es_api_hot_spot_ranking;
String param = "times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3"
+ "&projecttype=" + projectType;
String esOpinion = MyHttpRequestUtil.sendPostEsSearch(url, param);
JSONObject parseObject = JSONObject.parseObject(esOpinion);
int total = parseObject.getJSONObject("hits").getIntValue("total");
JSONArray buckets = parseObject.getJSONObject("aggregations")
.getJSONObject("group_by_tags").getJSONArray("buckets");
List<String> spots = new ArrayList<>(Arrays.asList(ReportConstant.spotArray));
for (int i = 0; i < buckets.size(); i++) {
try {
// 处理生成chart图的数据
String key = buckets.getJSONObject(i).getString("key");
int doc_count = buckets.getJSONObject(i).getIntValue("doc_count");
Map<String, Object> map = new HashMap<>();
map.put("name", key);
map.put("value", doc_count);
spots.remove(key);
chart.add(map);
// 处理生成图下的排行前四的数据
if (i < 5) {
Map<String, Object> map2 = new HashMap<>();
map2.put("name", key);
map2.put("value", doc_count);
map2.put("rate", MyMathUtil.calculatedRatioWithPercentSign(doc_count, total));
list.add(map2);
}
} catch (Exception e) {
e.printStackTrace();
}
}
// 处理数据量为0的省
// for (int i = 0; i < spots.size(); i++) {
// Map<String, Object> map = new HashMap<>();
// map.put("name", spots.get(i));
// map.put("value", 0);
// chart.add(map);
// }
result.put("chart", chart);
result.put("list", list);
return JSON.toJSONString(result);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}

+ 284
- 0
src/main/java/com/stonedt/intelligence/quartz/ReportListSchedule.java View File

@@ -0,0 +1,284 @@
package com.stonedt.intelligence.quartz;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalField;
import java.time.temporal.WeekFields;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.entity.ReportCustom;
import com.stonedt.intelligence.service.ReportCustomService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.ProjectUtil;
import com.stonedt.intelligence.util.SnowFlake;
/**
* 数据报告列表定时任务
*/
@Component
public class ReportListSchedule {
// 日报定时任务开关
@Value("${schedule.dayreport.open}")
private Integer schedule_dayreport_open;
// 周报定时任务开关
@Value("${schedule.weekreport.open}")
private Integer schedule_weekreport_open;
// 月报定时任务开关
@Value("${schedule.monthreport.open}")
private Integer schedule_monthreport_open;
@Autowired
private ProjectUtil projectUtil;
@Autowired
private ReportCustomService reportCustomService;
private SnowFlake snowFlake = new SnowFlake();
/**
* 日报列表
*/
// @Scheduled(fixedRate = 10000000)
@Scheduled(cron = "0 0 1 * * ?")
public void dayreport() {
// 定时业务逻辑
if (schedule_dayreport_open == 1) {
try {
System.err.println("ReportListSchedule dayreport start");
List<Project> listAllProject = projectUtil.listAllProject();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(1);
for (int k = 0; k < listAllProject.size(); k++) {
try {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
try {
Project project = listAllProject.get(i);
Long projectId = project.getProjectId();
String projectName = project.getProjectName();
// Integer projectType = project.getProjectType();
// if (projectType != 1) {
// return;
// }
String subjectWord = project.getSubjectWord();
String stopWord = project.getStopWord();
Long userId = project.getUserId();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate minusDays = LocalDate.now().minusDays(1);
int year = minusDays.getYear();
int monthValue = minusDays.getMonthValue();
int dayOfMonth = minusDays.getDayOfMonth();
String reportName = year + "年" + String.format("%02d", monthValue) + "月"
+ String.format("%02d", dayOfMonth) + "日舆情日报-[" + projectName + "]";
String preDate = minusDays.format(dateTimeFormatter);
ReportCustom reportCustom = new ReportCustom();
String nowTime = DateUtil.nowTime();
reportCustom.setCreate_time(nowTime);
reportCustom.setDel_status(0);
reportCustom.setReport_status(0);
reportCustom.setReport_time(nowTime);
reportCustom.setReport_topping(0);
reportCustom.setReport_id(snowFlake.getId());
reportCustom.setKeyword(subjectWord);
reportCustom.setProject_id(projectId);
reportCustom.setReport_endtime(preDate + " 23:59:59");
reportCustom.setReport_starttime(preDate + " 00:00:00");
reportCustom.setStopword(stopWord);
reportCustom.setUser_id(userId);
reportCustom.setReport_type(1);
reportCustom.setReport_name(reportName);
int saveReportCustom = reportCustomService.saveReportCustom(reportCustom);
if (saveReportCustom > 0) {
System.err.println(DateUtil.nowTime() + " : " + reportName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("ReportListSchedule dayreport end");
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 周报列表
*/
// @Scheduled(fixedRate = 10000000)
@Scheduled(cron = "0 0 1 ? * MON")
public void weekreport() {
// 定时业务逻辑
if (schedule_weekreport_open == 1) {
try {
System.err.println("ReportListSchedule weekreport start");
List<Project> listAllProject = projectUtil.listAllProject();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(1);
for (int k = 0; k < listAllProject.size(); k++) {
try {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
try {
Project project = listAllProject.get(i);
Long projectId = project.getProjectId();
String projectName = project.getProjectName();
// Integer projectType = project.getProjectType();
// if (projectType != 1) {
// return;
// }
String subjectWord = project.getSubjectWord();
String stopWord = project.getStopWord();
Long userId = project.getUserId();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate minusWeeks = LocalDate.now().minusWeeks(1);
TemporalField fieldISO = WeekFields.of(Locale.FRANCE).dayOfWeek();
LocalDate monday = minusWeeks.with(fieldISO, 1);
LocalDate sunday = minusWeeks.with(fieldISO, 7);
int year = monday.getYear();
WeekFields weekFields = WeekFields.ISO;
int weekNumber = monday.get(weekFields.weekOfWeekBasedYear());
String reportName = year + "年第" + weekNumber + "周舆情周报-[" + projectName + "]";
ReportCustom reportCustom = new ReportCustom();
String nowTime = DateUtil.nowTime();
reportCustom.setCreate_time(nowTime);
reportCustom.setDel_status(0);
reportCustom.setReport_status(0);
reportCustom.setReport_time(nowTime);
reportCustom.setReport_topping(0);
reportCustom.setReport_id(snowFlake.getId());
reportCustom.setKeyword(subjectWord);
reportCustom.setProject_id(projectId);
reportCustom.setReport_endtime(sunday.format(dateTimeFormatter) + " 23:59:59");
reportCustom.setReport_starttime(monday.format(dateTimeFormatter) + " 00:00:00");
reportCustom.setStopword(stopWord);
reportCustom.setUser_id(userId);
reportCustom.setReport_type(2);
reportCustom.setReport_name(reportName);
int saveReportCustom = reportCustomService.saveReportCustom(reportCustom);
if (saveReportCustom > 0) {
System.err.println(DateUtil.nowTime() + " : " + reportName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("ReportListSchedule weekreport end");
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 月报列表
*/
// @Scheduled(fixedRate = 10000000)
@Scheduled(cron = "0 0 1 1 * ?")
public void monthreport() {
// 定时业务逻辑
if (schedule_monthreport_open == 1) {
try {
System.err.println("ReportListSchedule monthreport start");
List<Project> listAllProject = projectUtil.listAllProject();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(1);
for (int k = 0; k < listAllProject.size(); k++) {
final int i = k;
newFixedThreadPool.execute(new Runnable() {
@Override
public void run() {
try {
Project project = listAllProject.get(i);
Long projectId = project.getProjectId();
String projectName = project.getProjectName();
// Integer projectType = project.getProjectType();
// if (projectType != 1) {
// return;
// }
String subjectWord = project.getSubjectWord();
String stopWord = project.getStopWord();
Long userId = project.getUserId();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate minusMonths = LocalDate.now().minusMonths(1);
LocalDate firstDay = minusMonths.with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDay = minusMonths.with(TemporalAdjusters.lastDayOfMonth());
int year = minusMonths.getYear();
int monthValue = minusMonths.getMonthValue();
String reportName = year + "年" + String.format("%02d", monthValue) + "月舆情月报-[" + projectName + "]";
ReportCustom reportCustom = new ReportCustom();
String nowTime = DateUtil.nowTime();
reportCustom.setCreate_time(nowTime);
reportCustom.setDel_status(0);
reportCustom.setReport_status(0);
reportCustom.setReport_time(nowTime);
reportCustom.setReport_topping(0);
reportCustom.setReport_id(snowFlake.getId());
reportCustom.setKeyword(subjectWord);
reportCustom.setProject_id(projectId);
reportCustom.setReport_endtime(lastDay.format(dateTimeFormatter) + " 23:59:59");
reportCustom.setReport_starttime(firstDay.format(dateTimeFormatter) + " 00:00:00");
reportCustom.setStopword(stopWord);
reportCustom.setUser_id(userId);
reportCustom.setReport_type(3);
reportCustom.setReport_name(reportName);
int saveReportCustom = reportCustomService.saveReportCustom(reportCustom);
if (saveReportCustom > 0) {
System.err.println(DateUtil.nowTime() + " : " + reportName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
newFixedThreadPool.shutdown();
try {
newFixedThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.err.println("ReportListSchedule monthreport end");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

+ 649
- 0
src/main/java/com/stonedt/intelligence/quartz/SynthesizeSchedule.java View File

@@ -0,0 +1,649 @@
package com.stonedt.intelligence.quartz;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import javax.annotation.PostConstruct;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.HotWordsUtil;
import com.stonedt.intelligence.util.MD5Util;
import com.stonedt.intelligence.util.RedisUtil;
import com.stonedt.intelligence.vo.FullSearchParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.cookie.Cookie;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.MonitorConstant;
import com.stonedt.intelligence.constant.WechatConstant;
import com.stonedt.intelligence.dao.ProjectDao;
import com.stonedt.intelligence.dao.ReportCustomDao;
import com.stonedt.intelligence.dao.SynthesizeDao;
import com.stonedt.intelligence.dao.UserDao;
import com.stonedt.intelligence.dao.WarningarticleDao;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.service.FullSearchService;
import com.stonedt.intelligence.service.MonitorService;
import com.stonedt.intelligence.util.MyHttpRequestUtil;

/**
* 综合看板定时任务
*/
@Component
public class SynthesizeSchedule {

// 定时任务开关
@Value("${schedule.synthesize.open}")
private Integer schedule_synthesize_open;
@Value("${es.search.url}")
private String es_search_url;
@Autowired
private UserDao userDao;
@Autowired
private ReportCustomDao reportCustomDao;
@Autowired
private FullSearchService fullSearchService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private WarningarticleDao warningarticleDao;
@Autowired
private MonitorService monitorService;
@Autowired
private ProjectDao projectDao;
@Autowired
private SynthesizeDao synthesizeDao;
/**
* 模板消息
*/

// @PostConstruct
// @Scheduled(cron = "0 30 4 * * ?")
//@Scheduled(fixedDelay = 1000*60*2)
//
//@Scheduled(cron = "0 0/2 * * * ?")
@Scheduled(cron = "0 0/30 * * * ?")
public void popularInformation() {
if(schedule_synthesize_open==1) {
//获取accesstoken
System.out.println("开始生成综合看板");
String hot_all = "";
String hot_weibo = "";
String hot_wechat = "";
String hot_search_terms = "";
String hot_douyin = "";
String hot_bilibili = "";
String hot_tecentvedio = "";
String hot_policydata = "";
String hot_finaceData = "";
String hot_36kr ="";
try {
FullSearchParam searchParam = new FullSearchParam();
searchParam.setPageNum(1);
searchParam.setPageSize(50);
searchParam.setSearchWord("");
searchParam.setClassify("4");
searchParam.setTimeType(1);
//热点事件
searchParam.setSource_name("百度风云榜");
//JSONObject hotList = fullSearchService.hotList(searchParam);
hot_all = fullSearchService.hotBaiduList();
//热门微博
searchParam.setSource_name("微博");
JSONObject hotList2 = fullSearchService.hotList(searchParam);
hot_weibo =conversionHotList(hotList2);
//热门微信
searchParam.setSource_name("微信");
JSONObject hotListWechat = fullSearchService.hotList(searchParam);
hot_wechat =conversionHotList(hotListWechat);
searchParam.setPageSize(10);
searchParam.setClassify("1");
//热门科技
searchParam.setSource_name("36kr");
JSONObject hotList36kr = fullSearchService.hotList(searchParam);
hot_36kr =conversionHotList(hotList36kr);
searchParam.setClassify("2");
searchParam.setTimeType(2);
searchParam.setPageSize(50);
//热门抖音
searchParam.setSource_name("抖音");
JSONObject hotListDouyin = fullSearchService.hotList(searchParam);
hot_douyin =conversionHotList(hotListDouyin);
//热门哔哩哔哩
searchParam.setSource_name("哔哩哔哩");
JSONObject hotListBiLiBiLi = fullSearchService.hotList(searchParam);
hot_bilibili =conversionHotList(hotListBiLiBiLi);
//热门腾讯视频
searchParam.setSource_name("腾讯视频");
JSONObject hotListTecentVedio = fullSearchService.hotList(searchParam);
hot_tecentvedio =conversionHotList(hotListTecentVedio);
hot_search_terms = HotWordsUtil.search();
//政策--------国务院 > 首页 > 政策 > 最新 http://www.gov.cn/zhengce/zuixin.htm
hot_policydata = getPolicyData();
//经济--------东方财富网(国内经济首页 > 财经频道 > 焦点 > 国内经济) http://finance.eastmoney.com/a/cgnjj.html
hot_finaceData = getFinaceData();
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Map<String, Object> map = new HashMap<String, Object>();
map.put("hot_all", hot_all);
map.put("user_id", "1");
map.put("hot_weibo", hot_weibo);
map.put("hot_wechat", hot_wechat);
map.put("hot_douyin", hot_douyin);
map.put("hot_bilibili", hot_bilibili);
map.put("hot_tecentvedio", hot_tecentvedio);
map.put("hot_search_terms", hot_search_terms);
map.put("hot_policydata", hot_policydata);
map.put("hot_finaceData", hot_finaceData);
map.put("hot_36kr", hot_36kr);
synthesizeDao.insertSynthesize(map);
} catch (Exception e) {
e.printStackTrace();
}
}

}
private String getreprint(User user) {
String keywords = getkeywords(user,0);
JSONObject timeJson = new JSONObject();
timeJson = DateUtil.dateRoll(new Date(), Calendar.HOUR, -24);
String times = timeJson.getString("times");
String timee = timeJson.getString("timee");
String params = "matchingmode=0&searchType=4&timeType=1&stopword=&esindex=postal&timee="+timee+"&estype=infor&times="+times+"&emotionalIndex=1,2,3&size=10&page=1&keyword="+keywords;
String url = es_search_url + MonitorConstant.es_api_search_list;
String esResponse = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(esResponse);
JSONArray jsonArray = parseObject.getJSONArray("data");
JSONArray list = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i).getJSONObject("_source");
JSONObject ob = new JSONObject();
ob.put("id", jsonObject.get("article_public_id"));
String source_name = jsonObject.get("source_name").toString();
if("微博".equals(source_name)){
ob.put("title", jsonObject.get("extend_string_two"));
}else{
ob.put("title", jsonObject.get("title"));
}
ob.put("source_url", jsonObject.get("source_url"));
ob.put("emotionalIndex", jsonObject.get("emotionalIndex"));
ob.put("publish_time", jsonObject.get("publish_time"));
ob.put("source_name", source_name);
ob.put("forwardingvolume", jsonObject.get("forwardingvolume"));
list.add(ob);
}
return list.toJSONString();
}
private String getleaders(User user) {
String keywords = getkeywords(user,1);
JSONObject timeJson = new JSONObject();
timeJson = DateUtil.dateRoll(new Date(), Calendar.HOUR, -24);
String times = timeJson.getString("times");
String timee = timeJson.getString("timee");
String params = "matchingmode=0&searchType=1&timeType=1&stopword=&esindex=postal&timee="+timee+"&estype=infor&times="+times+"&emotionalIndex=1,2,3&size=5&page=1&keyword="+keywords;
String url = es_search_url + MonitorConstant.es_api_search_list;
System.err.println("============leaders_PO=================");
System.out.println("url:"+url);
System.out.println("params:"+params);
System.err.println("=============leaders_PO=================");
String esResponse = MyHttpRequestUtil.sendPostEsSearch(url, params);
JSONObject parseObject = JSONObject.parseObject(esResponse);
JSONArray jsonArray = parseObject.getJSONArray("data");
JSONArray list = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i).getJSONObject("_source");
JSONObject ob = new JSONObject();
ob.put("id", jsonObject.get("article_public_id"));
ob.put("title", jsonObject.get("title"));
ob.put("source_url", jsonObject.get("source_url"));
ob.put("emotionalIndex", jsonObject.get("emotionalIndex"));
ob.put("publish_time", jsonObject.get("publish_time"));
ob.put("source_name", jsonObject.get("source_name"));
list.add(ob);
}
return list.toJSONString();
}
private String getpush(User user) {
String keywords = getkeywords(user,0);
JSONObject timeJson = new JSONObject();
timeJson = DateUtil.dateRoll(new Date(), Calendar.HOUR, -24);
String times = timeJson.getString("times");
String timee = timeJson.getString("timee");
String params = "matchingmode=0&searchType=1&timeType=1&stopword=&esindex=postal&timee="+timee+"&estype=infor&times="+times+"&emotionalIndex=1,2,3&size=10&page=1&keyword="+keywords;
String url = es_search_url + MonitorConstant.es_api_search_list;
// System.err.println("============push_PO all=================");
// System.out.println("url:"+url);
// System.out.println("params:"+params);
// System.err.println("=============push_PO all=================");
String esResponse = "";
int i = 0;
while(i<3){
i++;
try {
esResponse = MyHttpRequestUtil.sendPostEsSearch(url, params);
break;
} catch (Exception e) {
e.printStackTrace();
}
}
JSONArray all = clean(esResponse);
//positive
String positiveparams = "";
i=0;
while(i<3){
i++;
try {
positiveparams = "matchingmode=0&searchType=1&timeType=1&stopword=&esindex=postal&timee="+timee+"&estype=infor&times="+times+"&emotionalIndex=1&size=10&page=1&keyword="+keywords;
break;
} catch (Exception e) {
e.printStackTrace();
}
}
// System.err.println("============push_PO positiveparams=================");
// System.out.println("url:"+url);
// System.out.println("params:"+params);
// System.err.println("=============push_PO positiveparams=================");
String positiveesResponse = MyHttpRequestUtil.sendPostEsSearch(url, positiveparams);
JSONArray positive = clean(positiveesResponse);
//negative
String negativeparams = "matchingmode=0&searchType=1&timeType=1&stopword=&esindex=postal&timee="+timee+"&estype=infor&times="+times+"&emotionalIndex=3&size=10&page=1&keyword="+keywords;
String negativeesResponse = "";
i=0;
while(i<3){
i++;
try {
negativeesResponse = MyHttpRequestUtil.sendPostEsSearch(url, negativeparams);
break;
} catch (Exception e) {
e.printStackTrace();
}
}
// System.err.println("============push_PO negativeparams=================");
// System.out.println("url:"+url);
// System.out.println("params:"+params);
// System.err.println("=============push_PO negativeparams=================");
JSONArray negative = clean(negativeesResponse);
JSONObject result = new JSONObject();
result.put("all", all);
result.put("positive", positive);
result.put("negative", negative);
return result.toJSONString();
}
private JSONArray clean(String esResponse) {
JSONObject parseObject = JSONObject.parseObject(esResponse);
JSONArray jsonArray = parseObject.getJSONArray("data");
JSONArray list = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i).getJSONObject("_source");
JSONObject ob = new JSONObject();
String string = jsonObject.getString("content");
ob.put("id", jsonObject.get("article_public_id"));
String content = string.length()>180?string.substring(0,180)+"...":string;
if (content != null) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(content);
content = m.replaceAll("");
}
ob.put("content",content);
ob.put("title", jsonObject.get("title"));
ob.put("source_url", jsonObject.get("source_url"));
ob.put("emotionalIndex", jsonObject.get("emotionalIndex"));
ob.put("publish_time", jsonObject.get("publish_time"));
ob.put("source_name", jsonObject.get("source_name"));
list.add(ob);
}
return list;
}
private String getkeywords(User user,int type) {
List<String> keywords= projectDao.getKeywordsByUser2(user.getUser_id(),type);
String keyword = "";
List<String> keywordList = new ArrayList<>();
for (String string : keywords) {
if(null != string && !"".equals(string.trim())){
String[] split = string.split(",");
for (String string2 : split) {
keywordList.add(string2.trim());
}
}
}
Set set = new HashSet();
set.addAll(keywordList); // 将list所有元素添加到set中 set集合特性会自动去重复
keywordList.clear();
keywordList.addAll(set);
for (String kw : keywordList) {
keyword += kw+",";
}
return keyword.length()>1?keyword.substring(0,keyword.length()-1):"";
}
private String getprojectstatus(User user,Integer type) {
List<Map<String, Object>> projectlist = projectDao.getprojectByUser2(user.getUser_id(),type);
JSONArray result = new JSONArray();
for (Map<String, Object> map : projectlist) {
String project_id = map.get("project_id").toString();
String group_id = map.get("group_id").toString();
JSONObject paramJson = new JSONObject();
List<Integer> emotionalIndex = new ArrayList<Integer>();
emotionalIndex.add(1);
emotionalIndex.add(2);
emotionalIndex.add(3);
// String dateday = DateUtil.getDateday();
paramJson.put("group_id", group_id);
paramJson.put("project_id", project_id);
paramJson.put("projectid", project_id);
paramJson.put("projectId", project_id);
paramJson.put("timeType",1);
paramJson.put("precise",0);
paramJson.put("matchingmode",1);
paramJson.put("similar",0);
paramJson.put("searchType",1);
paramJson.put("page",1);
paramJson.put("times","");
paramJson.put("timee","");
paramJson.put("emotionalIndex",emotionalIndex);
int i = 0;
JSONObject articleList = new JSONObject();
while(i<3){
try {
articleList = monitorService.getArticleSynthesizeList(paramJson);
Integer code = articleList.getInteger("code");
if(code==200){
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
JSONObject prostatus = new JSONObject();
prostatus.put("project_name", map.get("project_name"));
prostatus.put("value",articleList.getJSONObject("data").get("totalCount"));
result.add(prostatus);
}
result = sortProxyAndCdn(result);
return result.toJSONString();
}
//集合排序
private static JSONArray sortProxyAndCdn(JSONArray bindArrayResult) {
bindArrayResult.sort(Comparator.comparing(obj -> ((JSONObject) obj).getBigDecimal("value")).reversed());
return bindArrayResult;
}
private String getWarning(User user) throws NumberFormatException, java.text.ParseException {
List<Map<String, Object>> warninglist = warningarticleDao.selectWAlsitByUser(user.getUser_id());
// long USERID = Long.parseLong("15720821513");
// List<Map<String, Object>> warninglist = warningarticleDao.selectWAlsitByUser(USERID);
JSONArray list = new JSONArray();
for (Map<String, Object> res : warninglist) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String string = res.get("article_detail").toString();
JSONObject parseObject = JSONObject.parseObject(string);
res.remove("article_detail");
res.put("source_name", parseObject.get("sourcewebsitename"));
String string2 = res.get("publish_time").toString();
String a = string2.substring(0, string2.length()-2);
res.put("publish_time",a);
list.add(new JSONObject(res));
}
return list.toJSONString();
}
private String conversionHotList(JSONObject hotList) {
JSONArray jsonArray=new JSONArray();
if(hotList!=null) {
jsonArray = hotList.getJSONArray("data");
}
JSONArray list = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i).getJSONObject("_source");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("publish_time", jsonObject.get("publish_time"));
jsonObject2.put("topic", jsonObject.get("topic"));
jsonObject2.put("id", jsonObject.get("article_public_id"));
jsonObject2.put("original_weight", jsonObject.get("original_weight"));
jsonObject2.put("source_name", jsonObject.get("source_name"));
jsonObject2.put("source_url", jsonObject.get("source_url"));
jsonObject2.put("rank", Integer.parseInt(jsonObject.get("rank").toString()));
list.add(jsonObject2);
}
List<Map<String,Object>> dataArr = (List)JSONArray.parseArray(list.toJSONString(),Map.class);
dataArr = dataArr.stream()
.sorted((map2, map1) -> (int) map2.get("rank") - (int) map1.get("rank")).limit(5)
.collect(Collectors.toList());
return JSON.toJSONString(dataArr);
}
private String getReport(Integer report_type,User user) {
List<Map<String, Object>> result = reportCustomDao.searchReportByUserAndType2(user.getUser_id(),report_type);
JSONArray list = new JSONArray();
for (Map<String, Object> res : result) {
list.add(new JSONObject(res));
}
return list.toString();
}
public static void main(String[] args) {
getPolicyData();
}
/**
* 政策数据
* @return
*/
public static String getPolicyData() {
String url = "http://www.gov.cn/zhengce/zuixin.htm";
JSONArray array = new JSONArray();
try {
String gethtml = gethtml(url);
Document parse = Jsoup.parse(gethtml);
Elements select = parse.select(".news_box > .list > ul > li");
for (int i = 0; i < select.size()&& i<5; i++) {
JSONObject object = new JSONObject();
Element element = select.get(i);
String source_url = element.getElementsByTag("a").get(0).attr("href");
object.put("source_url", source_url);
int rank = i+1;
object.put("rank", rank);
object.put("original_weight", 100000);
object.put("source_name", "国务院");
String topic = element.getElementsByTag("a").get(0).text();
object.put("topic", topic);
String publish_time = element.getElementsByClass("date").get(0).text();
object.put("publish_time", publish_time+" 00:00:00");
array.add(object);
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return array.toJSONString();
}
/**
* 经济数据
* @return
*/
public static String getFinaceData() {
String url = "http://finance.eastmoney.com/a/cgnjj.html";
JSONArray array = new JSONArray();
try {
String gethtml = gethtml(url);
Document parse = Jsoup.parse(gethtml);
Elements select = parse.select("#newsListContent li");
for (int i = 0; i < select.size(); i++) {
JSONObject object = new JSONObject();
Element element = select.get(i);
String topic = element.getElementsByTag("a").get(0).text();
if(!topic.equals("")) {
String source_url = element.getElementsByTag("a").get(0).attr("href");
object.put("source_url", source_url);
int rank = i+1;
object.put("rank", rank);
object.put("original_weight", 100000);
object.put("source_name", "中方财富网");
object.put("topic", topic);
String publish_time = "2021-"+element.getElementsByClass("time").get(0).text()+":00";
//String publish_time = element.getElementsByClass("time").get(0).text();
publish_time = publish_time.replaceAll("月", "-").replaceAll("日", "");
try {
object.put("publish_time", DateUtil.FormatDate(publish_time));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
array.add(object);
}
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return array.toJSONString();
}
public static String gethtml(String url) throws ParseException, IOException, InterruptedException {

org.apache.http.client.CookieStore cookieStore = new BasicCookieStore();
CloseableHttpClient httpclient = HttpClients.createDefault();

Thread.sleep(1);
String string = null;
HttpGet httpget = new HttpGet(url);
RequestConfig config = RequestConfig.custom().setConnectTimeout(10 * 1000).setSocketTimeout(20 * 1000).build();
httpget.setConfig(config);
httpget.setHeader("User-Agent",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36");
CloseableHttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
Integer statu = response.getStatusLine().getStatusCode();
List<Cookie> cookies = null;
if (entity != null) {
string = EntityUtils.toString(entity, "utf-8");
cookies = cookieStore.getCookies();
}
response.close();
httpclient.close();
return string;
}
}

+ 737
- 0
src/main/java/com/stonedt/intelligence/quartz/VolumeDataRequest.java View File

@@ -0,0 +1,737 @@
package com.stonedt.intelligence.quartz;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLConnection;
import java.text.NumberFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.stonedt.intelligence.constant.ReportConstant;
import com.stonedt.intelligence.constant.VolumeConstant;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.TextUtil;
/**
* 声量监测数据请求
*/
@Component
public class VolumeDataRequest {
// es搜索地址
@Value("${es.search.url}")
private String es_search_url;
/**
* 1关键词情感分析数据统计分布
*/
public String keywordEmotionStatistical(String keyword, String highKeyword, String stopword, String times, String timee, Integer projectType) {
JSONObject result = new JSONObject();
try {
String es_api_keyword_emotion_statistical = VolumeConstant.es_api_keyword_emotion_statistical;
String url = es_search_url + es_api_keyword_emotion_statistical;
String[] keywords = keyword.split(",");
result.put("keyword_count", keywords.length);
List<Map<String, Object>> chart = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> positive = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> negative = new ArrayList<Map<String, Object>>();
int positive_total = 0;
int negative_total = 0;
List<Map<String, Object>> newchart = new ArrayList<Map<String, Object>>();
for (int i = 0; i < keywords.length; i++) {
try {
String params = "times=" + times + "&timee=" + timee + "&keyword=" + highKeyword + "&stopword=" + stopword
+ "&searchkeyword=" + keywords[i] + "&origintype=0&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPost = sendPost(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
JSONArray bucketsArray = parseObject.getJSONObject("aggregations").getJSONObject("top-terms-emotion")
.getJSONArray("buckets");
Map<String, Object> map = new HashMap<>();
map.put("keyword", keywords[i]);
map.put("positive_num", 0);
map.put("neutral_num", 0);
map.put("negative_num", 0);
Map<String, Object> newmap = new HashMap<>();
newmap.put("keyword", keywords[i]);
newmap.put("positive_num", 0);
newmap.put("neutral_num", 0);
newmap.put("negative_num", 0);
newmap.put("totalnum", 0);
for (int j = 0; j < bucketsArray.size(); j++) {
try {
Integer key = bucketsArray.getJSONObject(j).getInteger("key");
Integer count = bucketsArray.getJSONObject(j).getInteger("doc_count");
if (key == 1) {
positive_total += count;
map.put("positive_num", count);
newmap.put("positive_num", count);
}
if (key == 2) {
map.put("neutral_num", count);
newmap.put("neutral_num", count);
}
if (key == 3) {
negative_total += count;
map.put("negative_num", count);
newmap.put("negative_num", count);
}
} catch (Exception e) {
e.printStackTrace();
}
}
int totalnum = Integer.parseInt(parseObject.getJSONObject("hits").get("total").toString());
newmap.put("totalnum",totalnum);
chart.add(map);
positive.add(map);
negative.add(map);
newchart.add(newmap);
} catch (Exception e) {
e.printStackTrace();
}
}
try {
Collections.sort(positive, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("positive_num") - (int) o1.get("positive_num");
}
});
} catch (Exception e) {
}
for (int i = 0; i < positive.size(); i++) {
try {
// if (i > 1) {
// break;
// }
if (!positive.get(i).containsKey("positive_num")) {
positive.get(i).put("positive_num", 0);
}
String calculatedRatio = calculatedRatio((int) positive.get(i).get("positive_num"), positive_total);
positive.get(i).put("rate", calculatedRatio);
} catch (Exception e) {
e.printStackTrace();
}
}
// result.put("positive", positive);
result.put("positive", JSON.toJSON(positive));
System.out.println("positive:"+positive);
try {
Collections.sort(negative, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("negative_num") - (int) o1.get("negative_num");
}
});
} catch (Exception e) {
e.printStackTrace();
}
for (int i = 0; i < negative.size(); i++) {
try {
// if (i > 1) {
// break;
// }
if (!negative.get(i).containsKey("negative_num")) {
negative.get(i).put("negative_num", 0);
}
String calculatedRatio = calculatedRatio(
Integer.valueOf(String.valueOf(negative.get(i).get("negative_num"))), negative_total);
negative.get(i).put("rate", calculatedRatio);
} catch (Exception e) {
e.printStackTrace();
}
}
//result.put("negative", negative);
result.put("negative", JSON.toJSON(negative));
System.out.println("negative:"+negative);
//取排名前十的关键词数据
try {
Collections.sort(newchart, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("totalnum") - (int) o1.get("totalnum");
}
});
} catch (Exception e) {
e.printStackTrace();
}
List<Map<String, Object>> chartdata = new ArrayList<Map<String, Object>>();
for (int i = 0; i < newchart.size()&&i<10; i++) {
chartdata.add(newchart.get(i));
}
result.put("chart", JSON.toJSON(chartdata));
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result, SerializerFeature.DisableCircularReferenceDetect);
}
// 2关键词数据来源分布
public String keywordmediaexposure(String keyword, String highKeyword, String stopword, String times, String timee, Integer projectType) {
JSONObject result = new JSONObject();
try {
String es_api_keyword_emotion_statistical = VolumeConstant.es_api_keyword_mediaexposure;
String url = es_search_url + es_api_keyword_emotion_statistical;
String[] keywords = keyword.split(",");
result.put("keyword_count", keywords.length);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> proportion = new ArrayList<Map<String, Object>>();// 占比
Integer count = 0;// 总数量
for (int i = 0; i < keywords.length; i++) {
try {
String source[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"};
List<String> listt = Arrays.asList(source);
List<String> arrayList = new ArrayList<String>(listt);// 转换为ArrayLsit调用相关的remove方法
String params = "times=" + times + "&timee=" + timee + "&keyword=" + highKeyword + "&stopword=" + stopword
+ "&searchkeyword=" + keywords[i] + "&origintype=0&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPost = sendPost(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
Integer total = parseObject.getJSONObject("hits").getInteger("total");// 单个关键词的数量
count += total;
JSONArray bucketsArray = parseObject.getJSONObject("aggregations").getJSONObject("top-terms-emotion")
.getJSONArray("buckets");
Map<String, Object> object = new HashMap<>();// chart map
Map<String, Object> proportionMap = new HashMap<>();// text map
object.put("keyword", keywords[i]);
object.put("total", total);
proportionMap.put("keyword", keywords[i]);
proportionMap.put("total", total);
Integer one = 0;
for (int j = 0; j < bucketsArray.size(); j++) {
try {
JSONObject jsonObject = JSONObject.parseObject(String.valueOf(bucketsArray.get(j)));
String keynum = jsonObject.getString("key");
String key = TextUtil.dataSourceClassificationEng(keynum);//
Integer doc_count = jsonObject.getInteger("doc_count");
if (doc_count > one) {
one = doc_count;
proportionMap.put("one", one);
proportionMap.put("key", TextUtil.dataSourceClassification(keynum));
proportionMap.put("classify", keynum);
}
object.put(key, doc_count);
arrayList.remove(keynum);
} catch (Exception e) {
e.printStackTrace();
}
}
for (int j = 0; j < arrayList.size(); j++) {
try {
String keynum = arrayList.get(j);
String key = TextUtil.dataSourceClassificationEng(keynum);
object.put(key, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
list.add(object);
proportion.add(proportionMap);
} catch (Exception e) {
e.printStackTrace();
}
}
Collections.sort(proportion, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("total") - (int) o1.get("total");
}
});
Collections.sort(list, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("total") - (int) o1.get("total");
}
});
List<Map<String, Object>> arrayList = new ArrayList<Map<String, Object>>();
for (int i = 0; i < proportion.size(); i++) {
try {
if (i > 1) {
break;
}
Map<String, Object> hashMap = new HashMap<String, Object>();
Map<String, Object> map = proportion.get(i);
Integer total = (Integer) map.get("total");
String calculatedRatio = calculatedRatio(total, count);
hashMap.put("key", String.valueOf(map.get("key")));
hashMap.put("keyword", String.valueOf(map.get("keyword")));
hashMap.put("rate", calculatedRatio);
hashMap.put("classify", Integer.valueOf(String.valueOf(map.get("classify"))));
arrayList.add(hashMap);
} catch (Exception e) {
}
}
result.put("chart", list);
result.put("text", arrayList);
} catch (Exception e) {
e.printStackTrace();
}
return result.toJSONString();
}
// 3关键词情感分析数据走势
public String keywordsentimentFlagChart(String keyword, String stopword, String times, String timee,
Integer timetype, Integer projectType) {
JSONArray list = new JSONArray();
try {
String time_period = time_period(timetype);
String es_api_keyword_emotion_statistical = VolumeConstant.es_api_keyword_sentimentFlagChart;
String url = es_search_url + es_api_keyword_emotion_statistical;
String params = "times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword
+ "&timetype=" + time_period + "&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPost = sendPost(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
JSONArray bucketsArray = parseObject.getJSONObject("aggregations").getJSONObject("group_by_grabTime")
.getJSONArray("buckets");
for (int i = 0; i < bucketsArray.size(); i++) {
try {
JSONObject jsonObject = JSONObject.parseObject(String.valueOf(bucketsArray.get(i)));
String time = jsonObject.getString("key_as_string"); // 时间
if (timetype == 1 || timetype == 2) {
time = time.substring(0, 13);
}
if (timetype == 3 || timetype == 4) {
time = time.substring(0, 10);
}
JSONArray jsonArray = jsonObject.getJSONObject("top-terms-classify").getJSONArray("buckets");
Map<String, Object> map = new HashMap<String, Object>();
map.put("time", time);
for (int j = 0; j < jsonArray.size(); j++) {
try {
JSONObject object = JSONObject.parseObject(String.valueOf(jsonArray.get(j)));
String keynum = object.getString("key");// 情感
if ("1".equals(keynum)) {
keynum = "positive_num";
} else if ("2".equals(keynum)) {
keynum = "neutral_num";
} else if ("3".equals(keynum)) {
keynum = "negative_num";
}
String doc_count = object.getString("doc_count");
map.put(keynum, doc_count);
} catch (Exception e) {
e.printStackTrace();
}
}
list.add(map);
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list.toJSONString();
}
// 4关键词资讯数量排名
public String keywordranking(String keyword, String highKeyword, String stopword, String times, String timee, Integer projectType) {
JSONArray jsonArray = new JSONArray();
try {
String es_api_keyword_emotion_statistical = VolumeConstant.es_api_keyword_mediaexposure;
String url = es_search_url + es_api_keyword_emotion_statistical;
String[] keywords = keyword.split(",");
JSONObject result = new JSONObject();
result.put("keyword_count", keywords.length);
Integer count = 0;// 总数量
List<Map<String, Object>> arrayList = new ArrayList<Map<String, Object>>();
for (int i = 0; i < keywords.length; i++) {
try {
Map<String, Object> map = new HashMap<String, Object>();
String params = "times=" + times + "&timee=" + timee + "&keyword=" + highKeyword + "&stopword=" + stopword
+ "&searchkeyword=" + keywords[i] + "&origintype=0&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPost = sendPost(url, params);
JSONObject parseObject = JSONObject.parseObject(sendPost);
Integer total = parseObject.getJSONObject("hits").getInteger("total");// 单个关键词的数量
count += total;
map.put("keyword", keywords[i]);
map.put("count", total);
arrayList.add(map);
} catch (Exception e) {
e.printStackTrace();
}
}
Collections.sort(arrayList, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("count") - (int) o1.get("count");
}
});
for (int i = 0; i < arrayList.size(); i++) {
try {
if (i > 9) { break; }
JSONObject jsonObject = new JSONObject();
Map<String, Object> map = arrayList.get(i);
int total = (int) map.get("count");
String calculatedRatio = calculatedRatio(total, count);
jsonObject.put("keyword", String.valueOf(map.get("keyword")));
jsonObject.put("count", total);
jsonObject.put("rate", calculatedRatio);
jsonArray.add(jsonObject);
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return jsonArray.toJSONString();
}
// 5关键词高频分布统计
public String wordCloud(String keyword, String stopword, String times, String timee, String classify, Integer projectType) {
List<Map<String, Object>> result = new ArrayList<>();
try {
String url = es_search_url + ReportConstant.es_api_keyword_list;
String params = "times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword
+ "&searchType=1&classify=" + classify + "&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, params);
if (StringUtils.isNotBlank(sendPostEsSearch)) {
Map<String, Integer> map = new HashMap<>();
JSONObject parseObject = JSON.parseObject(sendPostEsSearch);
JSONArray hitsArray = parseObject.getJSONObject("hits").getJSONArray("hits");
for (int i = 0; i < hitsArray.size(); i++) {
try {
JSONObject jsonObject = hitsArray.getJSONObject(i).getJSONObject("_source")
.getJSONObject("key_words");
if (jsonObject != null) {
for (Entry<String, Object> entrySet : jsonObject.entrySet()) {
try {
String x = entrySet.getKey().trim();
int value = (int) entrySet.getValue();
if (map.containsKey(x)) {
map.put(x, map.get(x) + value);
} else {
map.put(x, value);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
for (Entry<String, Integer> entrySet : map.entrySet()) {
Map<String, Object> map2 = new HashMap<>();
map2.put("keyword", entrySet.getKey());
map2.put("value", entrySet.getValue());
result.add(map2);
}
result = result.stream().sorted((map1, map2) -> (int) map2.get("value") - (int) map1.get("value"))
.limit(100).collect(Collectors.toList());
}
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result);
}
// 6关键词曝光度环比排行
public String keywordExposure(String keyword, String highKeyword, String stopword, String times, String timee, Integer projectType) {
try {
String es_api_keyword_emotion_statistical = VolumeConstant.es_api_keyword_emotion_statistical;
String url = es_search_url + es_api_keyword_emotion_statistical;
String[] keywords = keyword.split(",");
JSONObject result = new JSONObject();
result.put("keyword_count", keywords.length);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (int i = 0; i < keywords.length; i++) {
try {
String params = "times=" + times + "&timee=" + timee + "&keyword=" + highKeyword + "&stopword=" + stopword
+ "&searchkeyword=" + keywords[i] + "&origintype=0&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPost = sendPost(url, params);
Map<String, Object> map = new HashMap<String, Object>();
JSONObject parseObject = JSONObject.parseObject(sendPost);
Integer total = parseObject.getJSONObject("hits").getInteger("total");
map.put("keyword", keywords[i]);
map.put("total", total);
JSONArray bucketsArray = parseObject.getJSONObject("aggregations").getJSONObject("top-terms-emotion")
.getJSONArray("buckets");
for (int j = 0; j < bucketsArray.size(); j++) {
JSONObject jsonObject = JSONObject.parseObject(String.valueOf(bucketsArray.get(j)));
String keynum = jsonObject.getString("key");
Integer doc_count = jsonObject.getInteger("doc_count");
if ("1".equals(keynum)) {
keynum = "positive_rate";
} else if ("2".equals(keynum)) {
keynum = "neutral_rate";
} else if ("3".equals(keynum)) {
keynum = "negative_rate";
}
String calculatedRatio = calculatedRatio(doc_count, total);
map.put(keynum, calculatedRatio);
}
// 环比
Map<String, String> ringRatioCycle = DateUtil.RingRatioCycle(times, timee);
params = "times=" + ringRatioCycle.get("startTime") + "&timee=" + ringRatioCycle.get("endTime")
+ "&keyword=" + highKeyword + "&stopword=" + stopword + "&emotionalIndex=1,2,3&projecttype=" + projectType
+ "&searchkeyword=" + keywords[i] + "&origintype=0";
sendPost = sendPost(url, params);
JSONObject jsonObject = JSONObject.parseObject(sendPost);
Integer momtotal = jsonObject.getJSONObject("hits").getInteger("total");// 环比数量
int type = 2;
if (total < momtotal) {
type = 1;
} else if (total == momtotal) {
type = 2;
} else if (total > momtotal) {
type = 3;
}
String calculatedRatio = calculatedRatio(momtotal, total);
map.put("trend", type);
map.put("chain_growth", calculatedRatio);
list.add(map);
} catch (Exception e) {
e.printStackTrace();
}
}
Collections.sort(list, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (int) o2.get("total") - (int) o1.get("total");
}
});
JSONArray array = JSONArray.parseArray(JSON.toJSONString(list));
return array.toJSONString();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
// 7自媒体渠道声量排行
public String selfMediaRanking(String keyword, String stopword, String times, String timee, Integer projectType) {
List<Map<String, Object>> result = new ArrayList<>();
try {
String url = es_search_url + ReportConstant.es_api_media_list;
String param = "classify=7&times=" + times + "&timee=" + timee + "&keyword=" + keyword + "&stopword=" + stopword
+ "&emotionalIndex=1,2,3&projecttype=" + projectType;
String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
JSONObject parseObject = JSONObject.parseObject(sendPostEsSearch);
JSONArray buckets = parseObject.getJSONObject("aggregations").getJSONObject("top-terms-aggregation")
.getJSONArray("buckets");
for (int i = 0; i < buckets.size(); i++) {
try {
if (result.size() == 5) break;
String name = buckets.getJSONObject(i).getString("key");
int total = buckets.getJSONObject(i).getIntValue("doc_count");
if (StringUtils.isNotBlank(name)) {
JSONArray jsonArray = buckets.getJSONObject(i).getJSONObject("top-terms-emotion")
.getJSONArray("buckets");
if (jsonArray.isEmpty()) continue;
Map<String, Object> map = new HashMap<>();
map.put("name", name);
map.put("volume", total);
String logo = "";
List<String> platform_names = new ArrayList<>();
for (int j = 0; j < jsonArray.size(); j++) {
try {
if (result.size() == 5) break;
String platform_name = jsonArray.getJSONObject(j).getString("key");
platform_names.add(platform_name);
if (j == 0) {
url = es_search_url + ReportConstant.es_api_wemedia_info;
param = "name=" + name + "&platform_name=" + platform_name;
sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
parseObject = JSONObject.parseObject(sendPostEsSearch);
JSONArray jsonArray2 = parseObject.getJSONArray("data");
if (!jsonArray2.isEmpty()) {
JSONObject jsonObject = jsonArray2.getJSONObject(0).getJSONObject("_source");
logo = jsonObject.getString("logo");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
map.put("logo", TextUtil.nullAsStringEmpty(logo));
map.put("platform_names", StringUtils.join(platform_names, ","));
result.add(map);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return JSON.toJSONString(result);
}
// public String cesString(String keyword, String stopword, String times, String timee) {
// String url = es_search_url + ReportConstant.es_api_ner;
// String param = "times=" + times + "&timee=" + timee + "&keyword=南京&stopword=&emotionalIndex=1,2,3";
// String sendPostEsSearch = MyHttpRequestUtil.sendPostEsSearch(url, param);
// Map<String, Object> tool = TextUtil.tool(sendPostEsSearch);
// Map<String, String> ringRatioCycle = DateUtil.RingRatioCycle(times, timee);
// param = "times=" + ringRatioCycle.get("startTime") + "&timee=" + ringRatioCycle.get("endTime")
// + "&keyword=南京&stopword=&emotionalIndex=1,2,3";
// String sendPostEsSearch2 = MyHttpRequestUtil.sendPostEsSearch(url, param);
// Map<String, Object> tool2 = TextUtil.tool(sendPostEsSearch2);
// String ringRatioCycletool = TextUtil.RingRatioCycletool(tool, tool2);
// return ringRatioCycletool;
// }
/**
* 获取指定时间周期开始和结束时间 yyyy-MM-dd HH:mm:ss
*/
public Map<String, String> time(Integer timePeriod) {
Map<String, String> time = new HashMap<String, String>();
try {
if (timePeriod == null) {
timePeriod = 1;
}
int days = 1;
switch (timePeriod) {
case 1:
days = 1;
break;
case 2:
days = 3;
break;
case 3:
days = 7;
break;
case 4:
days = 15;
break;
default:
break;
}
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime nowDateTime = LocalDateTime.now();
String now = nowDateTime.format(dateTimeFormatter);
String start = nowDateTime.minusDays(days).format(dateTimeFormatter);
time.put("start", start);
time.put("end", now);
} catch (Exception e) {
e.printStackTrace();
}
return time;
}
/**
* 计算占比 a/b 有百分号
*/
public String calculatedRatio(Integer a, Integer b) {
String result = "";
try {
if (b == 0 || a == 0) {
result = "0.00%";
} else {
BigDecimal bigDecimala = new BigDecimal(a);
BigDecimal bigDecimalb = new BigDecimal(b);
BigDecimal divide = bigDecimala.divide(bigDecimalb, 4, BigDecimal.ROUND_HALF_UP);
NumberFormat numberFormat = NumberFormat.getPercentInstance();
numberFormat.setMaximumFractionDigits(2);
result = numberFormat.format(divide.doubleValue()).replaceAll(",", "");
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/***
* 走势
*
*/
public String time_period(Integer timetype) {
String type = "1H";
try {
switch (timetype) {
case 1:
type = "1H";
break;
case 2:
type = "3H";
break;
case 3:
type = "day";
break;
case 4:
type = "day";
break;
default:
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return type;
}
/**
* 发送post请求
*
* @date 2020年4月13日 下午4:02:23
*/
public String sendPost(String url, String params) {
System.err.println(url + "?" + params);
try {
PrintWriter out = null;
BufferedReader in = null;
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
conn.setDoOutput(true);
conn.setDoInput(true);
out = new PrintWriter(conn.getOutputStream());
out.print(params);
out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
response.append(line);
}
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}

+ 133
- 0
src/main/java/com/stonedt/intelligence/quartz/VolumePTSchedule.java View File

@@ -0,0 +1,133 @@
package com.stonedt.intelligence.quartz;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.stonedt.intelligence.dao.ProjectTaskDao;
import com.stonedt.intelligence.entity.ProjectTask;
import com.stonedt.intelligence.service.ProjectService;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.SnowflakeUtil;
/**
* 声量监测数据定时任务pt
*/
@Component
public class VolumePTSchedule {
@Value("${schedule.volumept.open}")
private Integer schedule_volumept_open;
@Autowired
private VolumeDataRequest volumeDataRequest;
@Autowired
private ProjectService projectService;
@Autowired
private ProjectTaskDao projectTaskDao;
private final int[] timePeriod = {1, 2, 3, 4};
// @Scheduled(fixedRate = 10000000)
@Scheduled(cron = "0 0/5 * * * ?")
public void start() {
// 定时任务开启
if (schedule_volumept_open == 1) {
try {
List<ProjectTask> listProjectTaskByVolumeFlag = projectTaskDao.listProjectTaskByVolumeFlag();
for (int z = 0; z < listProjectTaskByVolumeFlag.size(); z++) {
try {
ProjectTask projectTask = listProjectTaskByVolumeFlag.get(z);
Long projectId = projectTask.getProject_id();
String keyword = projectTask.getSubject_word();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = projectTask.getStop_word();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = projectTask.getCharacter_word();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = projectTask.getEvent_word();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = projectTask.getRegional_word();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = projectTask.getProject_type();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
Long volume_monitor_id = SnowflakeUtil.getId();
// 循环四个时间周期
for (int i = 0; i < timePeriod.length; i++) {
try {
Map<String, Object> jsonObject = new HashMap<String, Object>();
int time_period = timePeriod[i];
jsonObject.put("time_period", time_period);
String create_time = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
.format(LocalDateTime.now());
jsonObject.put("create_time", create_time);
jsonObject.put("volume_monitor_id", volume_monitor_id);
jsonObject.put("project_id", projectId);
// 获取周期时间
Map<String, String> time = volumeDataRequest.time(time_period);
// 1、关键词情感分析数据统计分布
String keywordEmotionStatistical = volumeDataRequest.keywordEmotionStatistical(keyword, highKeyword, stopword,
time.get("start"), time.get("end"), projectType);
jsonObject.put("keyword_emotion_statistical", keywordEmotionStatistical);
// 2、关键词数据来源分布
String keyword_source_distribution = volumeDataRequest.keywordmediaexposure(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_source_distribution", keyword_source_distribution);
// 3、关键词情感分析数据走势
String keyword_emotion_trend = volumeDataRequest.keywordsentimentFlagChart(highKeyword, stopword, time.get("start"),
time.get("end"), time_period, projectType);
jsonObject.put("keyword_emotion_trend", keyword_emotion_trend);
// 4、关键词资讯数量排名
String keyword_news_rank = volumeDataRequest.keywordranking(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_news_rank", keyword_news_rank);
// 5、关键词高频分布统计
String highword_cloud = volumeDataRequest.wordCloud(highKeyword, stopword, time.get("start"), time.get("end"), "", projectType);
jsonObject.put("highword_cloud", highword_cloud);
// 6、关键词曝光度环比排行
String keyword_exposure_rank = volumeDataRequest.keywordExposure(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_exposure_rank", keyword_exposure_rank);
// 7、自媒体渠道声量排行
String media_user_volume_rank = volumeDataRequest.selfMediaRanking(highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("media_user_volume_rank", media_user_volume_rank);
int timingProject = projectService.timingProject(jsonObject);
if (timingProject == 1) {
System.out.println("插入数据!");
projectTaskDao.updateProjectTaskVolumeFlag(projectId);
} else {
System.out.println("修改数据!");
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

+ 143
- 0
src/main/java/com/stonedt/intelligence/quartz/VolumeSchedule.java View File

@@ -0,0 +1,143 @@
package com.stonedt.intelligence.quartz;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.stonedt.intelligence.entity.Project;
import com.stonedt.intelligence.service.ProjectService;
import com.stonedt.intelligence.util.ProjectUtil;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.SnowflakeUtil;
/**
* 声量监测数据定时任务
*
* @date 2020年3月27日 下午5:13:52
*/
@Component
public class VolumeSchedule {
// 定时任务开关
@Value("${schedule.volume.open}")
private Integer schedule_volume_open;
@Autowired
private VolumeDataRequest volumeDataRequest;
@Autowired
private ProjectUtil projectUtil;
@Autowired
private ProjectService projectService;
private final int[] timePeriod = {1, 2, 3, 4};
/**
* 定时任务逻辑
*/
// @Scheduled(fixedRate = 10000000)
// @Scheduled(cron = "0 0 0/12 * * ?")
@Scheduled(cron = "0 0 22 * * ? ")
public void start() {
// 定时任务开启
if (schedule_volume_open == 1) {
try {
System.err.println("声量监测 启动");
List<Project> listAllProject = projectUtil.listAllProject();
for (int z = 0; z < listAllProject.size(); z++) {
try {
Project project = listAllProject.get(z);
Long projectId = project.getProjectId();
String keyword = project.getSubjectWord();
if (StringUtils.isNotBlank(keyword)) keyword = keyword.trim();
String stopword = project.getStopWord();
if (StringUtils.isNotBlank(stopword)) stopword = stopword.trim();
String characterWord = project.getCharacterWord();
if (StringUtils.isNotBlank(characterWord)) characterWord = characterWord.trim();
String eventWord = project.getEventWord();
if (StringUtils.isNotBlank(eventWord)) eventWord = eventWord.trim();
String regionalWord = project.getRegionalWord();
if (StringUtils.isNotBlank(regionalWord)) regionalWord = regionalWord.trim();
Integer projectType = project.getProjectType();
String highKeyword = keyword;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(keyword, regionalWord, characterWord, eventWord);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(keyword);
stopword = ProjectWordUtil.highProjectStopword(stopword);
}
Long volume_monitor_id = SnowflakeUtil.getId();
// 循环四个时间周期
for (int i = 0; i < timePeriod.length; i++) {
try {
Map<String, Object> jsonObject = new HashMap<String, Object>();
int time_period = timePeriod[i];
jsonObject.put("time_period", time_period);
String create_time = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
.format(LocalDateTime.now());
jsonObject.put("create_time", create_time);
jsonObject.put("volume_monitor_id", volume_monitor_id);
jsonObject.put("project_id", projectId);
// 获取周期时间
Map<String, String> time = volumeDataRequest.time(time_period);
// 1、关键词情感分析数据统计分布
String keywordEmotionStatistical = volumeDataRequest.keywordEmotionStatistical(keyword, highKeyword, stopword,
time.get("start"), time.get("end"), projectType);
jsonObject.put("keyword_emotion_statistical", keywordEmotionStatistical);
// 2、关键词数据来源分布
String keyword_source_distribution = volumeDataRequest.keywordmediaexposure(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_source_distribution", keyword_source_distribution);
// 3、关键词情感分析数据走势
String keyword_emotion_trend = volumeDataRequest.keywordsentimentFlagChart(highKeyword, stopword, time.get("start"),
time.get("end"), time_period, projectType);
jsonObject.put("keyword_emotion_trend", keyword_emotion_trend);
// 4、关键词资讯数量排名
String keyword_news_rank = volumeDataRequest.keywordranking(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_news_rank", keyword_news_rank);
// 5、关键词高频分布统计
String highword_cloud = volumeDataRequest.wordCloud(highKeyword, stopword, time.get("start"), time.get("end"), "", projectType);
jsonObject.put("highword_cloud", highword_cloud);
// 6、关键词曝光度环比排行
String keyword_exposure_rank = volumeDataRequest.keywordExposure(keyword, highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("keyword_exposure_rank", keyword_exposure_rank);
// 7、自媒体渠道声量排行
String media_user_volume_rank = volumeDataRequest.selfMediaRanking(highKeyword, stopword, time.get("start"),
time.get("end"), projectType);
jsonObject.put("media_user_volume_rank", media_user_volume_rank);
int timingProject = projectService.timingProject(jsonObject);
if (timingProject == 1) {
System.out.println("插入数据!");
} else if (timingProject == 2) {
System.out.println("修改数据!");
} else {
System.out.println("插入结果-----" + timingProject);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.err.println("声量监测 结束");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

+ 635
- 0
src/main/java/com/stonedt/intelligence/quartz/WarningSchedule.java View File

@@ -0,0 +1,635 @@
package com.stonedt.intelligence.quartz;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.MonitorConstant;
import com.stonedt.intelligence.dao.SystemDao;
import com.stonedt.intelligence.entity.WarningSetting;
import com.stonedt.intelligence.service.EarlyWarningService;
import com.stonedt.intelligence.service.ProjectService;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MyHttpRequestUtil;
import com.stonedt.intelligence.util.ProjectWordUtil;
import com.stonedt.intelligence.util.SendMailFox;
import com.stonedt.intelligence.util.SnowFlake;
import com.stonedt.intelligence.util.TextUtil;

/**
* <p>预警定时任务</p>
* <p>Title: WarningSchedule</p>
* <p>Description: </p>
*
* @author Mapeng
* @date Apr 18, 2020
*/
@Component
public class WarningSchedule {

public static final Logger logger = LoggerFactory.getLogger(WarningSchedule.class);

public static final String searchearlywarningApi = "/yqsearch/searchlist"; //预警文章获取

public SnowFlake snowFlake = new SnowFlake();

@Value("${es.search.url}")
private String es_search_url;
@Value("${schedule.warning.open}")
private int warning_popup;
@Value("${system.url}")
private String system_url;

@Autowired
private SystemDao systemDao;
@Autowired
private ProjectService projectService;
@Autowired
private EarlyWarningService earlyWarningService;

// @Scheduled(fixedRate = 10000000)
@Scheduled(cron = "0 0/20 * * * ?")
public void start() throws ParseException {
try {
if (warning_popup != 1) return;
logger.info("预警开始......");
List<WarningSetting> listWarning = systemDao.listWarningMsg();//预警列表
if (listWarning.size() > 0) {
Date date = new Date();
String nowTime = DateUtil.nowTime();
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
for (int i = 0; i < listWarning.size(); i++) {
try {
Integer weekend_warning = listWarning.get(i).getWeekend_warning();
if (weekend_warning == 0) {
if (isWeekend(nowTime)) {
continue;
}
}
JSONObject warning_receive_time = JSONObject.parseObject(listWarning.get(i).getWarning_receive_time());
String start = warning_receive_time.getString("start");
String end = warning_receive_time.getString("end");
// 判断 当前时间 是否在预警时间范围内
if (belongCalendar(df.parse(df.format(date)), start, end)) {
JSONObject warning_interval = JSONObject.parseObject(listWarning.get(i).getWarning_interval());
int interval_type = warning_interval.getIntValue("type");
if (interval_type == 1) {
// 实时预警
search(listWarning.get(i), nowTime, 2000);
} else {
// 定时预警
int interval_time = warning_interval.getIntValue("time");//预警间隔
//判断当前时间 是否 等于 预警开启时间
String nowHhMm = df.format(date);
if (nowHhMm.equals(start)) {
search(listWarning.get(i), nowTime, 1440);//第一次预警,开始时间为前一天预警结束时间
} else {
//判断启动时间和现在的时间差
String dateday2 = DateUtil.getDateday();
String dateday = dateday2 + " " + start + ":00";
int distanceTime = (int) getDistanceTime(nowTime, dateday);
if (distanceTime % interval_time == 0) {//判断预警间隔
if (distanceTime == 0) {
search(listWarning.get(i), nowTime, 60);
} else {
search(listWarning.get(i), nowTime, (distanceTime * 60));
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
logger.info("预警开始......");
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* 查询预警消息
*/
public void search(WarningSetting warningSetting, String nowtime, Integer time) {
try {
Map<String, Object> projectByProId = projectService.getProjectByProId(warningSetting.getProject_id());
projectByProId.get("subject_word");
String subject_word = String.valueOf(projectByProId.get("subject_word"));
String character_word = String.valueOf(projectByProId.get("character_word"));
String event_word = String.valueOf(projectByProId.get("event_word"));
String regional_word = String.valueOf(projectByProId.get("regional_word"));
String stop_word = String.valueOf(projectByProId.get("stop_word"));
Integer projectType = Integer.parseInt(String.valueOf(projectByProId.get("project_type")));
// String listKeywords = "";
// if (subject_word.length() > 0 && !subject_word.equals("null")) {
// listKeywords = listKeywords + subject_word + ",";
// }
// if (character_word.length() > 0 && !character_word.equals("null")) {
// listKeywords = listKeywords + character_word + ",";
// }
// if (event_word.length() > 0 && !event_word.equals("null")) {
// listKeywords = listKeywords + event_word + ",";
// }
// if (regional_word.length() > 0 && !regional_word.equals("null")) {
// listKeywords = listKeywords + regional_word + ",";
// }
String highKeyword = subject_word;
if (projectType == 2) {
highKeyword = ProjectWordUtil.highProjectKeyword(subject_word, regional_word, character_word, event_word);
stop_word = ProjectWordUtil.highProjectStopword(stop_word);
}
if (projectType == 1) {
projectType = 2;
highKeyword = ProjectWordUtil.QuickProjectKeyword(subject_word);
stop_word = ProjectWordUtil.highProjectStopword(stop_word);
}
String listStopwords = stop_word;
//预警词
String yjword = warningSetting.getWarning_word();
//分类
String classify = warningSetting.getWarning_classify();
//匹配方式 0全文 1标题 2正文
String sitesearchtype = String.valueOf(warningSetting.getWarning_match());
String origintype = sitesearchtype;
//预警内容 0 全部 1敏感
String jycon = String.valueOf(warningSetting.getWarning_content());
String emotionalIndex = "1";
if ("0".equals(jycon)) {
emotionalIndex = "1,2,3";
}
String province = "国家";
String city = "国家";
if (city.indexOf("市辖区") != -1) {
city = province;
} else if (city.indexOf("省直辖县级行政区划") != -1) {
city = "";
}
if ("国家".equals(province)) {
province = "";
city = "";
} else {
if (province.indexOf("新疆兵团") != -1) {
province = "新疆维吾尔自治区";
city = "";
}
}
//相似文章合并(0:取消合并 1:合并)
String params = "keyword=" + highKeyword + "&searchkeyword=" + yjword + "&emotionalIndex=" + emotionalIndex + "&times=" + getTimee(nowtime, time)
+ "&timee=" + nowtime + "&searchType=0&stopword=" + listStopwords + "&page=1&size=10&origintype=" + origintype
+ "&classify=" + classify + "&province=" + province + "&city=" + city+"&projecttype="+projectType;
if(warningSetting.getWarning_similar()==0) {
String urls = es_search_url + searchearlywarningApi;
System.err.println(urls + "?" + params);
logger.info("预警查询es开始......");
String esEarlywarning = MyHttpRequestUtil.sendPostEsSearch(urls, params);
JSONObject Earlywarnings = JSONObject.parseObject(esEarlywarning);
logger.info("预警查询结束......共计:{}", Earlywarnings.getInteger("count"));
if (Earlywarnings.getInteger("code") == 200 && Earlywarnings.getInteger("count") > 0) {
JSONArray jsonArray = Earlywarnings.getJSONArray("data");
JSONObject warning_source = JSONObject.parseObject(warningSetting.getWarning_source());
int email_type = warning_source.getIntValue("type");

Boolean emailpushboolean = false;//是否是邮箱预警
Boolean systempush = false;//是否是系统预警
if (email_type == 2) {
emailpushboolean = true;
} else {
systempush = true;
}
String emailHtml = emailHtml(nowtime, warningSetting, jsonArray.size());
for (int i = 0; i < jsonArray.size(); i++) {
try {
JSONObject Earlywarning = jsonArray.getJSONObject(i).getJSONObject("_source");
String title = Earlywarning.getString("title").split("_http")[0];
String content = Earlywarning.getString("content");
if (content.length() > 255) {
content = content.substring(0, 254);
}
// String text = title + content;
// String relatedWords = TextUtil.getRelatedWords(listKeywords, yjword, text);
// if (org.apache.commons.lang3.StringUtils.isNotEmpty(relatedWords)) {
// relatedWords = relatedWords.substring(0, relatedWords.length() - 1);
// }
String sourcewebsitename = Earlywarning.getString("sourcewebsitename");
String publish_time = Earlywarning.getString("publish_time");
String article_public_id = Earlywarning.getString("article_public_id");
Integer similarvolume = Earlywarning.getInteger("similarvolume");
String emotionalIndex1 = Earlywarning.getString("emotionalIndex");
String url = system_url + "/monitor/detail/" + article_public_id;
if (systempush) {//系统预警
Map<String, Object> warning_popup = new HashMap<>();
warning_popup.put("create_time", DateUtil.nowTime());
warning_popup.put("warning_article_id", snowFlake.getId());
warning_popup.put("user_id", warningSetting.getUser_id());
warning_popup.put("popup_id", snowFlake.getId());
warning_popup.put("popup_content", content);
warning_popup.put("popup_time", DateUtil.nowTime());
warning_popup.put("article_id", article_public_id);
warning_popup.put("article_time", publish_time);
warning_popup.put("article_title", title);
warning_popup.put("article_emotion", emotionalIndex1);
warning_popup.put("status", 0);
warning_popup.put("project_id", warningSetting.getProject_id());
warning_popup.put("read_status", 0);
Map<String, Object> article_detail = new HashMap<>();
article_detail.put("sourcewebsitename", sourcewebsitename);
warning_popup.put("article_detail", JSON.toJSONString(article_detail));
// 入库
try {
boolean warning_popupresult = earlyWarningService.saveWarningPopup(warning_popup);
if (warning_popupresult) {
logger.info("预警推送插入成功");
} else {
logger.error("预警推送插入失败");
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (emailpushboolean) { //邮箱预警
if (content.length() > 180) {
content = content.substring(0, 180) + "...";
}
String econtent = jsonArray.getJSONObject(i).getJSONObject("highlight").getString("content");
if (econtent == null || "".equals(econtent.trim())) {
econtent = content;
}
JSONArray maillist = new JSONArray();
JSONObject maildetail = new JSONObject();
maildetail.put("publish_time", publish_time);
maildetail.put("similarvolume", similarvolume);
maildetail.put("sourcewebsitename", sourcewebsitename);
maildetail.put("article_id", article_public_id);
maildetail.put("title", title);
maildetail.put("econtent", econtent);
maillist.add(maildetail);
emailHtml += "<div class=\"content\">\r\n" +
"<p>" + publish_time + " 相似文章:" + similarvolume + " 来自:" + sourcewebsitename + "</p>\r\n" +
"<a href=\"" + url + "\" target=\"_blank\">" + title + "</a>\r\n" +
"<div class=\"con\"> " + econtent + "\r\n" +
"</div>\r\n" +
"</div>";
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (emailpushboolean) {
emailHtml += "</div> </body> </html>";
try {
String email_user = warning_source.getString("email");
SendMailFox.Send(email_user, "预警推送", emailHtml);
logger.info("预警邮件发送成功......");
} catch (Exception e) {
logger.info("预警邮件发送失败......{}", e.getMessage());
}
}
} else {
logger.info("预警查询结束...未查询到数据......");
}
}else {
String similarUrl = es_search_url + MonitorConstant.es_api_similarsearch_content;
String esSimilarResponse = MyHttpRequestUtil.sendPostEsSearch(similarUrl, params);
String article_public_idStr = "";
if (!esSimilarResponse.equals("")) {
List article_public_idList = new ArrayList();
JSONArray similarArray = JSON.parseArray(esSimilarResponse);
if(similarArray.size()==0) {
logger.info("预警查询结束...未查询到数据......");
return ;
}
for (int i = 0; i < similarArray.size(); i++) {
JSONObject similarJson = (JSONObject) similarArray.get(i);
String article_public_id = similarJson.getString("article_public_id");
article_public_idList.add(article_public_id);
if (i < 10) {
article_public_idStr += article_public_id + ",";
}
}
}
article_public_idStr = "&article_public_idstr="+article_public_idStr;
String getcontenturl = es_search_url + MonitorConstant.es_api_similar_contentlist;
String articleResponse = MyHttpRequestUtil.sendPostEsSearch(getcontenturl, article_public_idStr);
JSONObject articleResponseJson = JSON.parseObject(articleResponse);
logger.info("预警查询结束......共计:{}", articleResponseJson.getInteger("count"));
if (articleResponseJson.getInteger("code") == 200 && articleResponseJson.getInteger("count") > 0) {
JSONArray jsonArray = articleResponseJson.getJSONArray("data");
JSONObject warning_source = JSONObject.parseObject(warningSetting.getWarning_source());
int email_type = warning_source.getIntValue("type");

Boolean emailpushboolean = false;//是否是邮箱预警
Boolean systempush = false;//是否是系统预警
if (email_type == 2) {
emailpushboolean = true;
} else {
systempush = true;
}
String emailHtml = emailHtml(nowtime, warningSetting, jsonArray.size());
for (int i = 0; i < jsonArray.size(); i++) {
try {
JSONObject Earlywarning = jsonArray.getJSONObject(i).getJSONObject("_source");
String title = Earlywarning.getString("title").split("_http")[0];
String content = Earlywarning.getString("content");
if (content.length() > 255) {
content = content.substring(0, 254);
}
// String text = title + content;
// String relatedWords = TextUtil.getRelatedWords(listKeywords, yjword, text);
// if (org.apache.commons.lang3.StringUtils.isNotEmpty(relatedWords)) {
// relatedWords = relatedWords.substring(0, relatedWords.length() - 1);
// }
String sourcewebsitename = Earlywarning.getString("sourcewebsitename");
String publish_time = Earlywarning.getString("publish_time");
String article_public_id = Earlywarning.getString("article_public_id");
Integer similarvolume = Earlywarning.getInteger("similarvolume");
String emotionalIndex1 = Earlywarning.getString("emotionalIndex");
String url = system_url + "/monitor/detail/" + article_public_id;
if (systempush) {//系统预警
Map<String, Object> warning_popup = new HashMap<>();
warning_popup.put("create_time", DateUtil.nowTime());
warning_popup.put("warning_article_id", snowFlake.getId());
warning_popup.put("user_id", warningSetting.getUser_id());
warning_popup.put("popup_id", snowFlake.getId());
warning_popup.put("popup_content", content);
warning_popup.put("popup_time", DateUtil.nowTime());
warning_popup.put("article_id", article_public_id);
warning_popup.put("article_time", publish_time);
warning_popup.put("article_title", title);
warning_popup.put("article_emotion", emotionalIndex1);
warning_popup.put("status", 0);
warning_popup.put("project_id", warningSetting.getProject_id());
warning_popup.put("read_status", 0);
Map<String, Object> article_detail = new HashMap<>();
article_detail.put("sourcewebsitename", sourcewebsitename);
warning_popup.put("article_detail", JSON.toJSONString(article_detail));
// 入库
try {
boolean warning_popupresult = earlyWarningService.saveWarningPopup(warning_popup);
if (warning_popupresult) {
logger.info("预警推送插入成功");
} else {
logger.error("预警推送插入失败");
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (emailpushboolean) { //邮箱预警
if (content.length() > 180) {
content = content.substring(0, 180) + "...";
}
String econtent = jsonArray.getJSONObject(i).getJSONObject("highlight").getString("content");
if (econtent == null || "".equals(econtent.trim())) {
econtent = content;
}
JSONArray maillist = new JSONArray();
JSONObject maildetail = new JSONObject();
maildetail.put("publish_time", publish_time);
maildetail.put("similarvolume", similarvolume);
maildetail.put("sourcewebsitename", sourcewebsitename);
maildetail.put("article_id", article_public_id);
maildetail.put("title", title);
maildetail.put("econtent", econtent);
maillist.add(maildetail);
emailHtml += "<div class=\"content\">\r\n" +
"<p>" + publish_time + " 相似文章:" + similarvolume + " 来自:" + sourcewebsitename + "</p>\r\n" +
"<a href=\"" + url + "\" target=\"_blank\">" + title + "</a>\r\n" +
"<div class=\"con\"> " + econtent + "\r\n" +
"</div>\r\n" +
"</div>";
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (emailpushboolean) {
emailHtml += "</div> </body> </html>";
try {
String email_user = warning_source.getString("email");
SendMailFox.Send(email_user, "预警推送", emailHtml);
logger.info("预警邮件发送成功......");
} catch (Exception e) {
logger.info("预警邮件发送失败......{}", e.getMessage());
}
}
} else {
logger.info("预警查询结束...未查询到数据......");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* @param nowtime
* @param warningSetting
* @param warnSize 预警数量
*/
private static String emailHtml(String nowtime, WarningSetting warningSetting, int warnSize) {
String emailcontent = "<html>\r\n" +
" <head>\r\n" +
" <meta charset=\"utf-8\">\r\n" +
" <title>email</title>\r\n" +
" <style type=\"text/css\">\r\n" +
" body{\r\n" +
" background: url(https://cdn-a-files.yqt365.com/images/wap/bg.jpg) no-repeat;\r\n" +
" background-size: cover;\r\n" +
" }\r\n" +
" .main{\r\n" +
" width: 750px;\r\n" +
" margin: 0 auto;\r\n" +
" background: #ffffff;\r\n" +
" padding: 15px;\r\n" +
" }\r\n" +
" .imglogo{\r\n" +
" border-bottom: dashed 1px #ccc;\r\n" +
" }\r\n" +
" .title{\r\n" +
" margin-top:20px;\r\n" +
" border-bottom: #CCCCCC dashed 1px;\r\n" +
" }\r\n" +
" .content{\r\n" +
" width: 100%;\r\n" +
" border-bottom: #CCCCCC dashed 1px;\r\n" +
" padding-bottom: 10px;\r\n" +
" }\r\n" +
" .content:hover{\r\n" +
" background: #f2f2f2;\r\n" +
" }\r\n" +
" .content p{\r\n" +
" color: #9f9f9f;\r\n" +
" font-size: 10px;\r\n" +
" }\r\n" +
" .con{\r\n" +
" margin-top:10px;\r\n" +
" color: #676767;\r\n" +
" }\r\n" +
" .content a{\r\n" +
" text-decoration: none;\r\n" +
" color: #0e7cd8;\r\n" +
" }\r\n" +
" .time{\r\n" +
" color:#e9610f !important;\r\n" +
" }\r\n" +
" .title span{\r\n" +
" color:#e02222;\r\n" +
" }\r\n" +
" </style>\r\n" +
" </head>\r\n" +
" <body>\r\n" +
" <div class=\"main\">\r\n" +
" <div class=\"imglogo\">\r\n" +
" <img src=\"http://www.chinapost.com.cn/res/chinapostplan/structure/181041269.png\" >\r\n" +
" </div>\r\n" +
" <div class=\"title\">" +
" <p>截止时间:<span class=\"time\">" + nowtime + "</span></p> \r\n" +
" <p>您的监测方案<span>[" + warningSetting.getProject_name() + "]</span>新增<span>" + warnSize + "</span>条预警。显示如下:</p> \r\n" +
" </div>";
return emailcontent;
}

/**
* 是否是周末
*
* @param time
* @return
* @throws ParseException
*/
private static boolean isWeekend(String time) throws ParseException {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = format.parse(time);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
return true;
} else
return false;
} catch (Exception e) {
return false;
}
}

/**
* 判断时间是否在范围内
*
* @param nowTime
* @param begintime
* @param endtime
* @return
* @throws ParseException
*/
private static boolean belongCalendar(Date nowTime, String begintime, String endtime) {
try {
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Date beginTime = df.parse(begintime);
Date endTime = df.parse(endtime);
// 设置当前时间
Calendar date = Calendar.getInstance();
date.setTime(nowTime);
// 设置开始时间
Calendar begin = Calendar.getInstance();
begin.setTime(beginTime);
// 设置结束时间
Calendar end = Calendar.getInstance();
end.setTime(endTime);
// 处于开始时间之后,和结束时间之前的判断
if (date.after(begin) && date.before(end)) {
return true;
} else {
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}

/**
* 两个时间相差距离多少天多少小时多少分多少秒
*
* @param str1 时间参数 1 格式:1990-01-01 12:00:00
* @param str2 时间参数 2 格式:2009-01-01 12:00:00
* @return String 返回值为:xx天xx小时xx分xx秒
*/
public static long getDistanceTime(String str1, String str2) {
long day = 0;
long hour = 0;
long min = 0;
@SuppressWarnings("unused")
long sec = 0;
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date one;
Date two;
try {
one = df.parse(str1);
two = df.parse(str2);
long time1 = one.getTime();
long time2 = two.getTime();
long diff;
if (time1 < time2) {
diff = time2 - time1;
} else {
diff = time1 - time2;
}
day = diff / (24 * 60 * 60 * 1000);
hour = (diff / (60 * 60 * 1000) - day * 24);
min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
} catch (ParseException e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
//System.out.println(hour + "小时" + min + "分" + sec + "秒");
return hour;
}

public static String getTimee(String time, Integer interval) {
String format = "";
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = sdf.parse(time);
Calendar nowTime = Calendar.getInstance();
nowTime.setTime(parse);
nowTime.add(Calendar.MINUTE, -interval);
format = sdf.format(nowTime.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return format;
}
}

+ 165
- 0
src/main/java/com/stonedt/intelligence/quartz/WechatSchedule.java View File

@@ -0,0 +1,165 @@
package com.stonedt.intelligence.quartz;

import java.io.IOException;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.stonedt.intelligence.util.DateUtil;
import com.stonedt.intelligence.util.MD5Util;
import com.stonedt.intelligence.util.RedisUtil;
import com.stonedt.intelligence.vo.FullSearchParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.WechatConstant;
import com.stonedt.intelligence.dao.UserDao;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.util.MyHttpRequestUtil;

/**
* 监测分析定时任务
*/
@SuppressWarnings({"deprecation", "unused"})
@Component
public class WechatSchedule {

// 定时任务开关
@Value("${schedule.wechat.open}")
private Integer schedule_wechat_open;
@Autowired
private UserDao userDao;
@Autowired
private RedisUtil redisUtil;
/**
* 模板消息
*/

@Scheduled(cron = "0 0 18 * * ?")
//@Scheduled(cron = "0 0/1 * * * ?")
public void popularInformation() {
if(schedule_wechat_open==1) {
//获取accesstoken
System.out.println("开始推送");
String accesstokenresult = WechatConstant.api_wechat_template;
try {
String accesstoken = MyHttpRequestUtil.HttpGet(accesstokenresult);
JSONObject accesstokenjson = JSONObject.parseObject(accesstoken);
if(accesstokenjson.containsKey("access_token")) {
String access_tokenstr = accesstokenjson.get("access_token").toString();
//推送消息
//List<User> list = userDao.getUserByWechatUser();
String wechat_user = MyHttpRequestUtil.HttpGet(WechatConstant.api_wechat_user+"access_token="+access_tokenstr);
JSONArray jsonArray = JSONObject.parseObject(wechat_user).getJSONObject("data").getJSONArray("openid");
for (Object object : jsonArray) {
String openid = object.toString();//用户openid
System.out.println(openid);
sendtemplateinfo(openid,WechatConstant.api_wechat_template_id,access_tokenstr);
}
// for (User user : list) {
// String openid = user.getOpenid();//用户openid
//
// sendtemplateinfo(openid,WechatConstant.api_wechat_template_id,access_tokenstr);
// }
}
System.out.println("accesstoken:"+accesstoken);
System.out.println("完成");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}
public void sendtemplateinfo(String openid,String template_id,String access_token) {
String url = WechatConstant.api_wechat_templatepush+"?access_token="+access_token;
try {
JSONObject datajson = new JSONObject();
datajson.put("touser", openid);
datajson.put("template_id", template_id);
datajson.put("url", "http://app.stonedt.com/hot/hotpage");
JSONObject templatedata = new JSONObject();

JSONObject firstdata = new JSONObject();
firstdata.put("value", DateUtil.getDateday() + "全网热门汇总");
firstdata.put("color", "#173177");
templatedata.put("first", firstdata);

JSONObject reasondata = new JSONObject();
FullSearchParam searchParam = new FullSearchParam();
searchParam.setPageNum(1);
searchParam.setClassify("4");
String keyString = MD5Util.getMD5( searchParam.getPageNum()+ searchParam.getClassify() + "百度" + "");
System.err.println("redis key" + keyString);
String key = redisUtil.getKey(keyString);
JSONObject jsonObject = JSONObject.parseObject(key);
JSONArray data = jsonObject.getJSONArray("data");
StringBuffer dataString = new StringBuffer();
for (int i = 0; i < 10; i++) {
JSONObject jsonObject1 = data.getJSONObject(i);
JSONObject source = jsonObject1.getJSONObject("_source");
String topic = source.getString("topic");
dataString.append((i+1)+".");
dataString.append(topic);
dataString.append("\n");
}
reasondata.put("value", dataString);
reasondata.put("color", "#173177");
templatedata.put("keyword2", reasondata);


JSONObject timedata = new JSONObject();
timedata.put("value", "查看更多全网热点");
timedata.put("color", "#173177");
templatedata.put("keyword3", timedata);

JSONObject remarkdata = new JSONObject();
remarkdata.put("value", DateUtil.getDateday());
remarkdata.put("color", "#173177");
templatedata.put("keyword1", remarkdata);

datajson.put("data", templatedata);
String sendPostRaw = MyHttpRequestUtil.sendPostRaw(url,datajson.toJSONString(),"utf-8");
System.out.println(sendPostRaw);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


}

+ 176
- 0
src/main/java/com/stonedt/intelligence/quartz/WechatqrcodeSchedule.java View File

@@ -0,0 +1,176 @@
package com.stonedt.intelligence.quartz;

import java.io.IOException;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.stonedt.intelligence.constant.WechatConstant;
import com.stonedt.intelligence.dao.UserDao;
import com.stonedt.intelligence.entity.User;
import com.stonedt.intelligence.util.MyHttpRequestUtil;

/**
* 微信定时生成二维码
*/
@SuppressWarnings({"deprecation", "unused"})
@Component
public class WechatqrcodeSchedule {

// 定时任务开关
@Value("${schedule.wechatqrcode.open}")
private Integer schedule_wechatqrcode_open;
@Autowired
private UserDao userDao;
/**
* 生成二维码
* @throws IOException
* @throws ParseException
*/
@Scheduled(cron = "0 0 23 * * ?")
public void popularInformation() throws ParseException, IOException {
if(schedule_wechatqrcode_open==1) {
String accesstokenresult = WechatConstant.api_wechat_template;
String accesstoken = MyHttpRequestUtil.HttpGet(accesstokenresult);
List<User> list = userDao.getAllUser();
for (User user : list) {
String telephone = user.getTelephone();
try {
JSONObject accesstokenjson = JSONObject.parseObject(accesstoken);
if(accesstokenjson.containsKey("access_token"))
{
String access_tokenstr = accesstokenjson.get("access_token").toString();
//生成临时二维码
String url = WechatConstant.api_wechat_temporaryqrcode+"?access_token="+access_tokenstr;
getqrcode(telephone,url);
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
private void getqrcode(String telephone, String url) {
JSONObject datajson = new JSONObject();
datajson.put("expire_seconds", 604800);
datajson.put("action_name", "QR_STR_SCENE");
JSONObject scenestrjson = new JSONObject();
scenestrjson.put("scene_str", telephone);
JSONObject scenejson = new JSONObject();
scenejson.put("scene", scenestrjson);
datajson.put("action_info", scenejson);
try {
String sendPostRaw = "";
sendPostRaw = MyHttpRequestUtil.sendPostRaw(url,datajson.toJSONString(),"utf-8");
JSONObject parseObject = JSONObject.parseObject(sendPostRaw);
String ticket = parseObject.get("ticket").toString();
ticket = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="+ticket;
userDao.addticket(telephone,ticket);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String sendPostRaw(String url, String params, String encoding) throws IOException {
String body = "";
try {
//创建httpclient对象
CloseableHttpClient client = HttpClients.createDefault();
//创建post方式请求对象
HttpPost httpPost = new HttpPost(url);

//装填参数
StringEntity s = new StringEntity(params, "utf-8");
s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8"));
//设置参数到请求对象中
httpPost.setEntity(s);
System.out.println("请求地址:" + url);
// System.out.println("请求参数:"+nvps.toString());

//设置header信息
//指定报文头【Content-type】、【User-Agent】
// httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
httpPost.setHeader("Content-type", "application/json;charset=UTF-8");
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36");

//执行请求操作,并拿到结果(同步阻塞)
CloseableHttpResponse response = client.execute(httpPost);
//获取结果实体
HttpEntity entity = response.getEntity();
if (entity != null) {
//按指定编码转换结果实体为String类型
body = EntityUtils.toString(entity, encoding);
}
EntityUtils.consume(entity);
//释放链接
response.close();
} catch (Exception e) {
e.printStackTrace();
}
return body;
}


}

+ 1279
- 0
src/main/java/com/stonedt/intelligence/quartz/publicoptionQuartz.java
File diff suppressed because it is too large
View File


+ 29
- 0
src/main/java/com/stonedt/intelligence/service/AnalysisService.java View File

@@ -0,0 +1,29 @@
package com.stonedt.intelligence.service;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.stonedt.intelligence.entity.Analysis;
public interface AnalysisService {
Analysis getAanlysisByProjectidAndTimeperiod(Long projectId, Integer timePeriod);
// 历史代码
int insert(Analysis a);
Analysis getInfoByProjectid(@Param("projectid") Long projectid,
@Param("timePeriod")Integer timePeriod);
Analysis getAnalysisMonitorProjectid(@Param("projectId")Long projectId,
@Param("timePeriod")Integer timePeriod);
List<Map<String, Object>> latestnews(Long projectid, Integer timePeriod);
}

+ 16
- 0
src/main/java/com/stonedt/intelligence/service/ArticleService.java View File

@@ -0,0 +1,16 @@
package com.stonedt.intelligence.service;
/**
*
* @date 2020年4月17日 下午6:11:54
*/
import java.util.List;
import java.util.Map;
public interface ArticleService {
Map<String, Object> articleDetail(String articleId, Long projectId,String relatedword,String publish_time);
List<Map<String, Object>> relatedArticles(String keywords);
}

+ 19
- 0
src/main/java/com/stonedt/intelligence/service/DatafavoriteService.java View File

@@ -0,0 +1,19 @@
package com.stonedt.intelligence.service;

import com.stonedt.intelligence.entity.DatafavoriteEntity;

public interface DatafavoriteService {

String adddata(Long user_id, String id, Long projectid, Long groupid, String title, String source_name,
String emotionalIndex, String publish_time);

void updateemtion(String id, int flag, String es_search_url,String publish_time);

void deletedata(String id, int flag, String es_search_url,String publish_time);

String updatedata(Long user_id, String id, Long projectid, Long groupid, String title, String source_name,
String emotionalIndex, String publish_time);

DatafavoriteEntity selectdata(Long user_id, String id);

}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save