Răsfoiți Sursa

哔蹦服务器

slambb 4 ani în urmă
comite
240ae93299
100 a modificat fișierele cu 9125 adăugiri și 0 ștergeri
  1. 31 0
      .gitignore
  2. 118 0
      .mvn/wrapper/MavenWrapperDownloader.java
  3. BIN
      .mvn/wrapper/maven-wrapper.jar
  4. 2 0
      .mvn/wrapper/maven-wrapper.properties
  5. 310 0
      mvnw
  6. 182 0
      mvnw.cmd
  7. 196 0
      pom.xml
  8. 18 0
      src/main/java/com/YuyeTech/TPlat/TPlatApplication.java
  9. 18 0
      src/main/java/com/YuyeTech/TPlat/VO/AiInfoVO.java
  10. 22 0
      src/main/java/com/YuyeTech/TPlat/VO/FavoritesVO.java
  11. 27 0
      src/main/java/com/YuyeTech/TPlat/VO/FitnessVO.java
  12. 35 0
      src/main/java/com/YuyeTech/TPlat/VO/FriendInfoVO.java
  13. 24 0
      src/main/java/com/YuyeTech/TPlat/VO/GameVO.java
  14. 14 0
      src/main/java/com/YuyeTech/TPlat/VO/LoginVO.java
  15. 25 0
      src/main/java/com/YuyeTech/TPlat/VO/RankInfoVO.java
  16. 34 0
      src/main/java/com/YuyeTech/TPlat/VO/RankingVO.java
  17. 25 0
      src/main/java/com/YuyeTech/TPlat/VO/ResultVO.java
  18. 38 0
      src/main/java/com/YuyeTech/TPlat/VO/UserInfoVO.java
  19. 166 0
      src/main/java/com/YuyeTech/TPlat/aspect/AuthorizeAspect.java
  20. 112 0
      src/main/java/com/YuyeTech/TPlat/aspect/AuthorizeFilter.java
  21. 32 0
      src/main/java/com/YuyeTech/TPlat/config/AliyunConfig.java
  22. 18 0
      src/main/java/com/YuyeTech/TPlat/config/GameConfig.java
  23. 34 0
      src/main/java/com/YuyeTech/TPlat/config/WebConfig.java
  24. 20 0
      src/main/java/com/YuyeTech/TPlat/config/WechatAccountConfig.java
  25. 147 0
      src/main/java/com/YuyeTech/TPlat/config/WxMaConfiguration.java
  26. 46 0
      src/main/java/com/YuyeTech/TPlat/config/WxMaProperties.java
  27. 17 0
      src/main/java/com/YuyeTech/TPlat/config/config.java
  28. 11 0
      src/main/java/com/YuyeTech/TPlat/constant/CookieConstant.java
  29. 12 0
      src/main/java/com/YuyeTech/TPlat/constant/RankingConstant.java
  30. 17 0
      src/main/java/com/YuyeTech/TPlat/constant/RedisConstant.java
  31. 153 0
      src/main/java/com/YuyeTech/TPlat/controller/A_TDController.java
  32. 86 0
      src/main/java/com/YuyeTech/TPlat/controller/AppController.java
  33. 337 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageBLEDeviceController.java
  34. 199 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageDeviceController.java
  35. 417 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageFileManagementController.java
  36. 768 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageGameController.java
  37. 157 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageManagerController.java
  38. 232 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstagePictureController.java
  39. 85 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageRecommendController.java
  40. 111 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageTagController.java
  41. 113 0
      src/main/java/com/YuyeTech/TPlat/controller/BackstageUserController.java
  42. 113 0
      src/main/java/com/YuyeTech/TPlat/controller/BluetoothController.java
  43. 62 0
      src/main/java/com/YuyeTech/TPlat/controller/ClientGameInfoController.java
  44. 86 0
      src/main/java/com/YuyeTech/TPlat/controller/DeviceController.java
  45. 158 0
      src/main/java/com/YuyeTech/TPlat/controller/FavoritesController.java
  46. 130 0
      src/main/java/com/YuyeTech/TPlat/controller/FcController.java
  47. 85 0
      src/main/java/com/YuyeTech/TPlat/controller/FitnessProgramController.java
  48. 244 0
      src/main/java/com/YuyeTech/TPlat/controller/GameInfoController.java
  49. 374 0
      src/main/java/com/YuyeTech/TPlat/controller/LevelController.java
  50. 718 0
      src/main/java/com/YuyeTech/TPlat/controller/LoginController.java
  51. 127 0
      src/main/java/com/YuyeTech/TPlat/controller/ManagerController.java
  52. 28 0
      src/main/java/com/YuyeTech/TPlat/controller/NavigationController.java
  53. 49 0
      src/main/java/com/YuyeTech/TPlat/controller/OtaController.java
  54. 285 0
      src/main/java/com/YuyeTech/TPlat/controller/RankingController.java
  55. 130 0
      src/main/java/com/YuyeTech/TPlat/controller/RecentlyPlayingController.java
  56. 47 0
      src/main/java/com/YuyeTech/TPlat/controller/RewardController.java
  57. 102 0
      src/main/java/com/YuyeTech/TPlat/controller/UploadController.java
  58. 618 0
      src/main/java/com/YuyeTech/TPlat/controller/UserInfoController.java
  59. 30 0
      src/main/java/com/YuyeTech/TPlat/controller/wxController.java
  60. 19 0
      src/main/java/com/YuyeTech/TPlat/dataobject/AdminInfo.java
  61. 26 0
      src/main/java/com/YuyeTech/TPlat/dataobject/AiInfo.java
  62. 25 0
      src/main/java/com/YuyeTech/TPlat/dataobject/AppleInfo.java
  63. 35 0
      src/main/java/com/YuyeTech/TPlat/dataobject/BluetoothInfo.java
  64. 39 0
      src/main/java/com/YuyeTech/TPlat/dataobject/ClientInfo.java
  65. 32 0
      src/main/java/com/YuyeTech/TPlat/dataobject/DeviceInfo.java
  66. 26 0
      src/main/java/com/YuyeTech/TPlat/dataobject/Favorites.java
  67. 38 0
      src/main/java/com/YuyeTech/TPlat/dataobject/FcCategory.java
  68. 24 0
      src/main/java/com/YuyeTech/TPlat/dataobject/FcCategoryReference.java
  69. 34 0
      src/main/java/com/YuyeTech/TPlat/dataobject/FcInfo.java
  70. 25 0
      src/main/java/com/YuyeTech/TPlat/dataobject/FitnessProgram.java
  71. 27 0
      src/main/java/com/YuyeTech/TPlat/dataobject/FriendInfo.java
  72. 36 0
      src/main/java/com/YuyeTech/TPlat/dataobject/GameCategory.java
  73. 40 0
      src/main/java/com/YuyeTech/TPlat/dataobject/GameInfo.java
  74. 24 0
      src/main/java/com/YuyeTech/TPlat/dataobject/GamePicture.java
  75. 32 0
      src/main/java/com/YuyeTech/TPlat/dataobject/GameTag.java
  76. 24 0
      src/main/java/com/YuyeTech/TPlat/dataobject/GameTagReference.java
  77. 37 0
      src/main/java/com/YuyeTech/TPlat/dataobject/LevelCondition.java
  78. 26 0
      src/main/java/com/YuyeTech/TPlat/dataobject/LevelHonor.java
  79. 43 0
      src/main/java/com/YuyeTech/TPlat/dataobject/LevelJump.java
  80. 24 0
      src/main/java/com/YuyeTech/TPlat/dataobject/MainInfo.java
  81. 25 0
      src/main/java/com/YuyeTech/TPlat/dataobject/OtaInfo.java
  82. 22 0
      src/main/java/com/YuyeTech/TPlat/dataobject/Pictures.java
  83. 42 0
      src/main/java/com/YuyeTech/TPlat/dataobject/ProductCategory.java
  84. 29 0
      src/main/java/com/YuyeTech/TPlat/dataobject/RankInfo.java
  85. 30 0
      src/main/java/com/YuyeTech/TPlat/dataobject/Ranking.java
  86. 31 0
      src/main/java/com/YuyeTech/TPlat/dataobject/RecentlyPlaying.java
  87. 29 0
      src/main/java/com/YuyeTech/TPlat/dataobject/Recommend.java
  88. 43 0
      src/main/java/com/YuyeTech/TPlat/dataobject/UserInfo.java
  89. 31 0
      src/main/java/com/YuyeTech/TPlat/dataobject/UserLevel.java
  90. 43 0
      src/main/java/com/YuyeTech/TPlat/dataobject/UserReward.java
  91. 27 0
      src/main/java/com/YuyeTech/TPlat/dataobject/UserWallets.java
  92. 32 0
      src/main/java/com/YuyeTech/TPlat/dataobject/VersionCode.java
  93. 30 0
      src/main/java/com/YuyeTech/TPlat/dataobject/VersionInfo.java
  94. 24 0
      src/main/java/com/YuyeTech/TPlat/dataobject/WeightInfo.java
  95. 26 0
      src/main/java/com/YuyeTech/TPlat/dataobject/WxInfo.java
  96. 28 0
      src/main/java/com/YuyeTech/TPlat/dto/BLToothDTO.java
  97. 28 0
      src/main/java/com/YuyeTech/TPlat/dto/DeviceBindDTO.java
  98. 54 0
      src/main/java/com/YuyeTech/TPlat/dto/FcDTO.java
  99. 60 0
      src/main/java/com/YuyeTech/TPlat/dto/FriendInfoDTO.java
  100. 60 0
      src/main/java/com/YuyeTech/TPlat/dto/GameDTO.java

+ 31 - 0
.gitignore

@@ -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/

+ 118 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,118 @@
+/*
+ * Copyright 2012-2019 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.5";
+    /**
+     * 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


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

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

+ 310 - 0
mvnw

@@ -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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 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.5/maven-wrapper-0.5.5.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.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

@@ -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 Maven2 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 key stroke 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.5/maven-wrapper-0.5.5.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.5/maven-wrapper-0.5.5.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%

+ 196 - 0
pom.xml

@@ -0,0 +1,196 @@
+<?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.2.1.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.slambb</groupId>
+    <artifactId>smallshop</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>smallshop</name>
+    <description>Demo project for Spring Boot</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <!--添加lombok工具,需要在plugin下载-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <!--mysql-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <!--操作数据库工具-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+
+        <!--微信小程序sdk-->
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-miniapp</artifactId>
+            <version>3.6.0</version>
+        </dependency>
+        <!--缓存服务-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+
+        <!--阿里云oss服务-->
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>3.8.0</version>
+        </dependency>
+
+        <!--配置lettuce时候,引入-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+
+        <!--阿里云短信服务-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>net.coobird</groupId>
+            <artifactId>thumbnailator</artifactId>
+            <version>0.4.8</version>
+        </dependency>
+
+        <!--验证苹果登录操作相关-->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>jwks-rsa</artifactId>
+            <version>0.9.0</version>
+        </dependency>
+<!--        <dependency>-->
+<!--        <groupId>org.apache.httpcomponents</groupId>-->
+<!--        <artifactId>httpclient</artifactId>-->
+<!--        <version>4.5.5</version>-->
+<!--    </dependency>-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.60</version>
+        </dependency>
+
+        <!--二维码依赖-->
+        <!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.3.3</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>3.3.3</version>
+        </dependency>
+
+        <!--后台管理相关-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>angularjs</artifactId>
+            <version>1.5.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>angular-translate</artifactId>
+            <version>2.9.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>ng-file-upload</artifactId>
+            <version>12.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-compress</artifactId>
+            <version>1.12</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.junrar</groupId>
+            <artifactId>junrar</artifactId>
+            <version>0.7</version>
+        </dependency>
+        <!--RSA加密部分-->
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.13</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <finalName>TPlat</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 18 - 0
src/main/java/com/YuyeTech/TPlat/TPlatApplication.java

@@ -0,0 +1,18 @@
+package com.YuyeTech.TPlat;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+
+@SpringBootApplication
+@ServletComponentScan(basePackages = "com.slambb.smallshop")
+public class TPlatApplication {
+//    @PostConstruct
+//    void started() {
+//        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+//    }
+    public static void main(String[] args) {
+        SpringApplication.run(TPlatApplication.class, args);
+    }
+
+}

+ 18 - 0
src/main/java/com/YuyeTech/TPlat/VO/AiInfoVO.java

@@ -0,0 +1,18 @@
+package com.YuyeTech.TPlat.VO;
+
+import lombok.Data;
+
+/**
+ * @author:slambb
+ * @date:2020/3/25
+ */
+@Data
+public class AiInfoVO {
+
+    private Integer aiId;
+    private String aiName;
+    private String aiAvatar;
+    private Integer aiGender;
+    private String aiType;
+
+}

+ 22 - 0
src/main/java/com/YuyeTech/TPlat/VO/FavoritesVO.java

@@ -0,0 +1,22 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/14
+ */
+@Data
+public class FavoritesVO {
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date createTime;
+
+    private Double targetWeight;
+
+    private Integer calorie;
+
+    private Double sportTime;
+}

+ 27 - 0
src/main/java/com/YuyeTech/TPlat/VO/FitnessVO.java

@@ -0,0 +1,27 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/2
+ */
+@Data
+public class FitnessVO {
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy/MM/dd",timezone="GMT+8")
+    private Date startTime;
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy/MM/dd",timezone="GMT+8")
+    private Date endTime;
+
+    private Double targetWeight;
+
+    private Integer cumulativeCalorie;
+
+    private Integer calorie;
+
+    private Double sportTime;
+}

+ 35 - 0
src/main/java/com/YuyeTech/TPlat/VO/FriendInfoVO.java

@@ -0,0 +1,35 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 用户信息
+ * 返回给前端的json字段格式
+ * @author:slambb
+ * @date:2019/12/21
+ */
+@Data
+public class FriendInfoVO {
+
+    private String username;
+
+    private String gender;
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy/MM/dd",timezone="GMT+8")
+    private Date birthday;
+
+    private String signature;
+
+    private String avatarUrl;
+
+    private String cityCode;
+
+    private double height;
+
+    private double weight;
+
+
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/VO/GameVO.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/3/20
+ */
+
+@Data
+public class GameVO {
+    private String gameId;
+    private String gameName;
+    private String gameDescription;
+    private String gameIcon;
+    private String gamePicture;
+    private Boolean gameFavorite;
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
+    private Date createTime;
+}

+ 14 - 0
src/main/java/com/YuyeTech/TPlat/VO/LoginVO.java

@@ -0,0 +1,14 @@
+package com.YuyeTech.TPlat.VO;
+
+import lombok.Data;
+
+/**
+ * @author:slambb
+ * @date:2019/12/26
+ */
+@Data
+public class LoginVO {
+    private String token;
+    //是否是新用户
+    private Boolean newUser;
+}

+ 25 - 0
src/main/java/com/YuyeTech/TPlat/VO/RankInfoVO.java

@@ -0,0 +1,25 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author:slambb
+ * @date:2020/3/20
+ */
+
+@Data
+public class RankInfoVO {
+
+    @JsonProperty("rankScore")
+    private Double rankScore;
+
+    @JsonProperty("rankType")
+    private Integer rankType;
+    @JsonProperty("rankShow")
+    private Integer rankShow;
+
+    @JsonProperty("rankGameId")
+    private String RObjectId;
+
+}

+ 34 - 0
src/main/java/com/YuyeTech/TPlat/VO/RankingVO.java

@@ -0,0 +1,34 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.YuyeTech.TPlat.dto.UserDTO;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author:slambb
+ * @date:2020/3/19
+ */
+@Data
+public class RankingVO {
+
+    @JsonProperty("userInfo")
+    private UserInfoVO userInfo;
+
+    @JsonProperty("userScore")
+    private Double userScore;
+
+    @JsonProperty("userRank")
+    private Long userRank;
+
+    @JsonProperty("rankingList")
+    private List<UserDTO> userInfoVOList;
+
+    @JsonProperty("rankScoreList")
+    private List<Double> scoreList;
+
+    @JsonProperty("rankingType")
+    private String type;
+
+}

+ 25 - 0
src/main/java/com/YuyeTech/TPlat/VO/ResultVO.java

@@ -0,0 +1,25 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * http 请求返回的最外层对象
+ *
+ * @author:slambb
+ * @date:2019/12/2
+ */
+
+@Data
+public class ResultVO<T> {
+    //错误码
+    private Integer code;
+    //请求返回信息
+    private String msg;
+    //请求返回数据
+    private T data;
+
+
+//    @JsonProperty("name")
+//    private String TestName;
+}

+ 38 - 0
src/main/java/com/YuyeTech/TPlat/VO/UserInfoVO.java

@@ -0,0 +1,38 @@
+package com.YuyeTech.TPlat.VO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 用户信息
+ * 返回给前端的json字段格式
+ * @author:slambb
+ * @date:2019/12/21
+ */
+@Data
+public class UserInfoVO {
+
+//    private String userId;
+
+    private String username;
+
+    private String gender;
+
+//    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy/MM/dd",timezone="GMT+8")
+    private Date birthday;
+
+    private String signature;
+
+    private String avatarUrl;
+
+    private String cityCode;
+
+    private double height;
+
+    private double weight;
+
+
+}

+ 166 - 0
src/main/java/com/YuyeTech/TPlat/aspect/AuthorizeAspect.java

@@ -0,0 +1,166 @@
+package com.YuyeTech.TPlat.aspect;
+
+import com.YuyeTech.TPlat.exception.AuthorizeException;
+import com.google.common.collect.Maps;
+
+import com.YuyeTech.TPlat.constant.CookieConstant;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.utils.CookieUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+/**
+ * AOP 切面,拦截器
+ * 现在 在 filter 里面 做token 验证
+ * @author:slambb
+ * @date:2019/12/13
+ */
+@Aspect
+@Component
+@Slf4j
+public class AuthorizeAspect {
+
+    @Autowired
+    private StringRedisTemplate redisTemplate;
+    //"&& !execution(public * com.YuyeTech.TPlat.controller.BackstageBLEDeviceController.*(..))"
+    @Pointcut("execution(public * com.YuyeTech.TPlat.controller.Backstage*.*(..))" +
+            "&& !execution(public * com.YuyeTech.TPlat.controller.BackstageManagerController.*(..))")
+    public void verifyAuthorize() {}
+
+    @Before("verifyAuthorize()")
+    public void doVerifyAuthorize() {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+
+        //查询cookie
+        Cookie cookie = CookieUtil.get(request, CookieConstant.TOKEN);
+        if (cookie == null) {
+//            log.warn("【登录校验】Cookie中查不到token");
+            throw new AuthorizeException(ResultEnum.COOKIE_PARAM_ERROR.getCode(),
+                    ResultEnum.COOKIE_PARAM_ERROR.getMessage());
+        }
+
+        //去redis里查询
+        String tokenValue = redisTemplate.opsForValue().get(String.format(RedisConstant.TOKEN_PREFIX, cookie.getValue()));
+        if (StringUtils.isEmpty(tokenValue)) {
+//            log.warn("【登录校验】Redis中查不到token");
+            throw new AuthorizeException(ResultEnum.TOKEN_IS_ILLEGAL.getCode(),
+                    ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+        }
+    }
+
+    //切点
+    // execution(public * com.slambb.smallshop.controller.UserInfoController.*(..))
+//    @Pointcut("execution(public * com.slambb.smallshop.controller.UserInfoController.*(..))")
+    public void verify() {
+
+    }
+
+    //在切点做拦截
+//    @Before("verify()")
+    public void doVerify(JoinPoint joinPoint) throws Exception {
+
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+        log.info("请求地址:" + request.getRequestURL().toString());
+        log.info("请求方式:" + request.getMethod());
+        log.info("请求类方法:" + joinPoint.getSignature());
+        log.info("请求类方法参数:" + Arrays.toString(joinPoint.getArgs()));
+        //获取传入目标方法的参数
+        Object[] args = joinPoint.getArgs();
+        for (int i = 0; i < args.length; i++) {
+            args[i] = 1;
+            System.out.println("第" + (i+1) + "个参数为:" + args[i]);
+        }
+        System.out.println("被代理的对象:" + joinPoint.getTarget());
+        System.out.println("代理对象自己:" + joinPoint.getThis());
+
+
+//        Object openid =redisTemplate.opsForHash().get(String.format(RedisConstant.TOKEN_PREFIX,token),"openid");
+//        log.info("openid ====",openid);
+//        // 用户信息校验
+//        if (StringUtils.isEmpty(openid)) {
+//            log.warn("【登录校验】 Redis 中查找不到token 对应的信息(openid)");
+//            throw new AuthorizeException();
+//        }
+
+
+
+//        //获取到请求后,查询cookie
+//        Cookie cookie = CookieUtil.get(request, CookieConstant.TOKEN);
+//        if(cookie == null){
+//            log.warn("【登录校验】 cookie 中查不到token");
+//            throw  new AuthorizeException();
+//        }
+//        log.info("请求的 cookie",cookie);
+//
+//        //如果存在,去redis查询对应的token
+//        String tokenValue = redisTemplate.opsForValue().get(String.format(RedisConstant.TOKEN_PREFIX,cookie.getValue()));
+//        if(StringUtils.isEmpty(tokenValue)){
+//            log.warn("【登录校验】 Redis 中查找不到token");
+//            throw new AuthorizeException();
+//        }
+    }
+
+//    @Around("verify()")
+    public Object aroundVerify(ProceedingJoinPoint pjd){
+
+        Object result = null;
+        Object[] args = pjd.getArgs();
+        for (int i = 0; i < args.length; i++) {
+            args[i] = 1;
+            System.out.println("第==" + (i+1) + "个参数为:" + args[i]);
+        }
+        try {
+            //前置通知
+            System.out.println("目标方法执行前...");
+            //执行目标方法
+            //result = pjd.proeed();
+            //用新的参数值执行目标方法
+//            Map<String,Object> map = new HashMap<>();
+//            map.put("userId",123);
+//            new Object[]{"1577343249102947918","111"}
+            //获取RequestAttributes
+            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+            //从获取RequestAttributes中获取HttpServletRequest的信息
+            HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
+            //如果要获取Session信息的话,可以这样写:
+            //HttpSession session = (HttpSession) requestAttributes.resolveReference(RequestAttributes.REFERENCE_SESSION);
+            Enumeration<String> enumeration = request.getParameterNames();
+            Map<String,String> parameterMap = Maps.newHashMap();
+            while (enumeration.hasMoreElements()){
+                String parameter = enumeration.nextElement();
+                parameterMap.put(parameter,request.getParameter(parameter)+1);
+            }
+            log.info("enumeration={}",parameterMap);
+            result = pjd.proceed();
+
+            //返回通知
+            System.out.println("目标方法返回结果后...");
+        } catch (Throwable e) {
+            //异常通知
+            System.out.println("执行目标方法异常后...");
+            throw new RuntimeException(e);
+        }
+        //后置通知
+        System.out.println("目标方法执行后...");
+
+        return result;
+    }
+}

+ 112 - 0
src/main/java/com/YuyeTech/TPlat/aspect/AuthorizeFilter.java

@@ -0,0 +1,112 @@
+package com.YuyeTech.TPlat.aspect;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.utils.JsonUtils;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import com.YuyeTech.TPlat.utils.TokenRequestWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.util.StringUtils;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author:slambb
+ * @date:2019/12/27
+ */
+@Slf4j
+//@WebFilter(filterName = "authorizeFilter", urlPatterns = "/*")
+public class AuthorizeFilter implements Filter {
+
+    @Autowired
+    StringRedisTemplate redisTemplate;
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+        //处理跨域请求
+        HttpServletResponse response = (HttpServletResponse) servletResponse;
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        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", "Origin, X-Requested-With, Content-Type, Accept , token");
+//        log.info("********进入过滤器********");
+        HttpServletRequest req = (HttpServletRequest) servletRequest;
+        String method = req.getMethod();
+//        log.info("method:{}",method);
+        if (method.equals("OPTIONS")) {
+            response.setStatus(200);
+            return;
+        }
+        String token = req.getHeader("token");
+        Integer platform = req.getIntHeader("platform");
+
+        boolean isFilter = false;
+        Object userId = null;
+        String path = req.getServletPath();
+        //静态资源放行
+        String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.png|.PNG|.js|.css|.woff|.woff2|.ttf)$";
+        Matcher matcher = Pattern.compile(reg).matcher(path);
+        //登录,获取验证码,不用登录的接口
+        if (path.indexOf("login") > -1 ||
+                path.indexOf("getCode") > -1 ||
+                path.indexOf("dontLogin") > -1 ||
+                path.indexOf("client_game") > -1 ||
+                path.indexOf("backstage") > -1 ||
+//                path.indexOf("css") > -1 ||
+                matcher.find()||
+                path.indexOf("bundles") > -1||
+                path.indexOf("plugins") > -1||
+                path.indexOf("angular.min.js") > -1 ||
+                /**
+                 * 3D视界接口放行
+                 */
+                path.indexOf("td") > -1
+        ) {
+            //登录情况直接放行
+//            log.info("********登录情况直接放行********");
+            filterChain.doFilter(servletRequest, response);
+            return;
+        }
+        if (null == token || token.isEmpty()) {
+//            log.info("Url =={} == {}",req.getRequestURI(),req.getServletPath());
+//          throw new AuthorizeException(ResultEnum.TOKEN_DOES_NOT_EXIST.getCode(), ResultEnum.TOKEN_DOES_NOT_EXIST.getMessage());
+            ResultVO resultVO = ResultVOUtil.error(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+            response.setCharacterEncoding("utf-8");
+            response.getWriter().print(JsonUtils.toJson(resultVO));
+            return;
+        } else {
+            userId = redisTemplate.opsForHash().get(String.format(RedisConstant.TOKEN_PREFIX, token), "userId");
+            if (!StringUtils.isEmpty(userId)) {
+                isFilter = true;
+            } else {
+                ResultVO resultVO = ResultVOUtil.error(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+                response.setCharacterEncoding("utf-8");
+                response.getWriter().print(JsonUtils.toJson(resultVO));
+                return;
+            }
+        }
+        if (isFilter) {
+            filterChain.doFilter(new TokenRequestWrapper((HttpServletRequest) servletRequest, userId.toString(),platform), response);
+        }
+
+    }
+}

+ 32 - 0
src/main/java/com/YuyeTech/TPlat/config/AliyunConfig.java

@@ -0,0 +1,32 @@
+package com.YuyeTech.TPlat.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author:slambb
+ * @date:2019/12/16
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "aliyun")
+public class AliyunConfig {
+    //公共
+    private String accessKeyId;
+    private String AccessKeySecret;
+    //oss 服务
+    private Boolean usingDomain;
+    private String domainName;
+    private String endpoint;
+    private String bucketName;
+    private String fileHost;
+    private String fileAvatar;
+    private String filePublicAvatar;
+    private String fileGameIcon;
+    private String filePictures;
+    //短信服务
+    private String regionId;
+    private String signName;
+    private String templateCode;
+}

+ 18 - 0
src/main/java/com/YuyeTech/TPlat/config/GameConfig.java

@@ -0,0 +1,18 @@
+package com.YuyeTech.TPlat.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author:slambb
+ * @date:2020/7/15
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "game")
+public class GameConfig {
+    //设置时间
+    private String endTime;
+
+}

+ 34 - 0
src/main/java/com/YuyeTech/TPlat/config/WebConfig.java

@@ -0,0 +1,34 @@
+package com.YuyeTech.TPlat.config;
+
+import com.YuyeTech.TPlat.aspect.AuthorizeFilter;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.filter.DelegatingFilterProxy;
+
+import javax.servlet.Filter;
+
+/**
+ * @author:slambb
+ * @date:2019/12/27
+ */
+@Configuration
+public class WebConfig {
+
+    @Bean
+    public Filter AuthorizeFilter() {
+        return new AuthorizeFilter();
+    }
+
+
+    @Bean
+    public FilterRegistrationBean authorizeFilterRegistration() {
+        FilterRegistrationBean registration = new FilterRegistrationBean();
+        registration.setFilter(new DelegatingFilterProxy("AuthorizeFilter"));
+        registration.addUrlPatterns("/*");
+        registration.setName("AuthorizeFilter");
+        registration.setOrder(1);
+        return registration;
+    }
+
+}

+ 20 - 0
src/main/java/com/YuyeTech/TPlat/config/WechatAccountConfig.java

@@ -0,0 +1,20 @@
+package com.YuyeTech.TPlat.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author:slambb
+ * @date:2019/12/4
+ */
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "wechat")
+public class WechatAccountConfig {
+
+    private String wxAppId;
+
+    private String wxAppSecret;
+}

+ 147 - 0
src/main/java/com/YuyeTech/TPlat/config/WxMaConfiguration.java

@@ -0,0 +1,147 @@
+package com.YuyeTech.TPlat.config;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
+import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
+import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
+import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
+import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
+import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
+import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author:slambb
+ * @date:2019/12/13
+ */
+@Configuration
+@EnableConfigurationProperties(WxMaProperties.class)
+public class WxMaConfiguration {
+    private WxMaProperties properties;
+
+    private static Map<String, WxMaMessageRouter> routers = Maps.newHashMap();
+    private static Map<String, WxMaService> maServices = Maps.newHashMap();
+
+    @Autowired
+    public WxMaConfiguration(WxMaProperties properties) {
+        this.properties = properties;
+    }
+
+    public static WxMaService getMaService(String appid) {
+        WxMaService wxService = maServices.get(appid);
+        if (wxService == null) {
+            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+        }
+
+        return wxService;
+    }
+
+    public static WxMaMessageRouter getRouter(String appid) {
+        return routers.get(appid);
+    }
+
+    @PostConstruct
+    public void init() {
+        List<WxMaProperties.Config> configs = this.properties.getConfigs();
+        if (configs == null) {
+            throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
+        }
+
+        maServices = configs.stream()
+                .map(a -> {
+                    WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
+                    config.setAppid(a.getAppid());
+                    config.setSecret(a.getSecret());
+                    config.setToken(a.getToken());
+                    config.setAesKey(a.getAesKey());
+                    config.setMsgDataFormat(a.getMsgDataFormat());
+
+                    WxMaService service = new WxMaServiceImpl();
+                    service.setWxMaConfig(config);
+                    routers.put(a.getAppid(), this.newRouter(service));
+                    return service;
+                }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a));
+    }
+
+    private WxMaMessageRouter newRouter(WxMaService service) {
+        final WxMaMessageRouter router = new WxMaMessageRouter(service);
+        router
+                .rule().handler(logHandler).next()
+                .rule().async(false).content("模板").handler(templateMsgHandler).end()
+                .rule().async(false).content("文本").handler(textHandler).end()
+                .rule().async(false).content("图片").handler(picHandler).end()
+                .rule().async(false).content("二维码").handler(qrcodeHandler).end();
+        return router;
+    }
+
+    private final WxMaMessageHandler templateMsgHandler = (wxMessage, context, service, sessionManager) -> {
+        service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder()
+                .templateId("此处更换为自己的模板id")
+                .formId("自己替换可用的formid")
+                .data(Lists.newArrayList(
+                        new WxMaTemplateData("keyword1", "339208499", "#173177")))
+                .toUser(wxMessage.getFromUser())
+                .build());
+        return null;
+    };
+
+    private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> {
+        System.out.println("收到消息:" + wxMessage.toString());
+        service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson())
+                .toUser(wxMessage.getFromUser()).build());
+        return null;
+    };
+
+    private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> {
+        service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息")
+                .toUser(wxMessage.getFromUser()).build());
+        return null;
+    };
+
+    private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> {
+        try {
+            WxMediaUploadResult uploadResult = service.getMediaService()
+                    .uploadMedia("image", "png",
+                            ClassLoader.getSystemResourceAsStream("tmp.png"));
+            service.getMsgService().sendKefuMsg(
+                    WxMaKefuMessage
+                            .newImageBuilder()
+                            .mediaId(uploadResult.getMediaId())
+                            .toUser(wxMessage.getFromUser())
+                            .build());
+        } catch (WxErrorException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    };
+
+    private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> {
+        try {
+            final File file = service.getQrcodeService().createQrcode("123", 430);
+            WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file);
+            service.getMsgService().sendKefuMsg(
+                    WxMaKefuMessage
+                            .newImageBuilder()
+                            .mediaId(uploadResult.getMediaId())
+                            .toUser(wxMessage.getFromUser())
+                            .build());
+        } catch (WxErrorException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    };
+}

+ 46 - 0
src/main/java/com/YuyeTech/TPlat/config/WxMaProperties.java

@@ -0,0 +1,46 @@
+package com.YuyeTech.TPlat.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author:slambb
+ * @date:2019/12/13
+ */
+@Data
+//@Component
+@ConfigurationProperties(prefix = "wx.miniapp")
+public class WxMaProperties {
+    private List<Config> configs;
+
+    @Data
+    public static class Config {
+        /**
+         * 设置微信小程序的appid
+         */
+        private String appid;
+
+        /**
+         * 设置微信小程序的Secret
+         */
+        private String secret;
+
+        /**
+         * 设置微信小程序消息服务器配置的token
+         */
+        private String token;
+
+        /**
+         * 设置微信小程序消息服务器配置的EncodingAESKey
+         */
+        private String aesKey;
+
+        /**
+         * 消息格式,XML或者JSON
+         */
+        private String msgDataFormat;
+    }
+}

+ 17 - 0
src/main/java/com/YuyeTech/TPlat/config/config.java

@@ -0,0 +1,17 @@
+package com.YuyeTech.TPlat.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author:slambb
+ * @date:2019/12/4
+ */
+@Component
+public class config {
+
+     @Autowired
+    private WechatAccountConfig accountConfig;
+//    @Bean
+
+}

+ 11 - 0
src/main/java/com/YuyeTech/TPlat/constant/CookieConstant.java

@@ -0,0 +1,11 @@
+package com.YuyeTech.TPlat.constant;
+
+/**
+ * @author:slambb
+ * @date:2019/12/13
+ */
+public interface CookieConstant {
+    String TOKEN = "token";
+
+    Integer EXPIRE = 7200;
+}

+ 12 - 0
src/main/java/com/YuyeTech/TPlat/constant/RankingConstant.java

@@ -0,0 +1,12 @@
+package com.YuyeTech.TPlat.constant;
+
+/**
+ * @author:slambb
+ * @date:2020/3/20
+ */
+public interface RankingConstant {
+    //城市key
+    String cityKey = "city_%s_gameId_%s";
+    //全国key 直接用gameId
+    String chinaKey = "gameId_%s";
+}

+ 17 - 0
src/main/java/com/YuyeTech/TPlat/constant/RedisConstant.java

@@ -0,0 +1,17 @@
+package com.YuyeTech.TPlat.constant;
+
+/**
+ * redis 常量
+ * @author:slambb
+ * @date:2019/12/13
+ */
+public interface RedisConstant {
+    String TOKEN_PREFIX = "token_%s";
+    //设置1个月
+    Integer EXPIRE = 60*60*24*30;//7200;//2小时
+
+    //短信信息
+    String SMS_PREFIX = "code_%s";
+
+    Integer  CODE_EXPIRE = 300;//5分钟
+}

+ 153 - 0
src/main/java/com/YuyeTech/TPlat/controller/A_TDController.java

@@ -0,0 +1,153 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.config.GameConfig;
+import com.YuyeTech.TPlat.dataobject.GameCategory;
+import com.YuyeTech.TPlat.dataobject.GameInfo;
+import com.YuyeTech.TPlat.dto.GameDTO;
+import com.YuyeTech.TPlat.dto.TDGameDTO;
+import com.YuyeTech.TPlat.form.GameInfoForm;
+import com.YuyeTech.TPlat.service.GameCategoryService;
+import com.YuyeTech.TPlat.service.GameInfoService;
+import com.YuyeTech.TPlat.service.RecommendService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 3d 视界相应的接口
+ * @author:slambb
+ * @date:2020/12/28
+ */
+@RestController
+@RequestMapping("/td")
+@Slf4j
+public class A_TDController {
+    @Autowired
+    private GameInfoService gameInfoService;
+
+    @Autowired
+    private GameCategoryService gameCategoryService;
+
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @Autowired
+    private RecommendService recommendService;
+
+    @Autowired
+    private GameConfig gameConfig;
+
+
+    /**
+     * 获取游戏分类
+     * @return
+     */
+    @GetMapping("/game_category")
+    public ResultVO getTDGameCategory(){
+       List<GameCategory> gameCategoryList =  gameCategoryService.findAll();
+        return ResultVOUtil.success(gameCategoryList);
+    }
+    /**
+     * 根据游戏类目,获取游戏列表
+     * @return
+     */
+    @GetMapping("/games_by_category")
+    public ResultVO getGameListByCategory(@RequestParam(value = "categoryType", required = false) Integer categoryType,
+                                            @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                            @RequestParam(value = "size", defaultValue = "10") Integer size){
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<TDGameDTO> gameDTOList =  gameInfoService.TDFindList(categoryType,request).stream().map(
+                e->new TDGameDTO(
+                        e.getGameName(),
+                        aliyunOSSUtil.addDomainName(e.getGameIcon()),
+                        e.getGameDescription(),
+                        aliyunOSSUtil.addDomainName(e.getGamePicture()),
+                        e.getGameWebUrl(),
+                        e.getCreateTime()
+                )
+        ).collect(Collectors.toList());
+        Map map = new HashMap();
+        map.put("List",gameDTOList);
+        map.put("currentPage", page);
+        map.put("currentSize", size);
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 获取游戏推荐列表
+     * @return
+     */
+    @GetMapping("/game_recommend")
+    public ResultVO getRecommendAllGame(@RequestParam(value = "recommendType", required = false) Integer recommendType,
+                                        @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                        @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.ASC,"createTime"));
+        List<TDGameDTO>  tdGameDTOS= recommendService.TDFindByRecommendType(recommendType,request).stream().map(
+                e->new TDGameDTO(
+                        e.getGameName(),
+                        aliyunOSSUtil.addDomainName(e.getGameIcon()),
+                        e.getGameDescription(),
+                        aliyunOSSUtil.addDomainName(e.getGamePicture()),
+                        e.getGameWebUrl(),
+                        e.getCreateTime()
+                )
+        ).collect(Collectors.toList());
+        Map map = new HashMap();
+        map.put("List",tdGameDTOS);
+        map.put("currentPage", page);
+        map.put("currentSize", size);
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 根据用户名搜索信息
+     * @return
+     */
+    @GetMapping("/searchByGameName")
+    public ResultVO searchByGameName(
+            @RequestParam(value = "gameName")String gameName,
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+        //todo 根据游戏名搜索,查询游戏信息
+            PageRequest request = PageRequest.of(page-1, size);
+            List<TDGameDTO> gameInfoPage =  gameInfoService.fuzzySearchByGameName(request,gameName).stream().map(
+                e->new TDGameDTO(
+                        e.getGameName(),
+                        aliyunOSSUtil.addDomainName(e.getGameIcon()),
+                        e.getGameDescription(),
+                        aliyunOSSUtil.addDomainName(e.getGamePicture()),
+                        e.getGameWebUrl(),
+                        e.getCreateTime()
+                )
+            ).collect(Collectors.toList());
+            Map map = new HashMap();
+            map.put("List",gameInfoPage);
+            map.put("currentPage", page);
+            map.put("currentSize", size);
+            return ResultVOUtil.success(map);
+
+    }
+}

+ 86 - 0
src/main/java/com/YuyeTech/TPlat/controller/AppController.java

@@ -0,0 +1,86 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.VersionInfo;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.service.VersionInfoService;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.YuyeTech.TPlat.enums.ResultEnum.NO_UPDATE;
+
+/**
+ * app 部分控制
+ * 版本升级控制
+ */
+@RestController
+@RequestMapping("/app")
+public class AppController {
+
+    @Autowired
+    private VersionInfoService versionInfoService;
+    /**
+     * 请求数据:
+     * {
+     *     "appid": plus.runtime.appid,
+     *     "version": plus.runtime.version
+     * }
+     * 响应数据:
+     * {
+     *     "status":1,//升级标志,1:需要升级;0:无需升级
+     *     "note": "修复bug1;\n修复bug2;",//release notes
+     *     "url": "http://www.example.com/uniapp.apk" //更新包下载地址
+     * }
+     * @param appid
+     * @param version
+     * @return
+     */
+    @GetMapping("/version_update")
+    public ResultVO VersionUpdate(
+            @RequestParam(value = "appid") String appid,
+            @RequestParam(value = "version") String version,
+            @RequestParam(value = "versionCode") String versionCode,
+            @RequestParam(value = "platform") String platform){
+
+        //获取最新的版本信息 version status = 1;
+        VersionInfo versionInfo = versionInfoService.findByVersionStatus(1);
+
+        if(StringUtils.isEmpty(versionInfo)){
+            return  ResultVOUtil.error(NO_UPDATE.getCode(),NO_UPDATE.getMessage());
+        }
+        //校验appid
+        if(!versionInfo.getVersionAppid().equals(appid)){
+            return  ResultVOUtil.error(ResultEnum.NO_VERSION_APPID.getCode(),ResultEnum.NO_VERSION_APPID.getMessage());
+        }
+        Map _back = new HashMap();
+        //版本code大于app ,以及版本 不相等,可更新
+        if(Integer.parseInt(versionInfo.getVersionCode())>Integer.parseInt(versionCode)
+        && !versionInfo.getVersionNumber().equals(version)){
+            _back.put("status",1);
+            _back.put("note",versionInfo.getVersionNote());
+            //如果是两个平台的,放入不同的连接到url
+            if(platform.equals("android")){
+                _back.put("url",versionInfo.getApk());
+            }else{
+                _back.put("url",versionInfo.getIos());
+            }
+            _back.put("platform",platform);
+
+            return  ResultVOUtil.success(_back);
+        }else{
+            //不需要更新
+            _back.put("status",0);
+            _back.put("platform",platform);
+            return  ResultVOUtil.success(_back);
+        }
+    }
+
+}

+ 337 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageBLEDeviceController.java

@@ -0,0 +1,337 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.BluetoothInfo;
+import com.YuyeTech.TPlat.dataobject.DeviceInfo;
+import com.YuyeTech.TPlat.enums.DeviceEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.service.BluetoothInfoService;
+import com.YuyeTech.TPlat.service.DeviceInfoService;
+import com.YuyeTech.TPlat.utils.QRCodeUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.Null;
+import java.math.BigInteger;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 管理蓝牙设备mac地址生成
+ * @author:slambb
+ * @date:2020/12/30
+ */
+@RestController
+@RequestMapping("/backstage_ble")
+@Slf4j
+public class BackstageBLEDeviceController {
+    @Autowired
+    private BluetoothInfoService bluetoothInfoService;
+
+    //http://192.168.0.112:9090/api_dev/backstage_ble/generate?startIndex=10&name="1"&Number=100
+    @GetMapping(value = "/generate")
+    public ResultVO generateBluetoothInfo(
+            @RequestParam(value = "name") String name,
+            @RequestParam(value = "startIndex") Integer startIndex,
+            @RequestParam(value = "Number") Integer Number ){
+        if(Number>100){
+            log.info("number过大:{}",Number);
+            return ResultVOUtil.error(200,"number过大");
+        }
+        //todo 创建uuids
+        //     存储到数据库表
+        //     生成对应的信息二维码
+        List<BluetoothInfo> bluetoothInfos = new ArrayList<>();
+
+        String identifier = System.currentTimeMillis()+"";
+        for (int i=0;i<Number;i++){
+            BluetoothInfo bluetoothInfo = new BluetoothInfo();
+
+            //设备名字
+            Integer _writeIndex = startIndex + i;
+            String _bleName = new StringBuffer(name).append('_').append(_writeIndex).toString();
+            bluetoothInfo.setBluetoothName(_bleName);
+            //mac地址 c55c19040000
+            String oriStr = "C55C19040000";
+            BigInteger oriInt =  new BigInteger(oriStr,16);
+            BigInteger outInt = oriInt.add(BigInteger.valueOf(_writeIndex));
+            String outOriStr = outInt.toString(16);
+            String regex = "(\\w)(?=(\\w{2})+(?!\\w))";//"(.{2})";
+            String result = outOriStr.replaceAll(regex, "$1:").toUpperCase();
+            //设置mac地址
+            bluetoothInfo.setBluetoothMac(result);
+            //绑定状态
+            bluetoothInfo.setBluetoothStatus(0);
+            //3 是蓝牙设备
+            bluetoothInfo.setBluetoothType(3);
+
+
+            bluetoothInfos.add(bluetoothInfo);
+        }
+
+//        bluetoothInfoService.addMoreBluetoothInfos();
+        Map map = new HashMap();
+//        map.put("identifier",identifier);
+        return ResultVOUtil.success(bluetoothInfos);
+    }
+
+    @PostMapping("/generateBLECode")
+    public ModelAndView generateBLECode(HttpServletRequest request,Map<String, Object> map) {
+
+        String name = request.getParameter("name");
+        String startIndex = request.getParameter("startIndex");
+        String strNum = request.getParameter("number");
+        if(StringUtils.isEmpty(strNum)){
+            map.put("msg","Number不能为空 !");
+            map.put("url","/backstage_ble/generateManager");
+            return new ModelAndView("common/error",map);
+        }
+
+        Integer Number = Integer.valueOf(strNum);
+        if(Number>100||Number <=0){
+            log.info("number 超出范围:{}",Number);
+            map.put("msg","Number超过 100 或者小于等于 0 !");
+            map.put("url","/backstage_ble/generateManager");
+            return new ModelAndView("common/error",map);
+        }
+        //todo 创建uuids
+        //     存储到数据库表
+        //     生成对应的信息二维码
+        List<BluetoothInfo> bluetoothInfos = new ArrayList<>();
+
+        String identifier = System.currentTimeMillis()+"";
+        for (int i=0;i<Number;i++){
+            BluetoothInfo bluetoothInfo = new BluetoothInfo();
+            //设备名字
+            Integer _writeIndex = Integer.valueOf(startIndex) + i;
+            String _bleName = new StringBuffer(name).append('_').append(_writeIndex).toString();
+            bluetoothInfo.setBluetoothName(_bleName);
+            //mac地址 c55c19040000
+            String oriStr = "C55C19040000";
+            BigInteger oriInt =  new BigInteger(oriStr,16);
+            BigInteger outInt = oriInt.add(BigInteger.valueOf(_writeIndex));
+            String outOriStr = outInt.toString(16);
+            String regex = "(\\w)(?=(\\w{2})+(?!\\w))";//"(.{2})";
+            String result = outOriStr.replaceAll(regex, "$1:").toUpperCase();
+            //设置mac地址
+            bluetoothInfo.setBluetoothMac(result);
+            //绑定状态
+            bluetoothInfo.setBluetoothStatus(0);
+            //3 是蓝牙设备
+            bluetoothInfo.setBluetoothType(3);
+            //设置不共享 0
+            bluetoothInfo.setIsShare(0);
+
+            bluetoothInfo.setIdentifier(identifier);
+
+            bluetoothInfos.add(bluetoothInfo);
+        }
+        List<BluetoothInfo> callback = bluetoothInfoService.addMoreBluetoothInfos(bluetoothInfos);
+        map.put("bleInfos", callback);
+        map.put("identifier",identifier);
+        map.put("number",strNum);
+        map.put("startIndex",startIndex);
+        map.put("name",name);
+        return new ModelAndView("/ble/generate",map);
+    }
+
+    @PostMapping("/generateBLESingleData")
+    public ModelAndView gotoGenerateBLESingleData(HttpServletRequest request,Map<String, Object> map) {
+
+        String singleName = request.getParameter("singleName");
+        String mac = request.getParameter("mac");
+        if(StringUtils.isEmpty(singleName)){
+            map.put("msg","singleName不能为空 !");
+            map.put("url","/backstage_ble/generateManager?single_name="+singleName);
+            return new ModelAndView("common/error",map);
+        }
+        if(StringUtils.isEmpty(mac)){
+            map.put("msg","mac不能为空 !");
+            map.put("url","/backstage_ble/generateManager?single_name="+singleName+"&mac="+mac);
+            return new ModelAndView("common/error",map);
+        }
+        try {
+            BluetoothInfo hasBluetoothInfo = bluetoothInfoService.findByMac(mac);
+            if(hasBluetoothInfo != null){
+                map.put("msg","mac已存在 !");
+                map.put("url","/backstage_ble/generateManager?single_name="+singleName+"&mac="+mac);
+                return new ModelAndView("common/error",map);
+            }
+        }catch (IncorrectResultSizeDataAccessException e){
+            map.put("msg","mac在数据库中存在多个,请删除多余的数据!!");
+            map.put("url","/backstage_ble/generateManager?single_name="+singleName+"&mac="+mac);
+            return new ModelAndView("common/error",map);
+        }
+
+        BluetoothInfo bluetoothInfo = new BluetoothInfo();
+        //设备名字
+        String identifier = System.currentTimeMillis()+"";
+        bluetoothInfo.setBluetoothName(singleName);
+        //设置mac地址
+        bluetoothInfo.setBluetoothMac(mac);
+        //绑定状态
+        bluetoothInfo.setBluetoothStatus(0);
+        //3 是蓝牙设备
+        bluetoothInfo.setBluetoothType(3);
+        //设置不共享 0
+        bluetoothInfo.setIsShare(0);
+
+        bluetoothInfo.setIdentifier(identifier);
+
+        List<BluetoothInfo> bluetoothInfos = new ArrayList<>();
+        BluetoothInfo callback = bluetoothInfoService.saveBluetoothInfo(bluetoothInfo);
+        bluetoothInfos.add(callback);
+        map.put("bleInfos", bluetoothInfos);
+        map.put("identifier",identifier);
+        map.put("singleName",singleName);
+        map.put("mac",mac);
+
+        return new ModelAndView("/ble/generate",map);
+    }
+    /**
+     * 蓝牙列表
+     * @param page 第几页, 从1页开始
+     * @param size 一页有多少条数据
+     * @return
+     */
+    @GetMapping("/list")
+    public ModelAndView gotoList(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             Map<String, Object> map) {
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<BluetoothInfo> bluetoothInfos = bluetoothInfoService.findAllBLEInfoByPageable(request);
+        map.put("bleInfos", bluetoothInfos);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/ble/list", map);
+    }
+
+    @GetMapping("/generateManager")
+    public ModelAndView gotoGenerateManager(
+            @RequestParam(value = "single_name",defaultValue = "BGBOX_202012") String singleName,
+            @RequestParam(value = "mac",defaultValue = "C5:5C:19:04:00:00") String mac,
+            @RequestParam(value = "name",defaultValue = "BGBOX_202012") String name,
+            Map<String, Object> map) {
+        map.put("singleName",singleName);
+        map.put("name",name);
+        map.put("mac",mac);
+        return new ModelAndView("/ble/generate",map);
+    }
+
+    /**
+     * 根据蓝牙mac搜索
+     * @return
+     */
+    @PostMapping("/searchBluetoothInfo")
+    public ModelAndView gotoSearchBluetoothInfo(
+            @RequestParam(value = "bleMac") String bleMac,
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size,
+            Map<String, Object> map) {
+        if(page<1){
+            map.put("msg", "page不能小于1.");
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+        if(StringUtils.isEmpty(bleMac)){
+            map.put("msg", DeviceEnum.UUID_NULL.getMessage());
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+        //todo 根据用户名搜索,查询用户信息
+        try {
+            PageRequest request = PageRequest.of(page-1, size);
+            Page<BluetoothInfo> bluetoothInfos = bluetoothInfoService.findAllBLEByPageableAndMac(request,bleMac);
+            map.put("bleMac",bleMac);
+            map.put("bleInfos", bluetoothInfos);
+            map.put("currentPage", page);
+            map.put("size", size);
+            return new ModelAndView("/ble/list", map);
+        } catch (UserException e) {
+            map.put("msg", e.getMessage());
+            map.put("url", "/backstage_ble/list");
+            return new ModelAndView("common/error", map);
+        }
+
+    }
+
+    @GetMapping("/deleteGenerateBLE")
+    public ModelAndView gotoDeleteGenerateBLE(@RequestParam(value = "id") Integer id,
+                                              @RequestParam(value = "identifier") String identifier,
+                                              @RequestParam(value = "single_name") String singleName,
+                                              @RequestParam(value = "mac") String mac,
+                                              @RequestParam(value = "name") String name,
+                                      Map<String, Object> map) {
+
+        try {
+            bluetoothInfoService.deleteBluetoothInfoById(id);
+        }catch ( EmptyResultDataAccessException e){
+            log.info("gotoDeleteGenerateBLE 删除不存在的数据");
+        }
+        //删除后根据标识查找数据
+        List<BluetoothInfo> bluetoothInfos =  bluetoothInfoService.findAllByIdentifier(identifier);
+        map.put("bleInfos", bluetoothInfos);
+        map.put("identifier",identifier);
+
+        map.put("bleInfos", bluetoothInfos);
+        map.put("identifier",identifier);
+        map.put("singleName",singleName);
+        map.put("name",name);
+        map.put("mac",mac);
+        return new ModelAndView("/ble/generate",map);
+
+
+    }
+
+    @GetMapping("/reset_bind")
+    public ModelAndView resetBind(@RequestParam(value = "bleMac") String bleMac,
+                                  @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                  @RequestParam(value = "size", defaultValue = "10") Integer size,
+                                  Map<String, Object> map) {
+
+
+        if(StringUtils.isEmpty(bleMac)){
+            map.put("msg", DeviceEnum.UUID_NULL.getMessage());
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+        //todo 先重置信息
+        try {
+
+            BluetoothInfo bluetoothInfo = bluetoothInfoService.findByMac(bleMac);
+            bluetoothInfo.setIsShare(0);
+            bluetoothInfo.setBluetoothStatus(0);
+            bluetoothInfo.setUserId(null);
+            bluetoothInfoService.saveBluetoothInfo(bluetoothInfo);
+
+            PageRequest request = PageRequest.of(page-1, size);
+            List<BluetoothInfo> bluetoothInfoList = new ArrayList<>();
+            bluetoothInfoList.add(bluetoothInfo);
+            Page<BluetoothInfo> bluetoothInfos = new PageImpl<>(bluetoothInfoList,request,bluetoothInfoList.size());
+            map.put("bleMac",bleMac);
+            map.put("bleInfos", bluetoothInfos);
+            map.put("currentPage", page);
+            map.put("size", size);
+            return new ModelAndView("/ble/list", map);
+        } catch (UserException e) {
+            map.put("msg", e.getMessage());
+            map.put("url", "/backstage_ble/list");
+            return new ModelAndView("common/error", map);
+        }
+    }
+}

+ 199 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageDeviceController.java

@@ -0,0 +1,199 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.enums.DeviceEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.service.DeviceInfoService;
+import com.alibaba.fastjson.JSONObject;
+import com.YuyeTech.TPlat.dataobject.DeviceInfo;
+import com.YuyeTech.TPlat.utils.QRCodeUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 管理设备二维码生成
+ * @author:slambb
+ * @date:2020/6/11
+ */
+@RestController
+@RequestMapping("/backstage_device")
+@Slf4j
+public class BackstageDeviceController {
+    @Autowired
+    private DeviceInfoService deviceInfoService;
+
+    //http://192.168.0.108:9090/smallshop/backstage_device/generate?Number=10
+    @GetMapping(value = "/generate")
+    public ResultVO generateDeviceInfo(@RequestParam(value = "Number") Integer Number ){
+        if(Number>100){
+            log.info("number过大:{}",Number);
+            return ResultVOUtil.error(200,"number过大");
+        }
+        //todo 创建uuids
+        //     存储到数据库表
+        //     生成对应的信息二维码
+        List<DeviceInfo> deviceInfos = new ArrayList<>();
+
+//        String[] uuids = new String[Number];
+        String identifier = System.currentTimeMillis()+"";
+        for (int i=0;i<Number;i++){
+            String uuid= UUID.randomUUID().toString().replaceAll("-", "");
+            DeviceInfo deviceInfo = new DeviceInfo();
+            deviceInfo.setDeviceUuid(uuid);
+            deviceInfo.setDeviceType(1);
+            deviceInfo.setDeviceStatus(0);
+            deviceInfo.setIdentifier(identifier);
+
+            deviceInfos.add(deviceInfo);
+        }
+
+        deviceInfoService.addMultipleObjects(deviceInfos);
+        Map map = new HashMap();
+        map.put("identifier",identifier);
+        return ResultVOUtil.success(map);
+    }
+
+    //http://192.168.0.108:9090/smallshop/backstage_device/download?identifier=1591971633420
+    @PostMapping(value="/download")
+    public void downloadCompressFile(@RequestParam(value = "identifier") String identifier ,
+                                     HttpServletResponse response,
+                                     Map<String, Object> map) throws Exception{
+        //1.获取指定信息,
+        List<DeviceInfo> deviceInfos =  deviceInfoService.findAllByIdentifier(identifier);
+        if(deviceInfos.size() != 0){
+            //2.下载压缩包
+            ZipOutputStream zos = null;
+            String  downloadFilename = "设备二维码_"+identifier;
+            //转换中文否则可能会产生乱码
+            downloadFilename = URLEncoder.encode(downloadFilename, "UTF-8");
+            // 指明response的返回对象是文件流
+            response.setContentType("application/octet-stream");
+            // 设置在下载框默认显示的文件名
+            response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename+".zip");
+            zos = new ZipOutputStream(response.getOutputStream());
+            for (int i = 0; i<deviceInfos.size(); i++){
+                zos.putNextEntry(new ZipEntry("uuid_"+deviceInfos.get(i).getDeviceUuid()+".png"));
+                JSONObject obj = new JSONObject();
+                obj.put("uuid",deviceInfos.get(i).getDeviceUuid());
+                obj.put("type",deviceInfos.get(i).getDeviceType());
+                ImageIO.write(QRCodeUtil.encode(obj.toJSONString(), "static/images/icon-1024.png",true),"jpg",zos);
+            }
+            zos.flush();
+            zos.close();
+        }
+
+    }
+
+    /**
+     * 二维码列表
+     * @param page 第几页, 从1页开始
+     * @param size 一页有多少条数据
+     * @return
+     */
+    @GetMapping("/list")
+    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             Map<String, Object> map) {
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<DeviceInfo> deviceInfos = deviceInfoService.findAllDeviceByPageable(request);
+        map.put("deviceInfos", deviceInfos);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/device/list", map);
+    }
+
+    @GetMapping("/generateManager")
+    public ModelAndView generateManager(Map<String, Object> map) {
+        return new ModelAndView("/device/generate",map);
+    }
+
+    @PostMapping("/generateDeviceCode")
+    public ModelAndView generateDeviceCode(HttpServletRequest request,Map<String, Object> map) {
+
+        String strNum = request.getParameter("number");
+        if(StringUtils.isEmpty(strNum)){
+            map.put("msg","Number不能为空 !");
+            map.put("url","/backstage_device/generateManager");
+            return new ModelAndView("common/error",map);
+        }
+
+        Integer Number = Integer.valueOf(strNum);
+        if(Number>100||Number <=0){
+            log.info("number 超出范围:{}",Number);
+            map.put("msg","Number超过 100 或者小于等于 0 !");
+            map.put("url","/backstage_device/generateManager");
+            return new ModelAndView("common/error",map);
+        }
+        //todo 创建uuids
+        //     存储到数据库表
+        //     生成对应的信息二维码
+        List<DeviceInfo> deviceInfos = new ArrayList<>();
+        String identifier = System.currentTimeMillis()+"";
+        for (int i=0;i<Number;i++){
+            String uuid= UUID.randomUUID().toString().replaceAll("-", "");
+            DeviceInfo deviceInfo = new DeviceInfo();
+            deviceInfo.setDeviceUuid(uuid);
+            deviceInfo.setDeviceType(1);
+            deviceInfo.setDeviceStatus(0);
+            deviceInfo.setIdentifier(identifier);
+
+            deviceInfos.add(deviceInfo);
+        }
+        List<DeviceInfo> callback = deviceInfoService.addMultipleObjects(deviceInfos);
+        map.put("deviceInfos", callback);
+        map.put("identifier",identifier);
+        return new ModelAndView("/device/generate",map);
+    }
+
+
+    /**
+     * 根据设备id搜索
+     * @return
+     */
+    @PostMapping("/searchDeviceInfo")
+    public ModelAndView searchDeviceInfo(
+            @RequestParam(value = "deviceUuid") String deviceUuid,
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size,
+            Map<String, Object> map) {
+        if(page<1){
+            map.put("msg", "page不能小于1.");
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+        if(StringUtils.isEmpty(deviceUuid)){
+            map.put("msg", DeviceEnum.UUID_NULL.getMessage());
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+        //todo 根据用户名搜索,查询用户信息
+        try {
+            PageRequest request = PageRequest.of(page-1, size);
+            Page<DeviceInfo> deviceInfos = deviceInfoService.findAllDeviceByPageableAndUUID(request,deviceUuid);
+            map.put("deviceUuid",deviceUuid);
+            map.put("deviceInfos", deviceInfos);
+            map.put("currentPage", page);
+            map.put("size", size);
+            return new ModelAndView("/device/list", map);
+        } catch (UserException e) {
+            map.put("msg", e.getMessage());
+            map.put("url", "/backstage_device/list");
+            return new ModelAndView("common/error", map);
+        }
+
+    }
+}

+ 417 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageFileManagementController.java

@@ -0,0 +1,417 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.constant.CookieConstant;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.dataobject.AdminInfo;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.form.AdminForm;
+import com.YuyeTech.TPlat.service.AdminInfoService;
+import com.YuyeTech.TPlat.utils.CookieUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.FileCopyUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Part;
+import java.io.*;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.zip.ZipOutputStream;
+
+import static com.YuyeTech.TPlat.utils.RarUtils.unRarFile;
+import static com.YuyeTech.TPlat.utils.TargzUtils.unTargzFile;
+import static com.YuyeTech.TPlat.utils.ZipUtils.unZipFiles;
+import static com.YuyeTech.TPlat.utils.ZipUtils.zipFiles;
+
+
+/**
+ * @author:slambb
+ * @date:2020/6/15
+ */
+@RestController
+@RequestMapping("/backstage_file_management")
+@Slf4j
+public class BackstageFileManagementController {
+
+    @GetMapping("/file_manager")
+    public ModelAndView file_manager(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             Map<String, Object> map) {
+        PageRequest request = PageRequest.of(page - 1, size);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/fileManagement/fileManagement", map);
+    }
+
+    /**
+     * 文件管理器目录
+     */
+    @Value("${filemanager.root}")
+    private String root;
+
+    /**
+     * 展示文件列表
+     */
+    @RequestMapping("list")
+    public Object list(@RequestBody JSONObject json) throws ServletException {
+
+        try {
+            // 需要显示的目录路径
+            String path = json.getString("path");
+
+            // 返回的结果集
+            List<JSONObject> fileItems = new ArrayList<>();
+
+            try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(root, path))) {
+
+                String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+                SimpleDateFormat dt = new SimpleDateFormat(DATE_FORMAT);
+                for (Path pathObj : directoryStream) {
+                    // 获取文件基本属性
+                    BasicFileAttributes attrs = Files.readAttributes(pathObj, BasicFileAttributes.class);
+
+                    // 封装返回JSON数据
+                    JSONObject fileItem = new JSONObject();
+                    fileItem.put("name", pathObj.getFileName().toString());
+
+                    // windows 下这句话会影响权限导致无法读取文件? 待验证 目前先注释掉
+//                    fileItem.put("rights", org.shaofan.utils.FileUtils.getPermissions(pathObj)); // 文件权限
+
+                    fileItem.put("date", dt.format(new Date(attrs.lastModifiedTime().toMillis())));
+                    fileItem.put("size", attrs.size());
+                    fileItem.put("type", attrs.isDirectory() ? "dir" : "file");
+                    fileItems.add(fileItem);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("result", fileItems);
+            return jsonObject;
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 文件上传
+     */
+    @RequestMapping("upload")
+    public Object upload(@RequestParam("destination") String destination, HttpServletRequest request) {
+
+        try {
+            // Servlet3.0方式上传文件
+            Collection<Part> parts = request.getParts();
+
+            for (Part part : parts) {
+                if (part.getContentType() != null) {  // 忽略路径字段,只处理文件类型
+                    String path = root + destination;
+
+                    File f = new File(path, com.YuyeTech.TPlat.utils.FileUtils.getFileName(part.getHeader("content-disposition")));
+                    if (!com.YuyeTech.TPlat.utils.FileUtils.write(part.getInputStream(), f)) {
+                        throw new Exception("文件上传失败");
+                    }
+                }
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 文件下载/预览
+     */
+    @RequestMapping("preview")
+    public void preview(HttpServletResponse response, String path) throws IOException {
+
+        File file = new File(root, path);
+        if (!file.exists()) {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND, "Resource Not Found");
+            return;
+        }
+
+        /*
+         * 获取mimeType
+         */
+        String mimeType = URLConnection.guessContentTypeFromName(file.getName());
+        if (mimeType == null) {
+            mimeType = "application/octet-stream";
+        }
+
+        response.setContentType(mimeType);
+        response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", URLEncoder.encode(file.getName(), "UTF-8")));
+        response.setContentLength((int) file.length());
+
+        try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) {
+            FileCopyUtils.copy(inputStream, response.getOutputStream());
+        }
+    }
+
+    /**
+     * 创建目录
+     */
+    @RequestMapping("createFolder")
+    public Object createFolder(@RequestBody JSONObject json) {
+        try {
+            String newPath = json.getString("newPath");
+            File newDir = new File(root + newPath);
+            if (!newDir.mkdir()) {
+                throw new Exception("不能创建目录: " + newPath);
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 修改文件或目录权限
+     */
+    @RequestMapping("changePermissions")
+    public Object changePermissions(@RequestBody JSONObject json) {
+        try {
+
+            String perms = json.getString("perms"); // 权限
+            boolean recursive = json.getBoolean("recursive"); // 子目录是否生效
+
+            JSONArray items = json.getJSONArray("items");
+            for (int i = 0; i < items.size(); i++) {
+                String path = items.getString(i);
+                File f = new File(root, path);
+                com.YuyeTech.TPlat.utils.FileUtils.setPermissions(f, perms, recursive); // 设置权限
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 复制文件或目录
+     */
+    @RequestMapping("copy")
+    public Object copy(@RequestBody JSONObject json, HttpServletRequest request) {
+        try {
+            String newpath = json.getString("newPath");
+            JSONArray items = json.getJSONArray("items");
+
+            for (int i = 0; i < items.size(); i++) {
+                String path = items.getString(i);
+
+                File srcFile = new File(root, path);
+                File destFile = new File(root + newpath, srcFile.getName());
+
+                FileCopyUtils.copy(srcFile, destFile);
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 移动文件或目录
+     */
+    @RequestMapping("move")
+    public Object move(@RequestBody JSONObject json) {
+        try {
+            String newpath = json.getString("newPath");
+            JSONArray items = json.getJSONArray("items");
+
+            for (int i = 0; i < items.size(); i++) {
+                String path = items.getString(i);
+
+                File srcFile = new File(root, path);
+                File destFile = new File(root + newpath, srcFile.getName());
+
+                if (srcFile.isFile()) {
+                    FileUtils.moveFile(srcFile, destFile);
+                } else {
+                    FileUtils.moveDirectory(srcFile, destFile);
+                }
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 删除文件或目录
+     */
+    @RequestMapping("remove")
+    public Object remove(@RequestBody JSONObject json) {
+        try {
+            JSONArray items = json.getJSONArray("items");
+            for (int i = 0; i < items.size(); i++) {
+                String path = items.getString(i);
+                File srcFile = new File(root, path);
+                if (!FileUtils.deleteQuietly(srcFile)) {
+                    throw new Exception("删除失败: " + srcFile.getAbsolutePath());
+                }
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 重命名文件或目录
+     */
+    @RequestMapping("rename")
+    public Object rename(@RequestBody JSONObject json) {
+        try {
+            String path = json.getString("item");
+            String newPath = json.getString("newItemPath");
+
+            File srcFile = new File(root, path);
+            File destFile = new File(root, newPath);
+            if (srcFile.isFile()) {
+                FileUtils.moveFile(srcFile, destFile);
+            } else {
+                FileUtils.moveDirectory(srcFile, destFile);
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 查看文件内容,针对html、txt等可编辑文件
+     */
+    @RequestMapping("getContent")
+    public Object getContent(@RequestBody JSONObject json) {
+        try {
+            String path = json.getString("item");
+            File srcFile = new File(root, path);
+
+            String content = FileUtils.readFileToString(srcFile);
+
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("result", content);
+            return jsonObject;
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 修改文件内容,针对html、txt等可编辑文件
+     */
+    @RequestMapping("edit")
+    public Object edit(@RequestBody JSONObject json) {
+        try {
+            String path = json.getString("item");
+            String content = json.getString("content");
+
+            File srcFile = new File(root, path);
+            FileUtils.writeStringToFile(srcFile, content);
+
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 文件压缩
+     */
+    @RequestMapping("compress")
+    public Object compress(@RequestBody JSONObject json) {
+        try {
+            String destination = json.getString("destination");
+            String compressedFilename = json.getString("compressedFilename");
+            JSONArray items = json.getJSONArray("items");
+            List<File> files = new ArrayList<>();
+            for (int i = 0; i < items.size(); i++) {
+                File f = new File(root, items.getString(i));
+                files.add(f);
+            }
+
+            File zip = new File(root + destination, compressedFilename);
+
+            try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zip))) {
+                zipFiles(out, "", files.toArray(new File[files.size()]));
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+    /**
+     * 文件解压
+     */
+    @RequestMapping("extract")
+    public Object extract(@RequestBody JSONObject json) {
+        try {
+            String destination = json.getString("destination");
+            String zipName = json.getString("item");
+            String folderName = json.getString("folderName");
+            File file = new File(root, zipName);
+
+            String extension = com.YuyeTech.TPlat.utils.FileUtils.getExtension(zipName);
+            switch (extension) {
+                case ".zip":
+                    unZipFiles(file, root + destination);
+                    break;
+                case ".gz":
+                    unTargzFile(file, root + destination);
+                    break;
+                case ".rar":
+                    unRarFile(file, root + destination);
+            }
+            return success();
+        } catch (Exception e) {
+            return error(e.getMessage());
+        }
+    }
+
+
+    private JSONObject error(String msg) {
+
+        // { "result": { "success": false, "error": "msg" } }
+        JSONObject result = new JSONObject();
+        result.put("success", false);
+        result.put("error", msg);
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("result", result);
+        return jsonObject;
+
+    }
+
+    private JSONObject success() {
+        // { "result": { "success": true, "error": null } }
+        JSONObject result = new JSONObject();
+        result.put("success", true);
+        result.put("error", null);
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("result", result);
+        return jsonObject;
+    }
+}

+ 768 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageGameController.java

@@ -0,0 +1,768 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.config.GameConfig;
+import com.YuyeTech.TPlat.dataobject.*;
+import com.YuyeTech.TPlat.dto.GameDTO;
+import com.YuyeTech.TPlat.dto.GameTagDTO;
+import com.YuyeTech.TPlat.dto.MakeGameTagDTO;
+import com.YuyeTech.TPlat.enums.GameEnum;
+import com.YuyeTech.TPlat.form.GameInfoForm;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ImageUtils;
+import com.YuyeTech.TPlat.utils.KeyUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author:slambb
+ * @date:2020/6/15
+ */
+@RestController
+@RequestMapping("/backstage_game")
+@Slf4j
+public class BackstageGameController {
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+    @Autowired
+    private GameInfoService gameInfoService;
+
+    @Autowired
+    private GameCategoryService gameCategoryService;
+
+    @Autowired
+    private GamePictureService gamePictureService;
+
+    @Autowired
+    private PicturesService picturesService;
+
+    private ImageUtils imageUtils;
+
+    @Autowired
+    private RecommendService recommendService;
+
+    @Autowired
+    private GameConfig gameConfig;
+
+    @Autowired
+    private GameTagReferenceService gameTagReferenceService;
+
+    @Autowired
+    private GameTagService gameTagService;
+
+    @GetMapping("/list")
+    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             HttpServletRequest req,
+                             Map<String, Object> map) {
+        String userId = req.getParameter("userId");
+
+        //添加推荐游戏,和推荐列表 字段信息
+
+        //查询对应游戏数据
+        PageRequest requestReCommend = PageRequest.of(0, 10, Sort.by(Sort.Direction.ASC, "createTime"));
+
+        Map videoMap = recommendService.findByRecommendType(userId, 1, gameConfig.getEndTime(), requestReCommend);
+        Map gameMap = recommendService.findByRecommendType(userId, 2, gameConfig.getEndTime(), requestReCommend);
+
+        map.put("videoRecommend", videoMap.get("gameList"));
+        map.put("gameRecommend", gameMap.get("gameList"));
+
+
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<GameInfo> GameInfo = gameInfoService.findPage(userId, 0, request);
+        //查询所有的类目
+        List<GameCategory> categoryList = gameCategoryService.findAll();
+
+        map.put("categoryList", categoryList);
+        map.put("gameInfos", GameInfo);
+        map.put("currentPage", page);
+        map.put("size", size);
+
+
+        return new ModelAndView("/game/list", map);
+    }
+
+    @GetMapping("/detail")
+    public ModelAndView detail(@RequestParam(value = "gameId") String gameId,
+                               HttpServletRequest req,
+                               Map<String, Object> map) {
+        String userId = req.getParameter("userId");
+        GameInfo gameInfo = gameInfoService.findByGameId(gameId);
+        map.put("gameInfo", gameInfo);
+        //查找图片库对应的图片信息
+        List<Integer> pictureIdList = gamePictureService.findGamePictureIDList(gameId);
+        List<Pictures> picturesList = picturesService.findAllByPictureIdList(pictureIdList);
+        List<String> carouselUrlList = new ArrayList();
+        for (Pictures item : picturesList) {
+            log.info("=={}", item);
+            if (item.getPictureType().equals(0)) {
+                carouselUrlList.add(item.getPictureUrl());
+            } else if (item.getPictureType().equals(1)) {
+                map.put("icon", item);
+            } else if (item.getPictureType().equals(2)) {
+                map.put("cover", item);
+            }
+        }
+        map.put("carouselUrlList", carouselUrlList);
+        //查询所有的类目
+        List<GameCategory> categoryList = gameCategoryService.findAll();
+        map.put("categoryList", categoryList);
+
+        List<GameTagDTO> gameTagDTOList = gameTagReferenceService.findGameTagByGameId(gameId);
+        //allTags
+        List<GameTag> gameTagList = gameTagService.findAll();
+        List<MakeGameTagDTO> allCustomTags = gameTagList.stream().map(e->{return new MakeGameTagDTO(e.getId(),e.getTitle(),e.getMode(),e.getIsDefault(),false);
+        }).collect(Collectors.toList());
+        for (int i =0;i<allCustomTags.size();i++){
+            for (int j =0;j<gameTagDTOList.size();j++){
+                if(allCustomTags.get(i).getTagId() == gameTagDTOList.get(j).getTagId()){
+                    allCustomTags.get(i).setTagSelect(true);
+                }
+            }
+        }
+        map.put("allCustomTags",allCustomTags);
+
+        return new ModelAndView("/game/detail", map);
+    }
+
+
+    /**
+     * 添加新游戏
+     * @param map
+     * @return
+     */
+    @GetMapping("/add")
+    public ModelAndView addGame(Map<String, Object> map) {
+
+        GameInfo gameInfo = new GameInfo();
+        map.put("gameInfo", gameInfo);
+
+        //查询所有的类目
+        List<GameCategory> categoryList = gameCategoryService.findAll();
+        map.put("categoryList", categoryList);
+
+        //allTags
+        List<GameTag> gameTagList = gameTagService.findAll();
+        List<MakeGameTagDTO> allCustomTags = gameTagList.stream().map(e->{return new MakeGameTagDTO(e.getId(),e.getTitle(),e.getMode(),e.getIsDefault(),false);
+        }).collect(Collectors.toList());
+        map.put("allCustomTags",allCustomTags);
+
+        return new ModelAndView("/game/detail", map);
+    }
+
+
+    @PostMapping("/upload")
+    public ModelAndView upload(@RequestParam("icon") MultipartFile icon,
+                               @RequestParam("cover") MultipartFile cover,
+                               @RequestParam("scroll") MultipartFile[] scroll,
+                               @Valid GameInfoForm gameInfoForm,
+                               @RequestParam("multiselectTag") Integer[] multiselectTag,
+                               Map<String, Object> map) {
+        if (StringUtils.isEmpty(gameInfoForm.getShowTime())) {
+            map.put("msg", "显示时间不能为空!");
+            map.put("url", "/backstage_game/detail");
+            return new ModelAndView("common/error", map);
+        }
+        //存的项目的中模版图片
+        String contextPath = "";
+        File uploadIconFile = null, uploadCoverFile = null, uploadCarouselFile = null;
+        //是否是添加新的,用bool 值判断
+        Boolean BAddIcon = false, BAddCover = false, BAddCarousel = false;
+        Pictures pictureIcon = new Pictures();
+        Pictures pictureCover = new Pictures();
+        try {
+            String uploadUrl = "";
+            if (null != icon) {
+                String filename = icon.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadIconFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadIconFile);
+                    os.write(icon.getBytes());
+                    os.close();
+                    icon.transferTo(uploadIconFile);
+                    //上传到OSS
+                    uploadUrl = aliyunOSSUtil.upload(uploadIconFile, "gameIcon");
+
+                    //添加icon 数据,type = 1
+                    pictureIcon.setPictureUrl(uploadUrl);
+                    pictureIcon.setPictureType(1);
+                    pictureIcon = picturesService.addPictureAndFlush(pictureIcon);
+
+                    BAddIcon = true;
+                }
+            }
+            String coverUrl = "";
+            if (null != cover) {
+                String filename = cover.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadCoverFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadCoverFile);
+                    os.write(cover.getBytes());
+                    os.close();
+                    cover.transferTo(uploadCoverFile);
+                    //上传到OSS
+                    coverUrl = aliyunOSSUtil.upload(uploadCoverFile, "pictures");
+
+                    //添加cover 数据,type = 2
+                    pictureCover.setPictureUrl(coverUrl);
+                    pictureCover.setPictureType(2);
+                    pictureCover = picturesService.addPictureAndFlush(pictureCover);
+
+                    BAddCover = true;
+                }
+            }
+            //轮播图
+            List<Pictures> picturesList = new ArrayList<>();
+            try {
+                for (int i = 0; i < scroll.length; i++) {
+                    //获得文件
+                    MultipartFile multipartFile = scroll[i];
+                    String fileName = multipartFile.getOriginalFilename();
+                    if (!"".equals(fileName.trim())) {
+                        uploadCarouselFile = new File(fileName);
+                        FileOutputStream os = new FileOutputStream(uploadCarouselFile);
+                        os.write(multipartFile.getBytes());
+                        os.close();
+                        multipartFile.transferTo(uploadCarouselFile);
+                        //上传到OSS
+                        String pictureUrl = aliyunOSSUtil.upload(uploadCarouselFile, "pictures");
+                        //1.向Pictures 添加数据
+                        Pictures pictures1 = new Pictures();
+                        pictures1.setPictureUrl(pictureUrl);
+                        pictures1.setPictureType(0);
+                        pictures1 = picturesService.addPictureAndFlush(pictures1);
+                        picturesList.add(pictures1);
+                        log.info(aliyunOSSUtil.addDomainName(pictures1.getPictureUrl()));
+
+                        BAddCarousel = true;
+                    }
+                }
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            }
+            //1.向gameInfo 添加数据 或者更新数据
+            GameInfo gameInfo = new GameInfo();
+            if (!StringUtils.isEmpty(gameInfoForm.getGameId())) {
+                gameInfo = gameInfoService.findByGameId(gameInfoForm.getGameId(), false);
+            } else {
+                String _id = KeyUtil.genUniqueKey();
+                gameInfoForm.setGameId(_id);
+            }
+            BeanUtils.copyProperties(gameInfoForm, gameInfo);
+
+            //如果上传的文件存在 uploadUrl != "" coverUrl != ""
+            if (BAddIcon)
+                gameInfo.setGameIcon(uploadUrl);
+            if (BAddCover)
+                gameInfo.setGamePicture(coverUrl);
+
+            //todo 后续修改成可以选择,后台
+            gameInfo.setGameRankingId(gameInfo.getGameId());
+            gameInfo.setGameRankingShow(1);
+            GameInfo gameInfoTemp = gameInfoService.addGameInfoAndFlush(gameInfo);
+            //保存tags引用
+            List<GameTagReference> gameTagReferenceList = new ArrayList<>();
+            for(int i=0;i<multiselectTag.length;i++){
+                GameTagReference gameTagReference = new GameTagReference();
+                gameTagReference.setGameId(gameInfoTemp.getGameId());
+                gameTagReference.setTagId(multiselectTag[i]);
+                gameTagReference.setStatus(1);
+                gameTagReferenceList.add(gameTagReference);
+
+            }
+            gameTagReferenceService.saveGameTagReference(gameTagReferenceList);
+
+            //把图片库数据和游戏信息绑定起来
+            if (BAddIcon) {
+                GamePicture gamePictureIcon = new GamePicture();
+                gamePictureIcon.setGpType(1);
+                gamePictureIcon.setGameId(gameInfoTemp.getGameId());
+                gamePictureIcon.setPictureId(pictureIcon.getPictureId());
+                gamePictureService.addGamePicture(gamePictureIcon);
+
+                map.put("icon", aliyunOSSUtil.addDomainName(pictureIcon.getPictureUrl()));
+            }
+
+            if (BAddCover) {
+                GamePicture gamePictureCover = new GamePicture();
+                gamePictureCover.setGpType(2);
+                gamePictureCover.setGameId(gameInfoTemp.getGameId());
+                gamePictureCover.setPictureId(pictureCover.getPictureId());
+                gamePictureService.addGamePicture(gamePictureCover);
+
+                map.put("cover", aliyunOSSUtil.addDomainName(pictureCover.getPictureUrl()));
+
+            }
+
+
+            //绑定轮播图 type =0
+            List<String> carouselUrlList = new ArrayList();
+
+            for (int i = 0; i < picturesList.size(); i++) {
+                GamePicture gamePictureList = new GamePicture();
+                gamePictureList.setGpType(0);
+                gamePictureList.setGameId(gameInfoTemp.getGameId());
+                gamePictureList.setPictureId(picturesList.get(i).getPictureId());
+                gamePictureService.addGamePicture(gamePictureList);
+
+                log.info("绑定轮播图");
+                carouselUrlList.add(aliyunOSSUtil.addDomainName(picturesList.get(i).getPictureUrl()));
+            }
+
+
+            if (!StringUtils.isEmpty(gameInfoTemp.getGameIcon()))
+                gameInfoTemp.setGameIcon(aliyunOSSUtil.addDomainName(gameInfoTemp.getGameIcon()));
+            if (!StringUtils.isEmpty(gameInfoTemp.getGamePicture()))
+                gameInfoTemp.setGamePicture(aliyunOSSUtil.addDomainName(gameInfoTemp.getGamePicture()));
+
+            map.put("gameInfo", gameInfoTemp);
+
+            map.put("carouselUrlList", carouselUrlList);
+
+            //查询所有的类目
+            List<GameCategory> categoryList = gameCategoryService.findAll();
+            map.put("categoryList", categoryList);
+
+            //allTags
+            List<GameTag> gameTagList = gameTagService.findAll();
+            List<MakeGameTagDTO> allCustomTags = gameTagList.stream().map(e->{return new MakeGameTagDTO(e.getId(),e.getTitle(),e.getMode(),e.getIsDefault(),false);
+            }).collect(Collectors.toList());
+            for (int i =0;i<allCustomTags.size();i++){
+                for (int j =0;j<multiselectTag.length;j++){
+                    if(allCustomTags.get(i).getTagId() == multiselectTag[j]){
+                        allCustomTags.get(i).setTagSelect(true);
+                    }
+                }
+            }
+            map.put("allCustomTags",allCustomTags);
+
+            return new ModelAndView("/game/detail", map);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (!contextPath.equals("")) {
+                imageUtils.deleteImage(contextPath);
+            }
+            if (uploadIconFile != null)
+                uploadIconFile.delete();
+            if (uploadCoverFile != null)
+                uploadCoverFile.delete();
+            if (uploadCarouselFile != null)
+                uploadCarouselFile.delete();
+        }
+
+        map.put("msg", "游戏数据更新失败!");
+        map.put("url", "/backstage_game/detail");
+        return new ModelAndView("common/error", map);
+    }
+
+    /**
+     * 处理修改游戏信息
+     *
+     * @param icon
+     * @param cover
+     * @param scroll
+     * @param gameInfoForm
+     * @param map
+     * @return
+     */
+    @PostMapping("/modify")
+    public ModelAndView modify(@RequestParam("icon") MultipartFile icon,
+                               @RequestParam("cover") MultipartFile cover,
+                               @RequestParam("scroll") MultipartFile[] scroll,
+                               @Valid GameInfoForm gameInfoForm,
+                               @RequestParam("multiselectTag") Integer[]  multiselectTag,
+                               Map<String, Object> map) {
+
+        if (StringUtils.isEmpty(gameInfoForm.getShowTime())) {
+            map.put("msg", "显示时间不能为空!");
+            map.put("url", "/backstage_game/detail");
+            return new ModelAndView("common/error", map);
+        }
+        //存的项目的中模版图片
+        String contextPath = "";
+        File uploadIconFile = null, uploadCoverFile = null, uploadCarouselFile = null;
+        //是否是添加新的,用bool 值判断
+        Boolean BAddIcon = false, BAddCover = false, BAddCarousel = false;
+        try {
+            String uploadUrl = "";
+            if (null != icon) {
+                String filename = icon.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadIconFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadIconFile);
+                    os.write(icon.getBytes());
+                    os.close();
+                    icon.transferTo(uploadIconFile);
+                    //上传到OSS
+                    uploadUrl = aliyunOSSUtil.upload(uploadIconFile, "gameIcon");
+
+                    //修改icon 数据,type = 1
+                    GamePicture gamePicture = gamePictureService.findByGameIdAndType(1, gameInfoForm.getGameId());
+                    if (gamePicture != null) {
+                        //删除游戏绑定图片库的信息,图片库 不做删除操作
+                        gamePictureService.deleteGamePictureByGpId(gamePicture.getGpId());
+                    }
+                    //写入图片库
+                    Pictures pictureIcon = new Pictures();
+                    pictureIcon.setPictureUrl(uploadUrl);
+                    pictureIcon.setPictureType(1);
+                    pictureIcon = picturesService.addPictureAndFlush(pictureIcon);
+                    //添加新的绑定信息
+                    GamePicture gamePictureIcon = new GamePicture();
+                    gamePictureIcon.setGpType(1);
+                    gamePictureIcon.setGameId(gameInfoForm.getGameId());
+                    gamePictureIcon.setPictureId(pictureIcon.getPictureId());
+                    gamePictureService.addGamePicture(gamePictureIcon);
+
+                    BAddIcon = true;
+
+                    map.put("icon", aliyunOSSUtil.addDomainName(pictureIcon.getPictureUrl()));
+                }
+            }
+            String coverUrl = "";
+            if (null != cover) {
+                String filename = cover.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadCoverFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadCoverFile);
+                    os.write(cover.getBytes());
+                    os.close();
+                    cover.transferTo(uploadCoverFile);
+                    //上传到OSS
+                    coverUrl = aliyunOSSUtil.upload(uploadCoverFile, "pictures");
+
+                    //添加cover 数据,type = 2
+                    GamePicture gamePictureCover = gamePictureService.findByGameIdAndType(2, gameInfoForm.getGameId());
+
+                    if (gamePictureCover != null) {
+                        //删除游戏绑定图片库的信息,图片库 不做删除操作
+                        gamePictureService.deleteGamePictureByGpId(gamePictureCover.getGpId());
+                    }
+                    //写入图片库
+                    Pictures pictureCover = new Pictures();
+                    pictureCover.setPictureUrl(coverUrl);
+                    pictureCover.setPictureType(2);
+                    pictureCover = picturesService.addPictureAndFlush(pictureCover);
+                    //添加新的绑定信息
+                    GamePicture gamePictureIcon = new GamePicture();
+                    gamePictureIcon.setGpType(2);
+                    gamePictureIcon.setGameId(gameInfoForm.getGameId());
+                    gamePictureIcon.setPictureId(pictureCover.getPictureId());
+                    gamePictureService.addGamePicture(gamePictureIcon);
+
+                    BAddCover = true;
+
+                    map.put("cover", aliyunOSSUtil.addDomainName(pictureCover.getPictureUrl()));
+                }
+            }
+            //轮播图
+            List<Pictures> picturesList = new ArrayList<>();
+            try {
+                for (int i = 0; i < scroll.length; i++) {
+                    //获得文件
+                    MultipartFile multipartFile = scroll[i];
+                    String fileName = multipartFile.getOriginalFilename();
+                    if (!"".equals(fileName.trim())) {
+                        uploadCarouselFile = new File(fileName);
+                        FileOutputStream os = new FileOutputStream(uploadCarouselFile);
+                        os.write(multipartFile.getBytes());
+                        os.close();
+                        multipartFile.transferTo(uploadCarouselFile);
+                        //上传到OSS
+                        String pictureUrl = aliyunOSSUtil.upload(uploadCarouselFile, "pictures");
+                        //1.向Pictures 添加数据
+                        Pictures pictures1 = new Pictures();
+                        pictures1.setPictureUrl(pictureUrl);
+                        pictures1.setPictureType(0);
+                        pictures1 = picturesService.addPictureAndFlush(pictures1);
+                        picturesList.add(pictures1);
+                        log.info(aliyunOSSUtil.addDomainName(pictures1.getPictureUrl()));
+
+                        BAddCarousel = true;
+                    }
+                }
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            }
+            //1.向gameInfo 添加数据 或者更新数据
+            GameInfo gameInfo = new GameInfo();
+            if (!StringUtils.isEmpty(gameInfoForm.getGameId())) {
+                gameInfo = gameInfoService.findByGameId(gameInfoForm.getGameId(), false);
+            } else {
+                String _id = KeyUtil.genUniqueKey();
+                gameInfoForm.setGameId(_id);
+            }
+            BeanUtils.copyProperties(gameInfoForm, gameInfo);
+
+            //如果上传的文件存在 uploadUrl != "" coverUrl != ""
+            if (BAddIcon)
+                gameInfo.setGameIcon(uploadUrl);
+            if (BAddCover)
+                gameInfo.setGamePicture(coverUrl);
+
+            GameInfo gameInfoTemp = gameInfoService.addGameInfoAndFlush(gameInfo);
+
+            //todo 如果tags更新,先删除旧的tags
+            gameTagReferenceService.deleteGameTagByGameId(gameInfoTemp.getGameId());
+            List<GameTagReference> gameTagReferenceList = new ArrayList<>();
+            for(int i=0;i<multiselectTag.length;i++){
+                GameTagReference gameTagReference = new GameTagReference();
+                gameTagReference.setGameId(gameInfoTemp.getGameId());
+                gameTagReference.setTagId(multiselectTag[i]);
+                gameTagReference.setStatus(1);
+                gameTagReferenceList.add(gameTagReference);
+
+            }
+            gameTagReferenceService.saveGameTagReference(gameTagReferenceList);
+
+            List<String> carouselUrlList = new ArrayList();
+            //如果轮播图更新,删除旧的数据绑定
+            if (BAddCarousel) {
+                gamePictureService.deleteAllByTypeAndGameId(0, gameInfoTemp.getGameId());
+                log.info("删除轮播图");
+                //绑定轮播图 type =0
+                for (int i = 0; i < picturesList.size(); i++) {
+                    GamePicture gamePictureList = new GamePicture();
+                    gamePictureList.setGpType(0);
+                    gamePictureList.setGameId(gameInfoTemp.getGameId());
+                    gamePictureList.setPictureId(picturesList.get(i).getPictureId());
+                    gamePictureService.addGamePicture(gamePictureList);
+                    log.info("绑定轮播图");
+                    carouselUrlList.add(aliyunOSSUtil.addDomainName(picturesList.get(i).getPictureUrl()));
+                }
+            } else {
+                //查找图片库对应的图片信息
+                List<Integer> pictureIdList = gamePictureService.findGamePictureIDList(gameInfoTemp.getGameId());
+                List<Pictures> getPicturesList = picturesService.findAllByPictureIdList(pictureIdList);
+                for (Pictures item : getPicturesList) {
+                    log.info("=={}", item);
+                    if (item.getPictureType().equals(0)) {
+                        carouselUrlList.add(item.getPictureUrl());
+                    } else if (item.getPictureType().equals(1)) {
+//                        map.put("icon", item);
+                        log.info("数据库的icon={}", item);
+                    } else if (item.getPictureType().equals(2)) {
+//                        map.put("cover", item);
+                        log.info("数据库的cover={}", item);
+
+                    }
+                }
+            }
+
+            if (!StringUtils.isEmpty(gameInfoTemp.getGameIcon()))
+                gameInfoTemp.setGameIcon(aliyunOSSUtil.addDomainName(gameInfoTemp.getGameIcon()));
+            if (!StringUtils.isEmpty(gameInfoTemp.getGamePicture()))
+                gameInfoTemp.setGamePicture(aliyunOSSUtil.addDomainName(gameInfoTemp.getGamePicture()));
+
+            map.put("gameInfo", gameInfoTemp);
+
+            map.put("carouselUrlList", carouselUrlList);
+            //查询所有的类目
+            List<GameCategory> categoryList = gameCategoryService.findAll();
+            map.put("categoryList", categoryList);
+
+            //allTags
+            List<GameTag> gameTagList = gameTagService.findAll();
+            List<MakeGameTagDTO> allCustomTags = gameTagList.stream().map(e->{return new MakeGameTagDTO(e.getId(),e.getTitle(),e.getMode(),e.getIsDefault(),false);
+            }).collect(Collectors.toList());
+            for (int i =0;i<allCustomTags.size();i++){
+                for (int j =0;j<multiselectTag.length;j++){
+                    if(allCustomTags.get(i).getTagId() == multiselectTag[j]){
+                        allCustomTags.get(i).setTagSelect(true);
+                    }
+                }
+            }
+            map.put("allCustomTags",allCustomTags);
+
+            return new ModelAndView("/game/detail", map);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (!contextPath.equals("")) {
+                imageUtils.deleteImage(contextPath);
+            }
+            if (uploadIconFile != null)
+                uploadIconFile.delete();
+            if (uploadCoverFile != null)
+                uploadCoverFile.delete();
+            if (uploadCarouselFile != null)
+                uploadCarouselFile.delete();
+        }
+
+        map.put("msg", "游戏数据更新失败!");
+        map.put("url", "/backstage_game/detail");
+        return new ModelAndView("common/error", map);
+    }
+
+
+    @PostMapping("/upload_new_game")
+    public ResultVO uploadNewGame(@Valid GameInfoForm gameInfoForm) {
+
+        //1.向gameInfo 添加数据
+        GameInfo gameInfo = new GameInfo();
+        if (!StringUtils.isEmpty(gameInfoForm.getGameId())) {
+            gameInfo = gameInfoService.findByGameId(gameInfoForm.getGameId(), false);
+            if (gameInfo == null) {
+                return ResultVOUtil.error(GameEnum.NOT_GAME_INFO.getCode(), GameEnum.NOT_GAME_INFO.getMessage());
+            }
+        } else {
+            String _id = KeyUtil.genUniqueKey();
+            gameInfoForm.setGameId(_id);
+        }
+
+        BeanUtils.copyProperties(gameInfoForm, gameInfo);
+        gameInfo.setGameIcon("");
+        gameInfo.setGamePicture("");
+
+        if (StringUtils.isEmpty(gameInfo.getCreateTime())) {
+            ResultVOUtil.error(GameEnum.NOT_TIME_INFO.getCode(), GameEnum.NOT_TIME_INFO.getMessage());
+        }
+        GameInfo gameInfoTemp = gameInfo;//gameInfoService.addGameInfoAndFlush(gameInfo);
+        Map<String, Object> map = new HashMap<>();
+        map.put("gameInfo", gameInfoTemp);
+        //查询所有的类目
+        List<GameCategory> categoryList = gameCategoryService.findAll();
+        map.put("categoryList", categoryList);
+
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 查看封面图片
+     *
+     * @param gameId
+     * @param req
+     * @param map
+     * @return
+     */
+    @GetMapping("/scrollPictures")
+    public ModelAndView scrollPictures(@RequestParam(value = "gameId") String gameId,
+                                       @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                       @RequestParam(value = "size", defaultValue = "10") Integer size,
+                                       HttpServletRequest req,
+                                       Map<String, Object> map) {
+
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<GamePicture> gamePictures = gamePictureService.findGamePictureByGameId(gameId, request);
+
+        //根据pictureId 查找对应的图片信息
+
+
+        map.put("gamePictures", gamePictures);
+        map.put("gameId", gameId);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/game/scrollPictureList", map);
+    }
+
+    @PostMapping("/bindPicture")
+    public ModelAndView bindPicture(@RequestParam("pictureId") Integer pictureId,
+                                    @RequestParam("gameId") String gameId,
+                                    @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                    @RequestParam(value = "size", defaultValue = "10") Integer size,
+                                    Map<String, Object> map) {
+
+        if (StringUtils.isEmpty(pictureId)) {
+            map.put("msg", "图片id不能为空,参考图片列表");
+            map.put("url", "/backstage_game/scrollPictures?gameId=" + gameId);
+            return new ModelAndView("common/error", map);
+        }
+        Pictures pictures = picturesService.findById(pictureId);
+        if (StringUtils.isEmpty(pictures)) {
+            map.put("msg", "图片id不存在,参考图片列表");
+            map.put("url", "/backstage_game/scrollPictures?gameId=" + gameId);
+            return new ModelAndView("common/error", map);
+        }
+
+        GamePicture gamePicture = new GamePicture();
+        gamePicture.setGameId(gameId);
+        gamePicture.setPictureId(pictureId);
+        gamePicture.setGpType(0);
+        gamePictureService.addGamePicture(gamePicture);
+
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<GamePicture> gamePictures = gamePictureService.findGamePictureByGameId(gameId, request);
+
+        map.put("gamePictures", gamePictures);
+        map.put("gameId", gameId);
+        map.put("currentPage", page);
+        map.put("size", size);
+        map.put("pictureId", pictureId);
+        return new ModelAndView("/game/scrollPictureList", map);
+    }
+
+    //unBindPicture
+    @GetMapping("/unBindPicture")
+    public ModelAndView unBindPicture(@RequestParam("gpId") Integer gpId,
+                                      @RequestParam("gameId") String gameId,
+                                      @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                      @RequestParam(value = "size", defaultValue = "10") Integer size,
+                                      Map<String, Object> map) {
+
+
+        gamePictureService.deleteGamePictureByGpId(gpId);
+
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<GamePicture> gamePictures = gamePictureService.findGamePictureByGameId(gameId, request);
+
+        map.put("gamePictures", gamePictures);
+        map.put("gameId", gameId);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/game/scrollPictureList", map);
+    }
+
+
+    @PostMapping("/delete")
+    public ResultVO delete(@RequestParam(value = "gameId") String gameId,
+                           Map<String, Object> map) {
+
+        //1.向gameInfo 添加数据
+        log.info("删除的游戏id:" + gameId);
+        String str = gameInfoService.deleteByGameId(gameId);
+        map.put("msg", str);
+        return ResultVOUtil.success(map);
+
+    }
+
+    @PostMapping("/upload_folder")
+    public ResultVO uploadFolder(@RequestParam("folder") MultipartFile folder) {
+
+        String uploadFilePath = "D:/testUploadFolder";
+
+        String fileName = folder.getOriginalFilename();  // 文件名
+        File dest = new File(uploadFilePath + '/' + fileName);
+        if (!dest.getParentFile().exists()) {
+            dest.getParentFile().mkdirs();
+        }
+        try {
+            folder.transferTo(dest);
+        } catch (Exception e) {
+            return ResultVOUtil.error(901, "程序错误,请重新上传");
+        }
+        return ResultVOUtil.success();
+    }
+
+}

+ 157 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageManagerController.java

@@ -0,0 +1,157 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.constant.CookieConstant;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.dataobject.AdminInfo;
+import com.YuyeTech.TPlat.dataobject.UserInfo;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.form.AdminForm;
+import com.YuyeTech.TPlat.service.AdminInfoService;
+import com.YuyeTech.TPlat.service.MainInfoService;
+import com.YuyeTech.TPlat.service.UserInfoService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.CookieUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author:slambb
+ * @date:2020/6/15
+ */
+@Controller
+@RequestMapping("/backstage_manager")
+@Slf4j
+public class BackstageManagerController {
+    @Autowired
+    private AdminInfoService adminInfoService;
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @Autowired
+    private MainInfoService mainInfoService;
+    /***
+     * 管理员登陆
+     * @param map
+     * @return
+     */
+    @GetMapping("/adminLogin")
+    public ModelAndView adminLoginForm(
+            HttpServletRequest request,
+            Map<String, Object> map) {
+
+        String url = "http://" + request.getServerName() //服务器地址
+                + ":"
+                + request.getServerPort()           //端口号
+                + request.getRequestURI();
+        log.info("adminLogin url={}", url);
+
+        return new ModelAndView("login/login", map);
+    }
+
+    /***
+     * 管理员登陆
+     * @param map
+     * @return
+     */
+    @GetMapping("/blurAdminLogin")
+    public ModelAndView blurAdminLoginForm(
+            HttpServletRequest request,
+            Map<String, Object> map) {
+
+        String url = "http://" + request.getServerName() //服务器地址
+                + ":"
+                + request.getServerPort()           //端口号
+                + request.getRequestURI();
+        log.info("adminLogin url={}", url);
+
+        return new ModelAndView("login/blurLogin", map);
+    }
+
+
+    //login
+    @RequestMapping("/adminLoginForm")
+    public ModelAndView adminLoginSubmit(@ModelAttribute("form") AdminForm adminForm,
+                                         HttpServletResponse response,
+                                         Map<String, Object> map) {
+        //todo 1.查找用户密码
+        AdminInfo adminInfo = adminInfoService.findByNameAndPassword(adminForm.getAdminName(), adminForm.getAdminPassword());
+        if (adminInfo == null) {
+            map.put("msg", "用户登陆失败!");
+            map.put("url", "/backstage_manager/adminLogin");
+            return new ModelAndView("common/error", map);
+        }
+        //todo 2. 设置token至redis
+        String token = UUID.randomUUID().toString();
+        Integer expire = RedisConstant.EXPIRE;
+
+        stringRedisTemplate.opsForValue().set(String.format(RedisConstant.TOKEN_PREFIX, token), adminInfo.getAdminName(), expire, TimeUnit.SECONDS);
+
+        //3. 设置token至cookie
+        CookieUtil.set(response, CookieConstant.TOKEN, token, expire);
+
+        map.put("msg", ResultEnum.LOGIN_SUCCESS.getMessage());
+        map.put("url", "/backstage_user/list");
+        return new ModelAndView("common/success", map);
+    }
+
+    @GetMapping("/logout")
+    public ModelAndView logout(HttpServletRequest request,
+                               HttpServletResponse response,
+                               Map<String, Object> map) {
+        //1. 从cookie里查询
+        Cookie cookie = CookieUtil.get(request, CookieConstant.TOKEN);
+        if (cookie != null) {
+            //2. 清除redis
+            stringRedisTemplate.opsForValue().getOperations().delete(String.format(RedisConstant.TOKEN_PREFIX, cookie.getValue()));
+
+            //3. 清除cookie
+            CookieUtil.set(response, CookieConstant.TOKEN, null, 0);
+        }
+
+        map.put("msg", ResultEnum.LOGOUT_SUCCESS.getMessage());
+        map.put("url", "/backstage_manager/adminLogin");
+        return new ModelAndView("common/success", map);
+    }
+
+
+    @GetMapping("/backstage_delete_user")
+    public ModelAndView backstageDeleteUser(@RequestParam("userId") String userId, Map<String, Object> map) {
+
+        //1.删除头像W
+        UserInfo userInfo = userInfoService.findUserInfoById(userId, false);
+        if (!userInfo.getAvatarUrl().equals("publicAvatar/defaultAvatar.png") && userInfo.getAvatarUrl() != null && userInfo.getAvatarUrl().length() != 0) {
+            if (aliyunOSSUtil.deleteBlog(userInfo.getAvatarUrl())) {
+                log.info("删除头像成功");
+            }
+        }
+        //2.删除数据库数据
+        mainInfoService.deleteMainInfoById(userId);
+
+        map.put("msg", "删除用户信息成功");
+        map.put("url", "/backstage_user/list");
+        return new ModelAndView("common/success", map);
+    }
+}

+ 232 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstagePictureController.java

@@ -0,0 +1,232 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.Pictures;
+import com.YuyeTech.TPlat.service.PicturesService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/6/15
+ */
+@RestController
+@RequestMapping("/backstage_picture")
+@Slf4j
+public class BackstagePictureController {
+    @Autowired
+    private PicturesService picturesService;
+
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @GetMapping("/list")
+    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             HttpServletRequest req,
+                             Map<String, Object> map) {
+        String userId = req.getParameter("userId");
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<Pictures> pictures = picturesService.findAllByPageable(request);
+        pictures.stream().forEach(e -> {
+            e.setPictureUrl(aliyunOSSUtil.addDomainName(e.getPictureUrl()));
+        });
+        map.put("Pictures", pictures);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/picture/list", map);
+    }
+
+
+    @PostMapping("/upload")
+    public ModelAndView upload(
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size,
+            @RequestParam("pictures") MultipartFile pictures,
+            Map<String, Object> map) {
+
+        map.put("currentPage", page);
+        map.put("size", size);
+
+        //存的项目的中模版图片
+        File uploadFile = null;
+        try {
+            String pitcureUrl = "";
+            if (null != pictures) {
+                String filename = pictures.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadFile);
+                    os.write(pictures.getBytes());
+                    os.close();
+                    pictures.transferTo(uploadFile);
+                    //上传到OSS
+                    pitcureUrl = aliyunOSSUtil.upload(uploadFile, "pictures");
+                    //1.向gameInfo 添加数据
+                    Pictures pictures1 = new Pictures();
+                    pictures1.setPictureUrl(pitcureUrl);
+                    pictures1.setPictureType(0);
+                    picturesService.addPicture(pictures1);
+
+                    PageRequest request = PageRequest.of(page - 1, size);
+                    Page<Pictures> pictures2 = picturesService.findAllByPageable(request);
+                    pictures2.stream().forEach(e -> {
+                        e.setPictureUrl(aliyunOSSUtil.addDomainName(e.getPictureUrl()));
+                    });
+                    map.put("Pictures", pictures2);
+                    map.put("picture", aliyunOSSUtil.addDomainName(pitcureUrl));
+                    return new ModelAndView("/picture/list", map);
+                }
+            } else {
+                map.put("msg", "图片不能为空");
+                map.put("url", "/backstage_picture/list");
+                return new ModelAndView("common/error", map);
+            }
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (uploadFile != null)
+                uploadFile.delete();
+        }
+
+        map.put("msg", "上传图片不成功!");
+        map.put("url", "/backstage_picture/list");
+        return new ModelAndView("common/error", map);
+
+    }
+
+
+    @GetMapping("/deletePicture")
+    public ModelAndView deletePicture(@RequestParam(value = "pictureId") Integer pictureId,
+                                      @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                      @RequestParam(value = "size", defaultValue = "10") Integer size,
+                                      Map<String, Object> map) {
+        picturesService.deletePictureById(pictureId);
+
+        map.put("msg", "删除图片!");
+        map.put("url", "/backstage_picture/list?currentPage=" + page + "&size=" + size);
+        return new ModelAndView("common/success", map);
+    }
+
+
+    @PostMapping("/upload_multiple")
+    public ResultVO uploadPictures(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        log.info("{}", request);
+        //存的项目的中模版图片
+        File uploadFile = null;
+
+        //转型为MultipartHttpRequest
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+
+        List<MultipartFile> fileList = multipartRequest.getFiles("scroll-picture");
+        for (int i = 0; i < fileList.size(); i++) {
+            //获得文件
+            MultipartFile multipartFile = fileList.get(i);
+            try {
+                String fileName = multipartFile.getOriginalFilename();
+                uploadFile = new File(fileName);
+                FileOutputStream os = new FileOutputStream(uploadFile);
+                os.write(multipartFile.getBytes());
+                os.close();
+                multipartFile.transferTo(uploadFile);
+
+                //上传到OSS
+                String pictureUrl = aliyunOSSUtil.upload(uploadFile, "pictures");
+
+                if (pictureUrl == null) {
+                    return ResultVOUtil.error(801, "上传图片不成功!");
+                }
+                //1.向Pictures 添加数据
+                Pictures pictures1 = new Pictures();
+                pictures1.setPictureUrl(pictureUrl);
+                pictures1.setPictureType(0);
+                pictures1 = picturesService.addPictureAndFlush(pictures1);
+
+                log.info(aliyunOSSUtil.addDomainName(pictures1.getPictureUrl()));
+
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+            }
+//            return ResultVOUtil.error(801, "上传图片不成功!");
+        }
+        return ResultVOUtil.error(800, "上传图片成功!");
+
+    }
+
+    /**
+     * 上传处理icon 和 cover,对应type 1,2
+     * @param request
+     * @return
+     */
+    @PostMapping("/upload_single_key")
+    public ResultVO uploadSingleBasedOnKey(
+            HttpServletRequest request) {
+        log.info("{}",request.getParameter("img_key"));
+        String name = request.getParameter("img_key");
+        Integer type = 0;
+        //这里只处理icon 和封面
+        if(name.equals("icon")){
+            type =1;
+        }else if(name.equals("cover")){
+            type =2;
+        }else{
+            return ResultVOUtil.error(801, "上传图片不成功!");
+        }
+        //转型为MultipartHttpRequest
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        MultipartFile multiFile = multipartRequest.getFile(name);
+        //存的项目的中模版图片
+        File uploadFile = null;
+        try {
+            String pitcureUrl = "";
+            if (null != multiFile) {
+                String filename = multiFile.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    uploadFile = new File(filename);
+                    FileOutputStream os = new FileOutputStream(uploadFile);
+                    os.write(multiFile.getBytes());
+                    os.close();
+                    multiFile.transferTo(uploadFile);
+                    //上传到OSS
+                    pitcureUrl = aliyunOSSUtil.upload(uploadFile, "pictures");
+                    //1.向gameInfo 添加数据
+                    Pictures pictures1 = new Pictures();
+                    pictures1.setPictureUrl(pitcureUrl);
+                    pictures1.setPictureType(type);
+                    pictures1 = picturesService.addPictureAndFlush(pictures1);
+                    log.info("{}",pictures1);
+                    return ResultVOUtil.success(pictures1);
+                }
+            } else {
+                return ResultVOUtil.error(801, "上传图片不成功!");
+            }
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (uploadFile != null)
+                uploadFile.delete();
+        }
+
+        return ResultVOUtil.error(801, "上传图片不成功!");
+
+    }
+}

+ 85 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageRecommendController.java

@@ -0,0 +1,85 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.config.GameConfig;
+import com.YuyeTech.TPlat.dataobject.*;
+import com.YuyeTech.TPlat.form.GameInfoForm;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ImageUtils;
+import com.YuyeTech.TPlat.utils.KeyUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/6/15
+ */
+@RestController
+@RequestMapping("/backstage_recommend")
+@Slf4j
+public class BackstageRecommendController {
+    @Autowired
+    private RecommendService recommendService;
+
+    @PostMapping("/add")
+    public ResultVO addGame(
+            @RequestParam(value = "gameId") String gameId,
+            @RequestParam(value = "gameType") Integer gameType,
+            @RequestParam(value = "endTime") String endTime,
+            @RequestParam(value = "showTime") String showTime,
+            Map<String, Object> map) {
+
+        GameInfo gameInfo = new GameInfo();
+        map.put("gameInfo", gameInfo);
+
+        Recommend recommend = new Recommend();
+        recommend.setRObjectId(gameId);
+        if(gameType.equals(1)){
+            recommend.setRecommendType(2);
+        }else{
+            recommend.setRecommendType(1);
+        }
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//注意月份是MM
+        ParsePosition pos = new ParsePosition(0);
+        Date date = simpleDateFormat.parse(endTime,pos);
+        recommend.setCreateTime(date);
+        ParsePosition pos2 = new ParsePosition(0);
+        Date date2 = simpleDateFormat.parse(showTime,pos2);
+        recommend.setShowTime(date2);
+        recommend = recommendService.addRecommend(recommend);
+
+        return ResultVOUtil.success(recommend);
+    }
+
+    @PostMapping("/delete")
+    public ResultVO delete(@RequestParam(value = "gameId") String gameId,
+                           Map<String, Object> map) {
+
+        log.info("删除推荐的游戏:" + gameId);
+        String str = recommendService.deleteByGameId(gameId);
+        map.put("msg", str);
+        return ResultVOUtil.success(map);
+
+    }
+}

+ 111 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageTagController.java

@@ -0,0 +1,111 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.dataobject.GameTagReference;
+import com.YuyeTech.TPlat.dataobject.UserInfo;
+import com.YuyeTech.TPlat.dto.PageInfo;
+import com.YuyeTech.TPlat.dto.PageInfoDTO;
+import com.YuyeTech.TPlat.service.GameTagReferenceService;
+import com.YuyeTech.TPlat.service.UserInfoService;
+import com.YuyeTech.TPlat.utils.JsonUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/6/3
+ */
+@Controller
+@RequestMapping("/backstage_tag")
+@Slf4j
+public class BackstageTagController {
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+    @Autowired
+    private GameTagReferenceService gameTagReferenceService;
+
+
+
+    /**
+     * 标签列表
+     * @param page 第几页, 从1页开始
+     * @param size 一页有多少条数据
+     * @return
+     */
+    @GetMapping("/list")
+    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             Map<String, Object> map) {
+        PageRequest request = PageRequest.of(page - 1, size);
+//        Page<UserInfo> userInfos = userInfoService.findAllUserInfoByPageable(request);
+//        PageImpl page1 = new PageImpl<>();
+//        map.put("tags", tags);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/tag/list", map);
+    }
+
+    /**
+     * 用户详情
+     * @param userId
+     * @param map
+     * @return
+     */
+    @GetMapping("/detail")
+    public ModelAndView detail(@RequestParam("userId") String userId,
+                               Map<String, Object> map) {
+
+        //todo 1.查询用户信息
+        UserInfo userInfo = userInfoService.findUserInfoById(userId,true);
+        if(userInfo == null){
+            map.put("msg","用户信息不存在!");
+            map.put("url","/backstage_user/list");
+            return new ModelAndView("common/error",map);
+        }
+        map.put("userInfo", userInfo);
+
+        return new ModelAndView("user/detail", map);
+    }
+
+    /**
+     * DataTable分页
+     * @param draw
+     * @param start
+     * @param length
+     * @return
+     */
+    @RequestMapping(value = "/page",method = RequestMethod.POST)
+    @ResponseBody
+    public Object article_table(@RequestParam(value = "draw",required = true,defaultValue = "0")String draw,
+                                               @RequestParam(value = "start",required = true,defaultValue = "0")String start,
+                                               @RequestParam(value = "length",required = true,defaultValue = "10")String length){
+        //转换为整形
+        Integer drawInt = Integer.parseInt(draw);
+        Integer startInt = Integer.parseInt(start);
+        Integer lengthInt = Integer.parseInt(length);
+
+        PageRequest request = PageRequest.of(startInt, lengthInt);
+//        PageInfo为自定义dto对象
+        PageInfo<PageInfoDTO> pageInfo = new PageInfo<>();
+//        gameTagReferenceService.findByGameId("1595048084937150416", request)
+        List<String> arrayList = new ArrayList<>();
+
+//        arrayList.add(1)
+        pageInfo.setData(gameTagReferenceService.findByGameId("1595048084937150416", request));
+        pageInfo.setDraw(drawInt);
+        pageInfo.setRecordsTotal(1);
+        pageInfo.setRecordsFiltered(1);
+
+        return pageInfo;
+    }
+
+}

+ 113 - 0
src/main/java/com/YuyeTech/TPlat/controller/BackstageUserController.java

@@ -0,0 +1,113 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.dataobject.UserInfo;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.service.UserInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/6/3
+ */
+@Controller
+@RequestMapping("/backstage_user")
+@Slf4j
+public class BackstageUserController {
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+
+    /**
+     * 用户列表
+     * @param page 第几页, 从1页开始
+     * @param size 一页有多少条数据
+     * @return
+     */
+    @GetMapping("/list")
+    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
+                             @RequestParam(value = "size", defaultValue = "10") Integer size,
+                             Map<String, Object> map) {
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<UserInfo> userInfos = userInfoService.findAllUserInfoByPageable(request);
+        map.put("userInfo", userInfos);
+        map.put("currentPage", page);
+        map.put("size", size);
+        return new ModelAndView("/user/list", map);
+    }
+
+    /**
+     * 用户详情
+     * @param userId
+     * @param map
+     * @return
+     */
+    @GetMapping("/detail")
+    public ModelAndView detail(@RequestParam("userId") String userId,
+                               Map<String, Object> map) {
+
+        //todo 1.查询用户信息
+        UserInfo userInfo = userInfoService.findUserInfoById(userId,true);
+        if(userInfo == null){
+            map.put("msg","用户信息不存在!");
+            map.put("url","/backstage_user/list");
+            return new ModelAndView("common/error",map);
+        }
+        map.put("userInfo", userInfo);
+
+        return new ModelAndView("user/detail", map);
+    }
+
+    @RequestMapping(value = "/")
+    public String index() {
+        return "index";
+    }
+
+
+    /**
+     * 根据用户名搜索信息
+     * @return
+     */
+    @PostMapping("/searchUserInfo")
+    public ModelAndView searchUserInfo(
+            @RequestParam(value = "username")String username,
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size,
+            Map<String, Object> map) {
+        if(page<1){
+            map.put("msg", "page不能小于1.");
+            map.put("url", "/backstage_user/list");
+            return new ModelAndView("common/error", map);
+        }
+        if(StringUtils.isEmpty(username)){
+            map.put("msg", ResultEnum.USER_NAME_ERROR.getMessage());
+            map.put("url", "/backstage_user/list");
+            return new ModelAndView("common/error", map);
+        }
+        //todo 根据用户名搜索,查询用户信息
+        try {
+            PageRequest request = PageRequest.of(page-1, size);
+            Page<UserInfo> userInfoPage =  userInfoService.searchByUsername(request,username);
+            map.put("userInfo",userInfoPage);
+            map.put("username",username);
+            map.put("currentPage", page);
+            map.put("size", size);
+            return new ModelAndView("/user/list", map);
+        } catch (UserException e) {
+            map.put("msg", e.getMessage());
+            map.put("url", "/backstage_user/list");
+            return new ModelAndView("common/error", map);
+        }
+
+    }
+}

+ 113 - 0
src/main/java/com/YuyeTech/TPlat/controller/BluetoothController.java

@@ -0,0 +1,113 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.BluetoothInfo;
+import com.YuyeTech.TPlat.dataobject.DeviceInfo;
+import com.YuyeTech.TPlat.dto.BLToothDTO;
+import com.YuyeTech.TPlat.dto.DeviceBindDTO;
+import com.YuyeTech.TPlat.enums.DeviceEnum;
+import com.YuyeTech.TPlat.service.BluetoothInfoService;
+import com.YuyeTech.TPlat.service.DeviceInfoService;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 操作设备相关
+ * @author:slambb
+ * @date:2020/6/12
+ */
+@RestController
+@RequestMapping("/bluetooth")
+@Slf4j
+public class BluetoothController {
+
+    @Autowired
+    private BluetoothInfoService bluetoothInfoService;
+
+    @GetMapping(value = "/findHasBind")
+    public ResultVO findByBluetooth(@RequestParam(value = "mac") String mac,
+                                    @RequestParam(value = "userId") String userId){
+        //1.未绑定过,判断mac 是否合法(是否存在数据库中)
+        BluetoothInfo bluetoothInfo = bluetoothInfoService.findByMac(mac);
+        if(bluetoothInfo == null){
+            //不合法
+            return  ResultVOUtil.error(DeviceEnum.NOT_BLE_MAC.getCode(),
+                    DeviceEnum.NOT_BLE_MAC.getMessage());
+        }
+
+        //2.合法后判断是否绑定使用过,一个账户可以绑定多个蓝牙
+        if(bluetoothInfo.getBluetoothStatus().equals(1)){
+            //已经使用过或者共享的,都可以返回
+            if(bluetoothInfo.getUserId().equals(userId) || bluetoothInfo.getIsShare().equals(1)){
+                //已经使用过,是对应的用户,返回
+                return ResultVOUtil.error(DeviceEnum.HAS_BLE_BIND.getCode(),
+                        DeviceEnum.HAS_BLE_BIND.getMessage());
+            }else{
+                //不是对应的用户
+                return ResultVOUtil.error(DeviceEnum.HAS_BLE_USED.getCode(),
+                        DeviceEnum.HAS_BLE_USED.getMessage());
+            }
+        }
+
+
+        return  ResultVOUtil.success(DeviceEnum.CAN_BLE_BIND.getMessage());
+    }
+
+    @GetMapping(value = "/bind")
+    public ResultVO generateDeviceInfo(@RequestParam(value = "mac") String mac,
+                                       @RequestParam(value = "userId") String userId){
+
+
+        //1.未绑定过,判断mac 是否合法(是否存在数据库中)
+        BluetoothInfo bluetoothInfo = bluetoothInfoService.findByMac(mac);
+        if(bluetoothInfo == null){
+            //不合法
+            return  ResultVOUtil.error(DeviceEnum.NOT_BLE_MAC.getCode(),
+                    DeviceEnum.NOT_BLE_MAC.getMessage());
+        }
+
+        //2.合法后判断是否是对应用户绑定使用过,一个账户可以绑定多个蓝牙
+        if(bluetoothInfo.getBluetoothStatus().equals(1)){
+            if(bluetoothInfo.getUserId().equals(userId)){
+                //已经使用过,是对应的用户,返回
+                return ResultVOUtil.error(DeviceEnum.HAS_BLE_BIND.getCode(),
+                        DeviceEnum.HAS_BLE_BIND.getMessage());
+            }else{
+                //不是对应的用户
+                return ResultVOUtil.error(DeviceEnum.HAS_BLE_USED.getCode(),
+                        DeviceEnum.HAS_BLE_USED.getMessage());
+            }
+
+        }
+
+        //3.合法,绑定用户信息
+        bluetoothInfo.setUserId(userId);
+        bluetoothInfo.setBluetoothStatus(1);
+
+        BluetoothInfo backBluetoothInfo = bluetoothInfoService.saveBluetoothInfo(bluetoothInfo);
+        Map map = new HashMap();
+        map.put("BindMac",backBluetoothInfo.getBluetoothMac());
+        return ResultVOUtil.success(map);
+
+    }
+
+    @GetMapping(value = "/binding_list")
+    public ResultVO getBindDeviceInfo(@RequestParam(value = "userId") String userId){
+
+        List<BLToothDTO> blToothDTOS = bluetoothInfoService.findAllByUserId(userId);
+        Map map = new HashMap();
+        map.put("devices",blToothDTOS);
+        return ResultVOUtil.success(map);
+
+    }
+
+}

+ 62 - 0
src/main/java/com/YuyeTech/TPlat/controller/ClientGameInfoController.java

@@ -0,0 +1,62 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.AiInfoVO;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.AiInfo;
+import com.YuyeTech.TPlat.service.AiInfoService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * 游戏端的信息处理
+ * 比如给ai 获取头像,性别,姓名等
+ * @author:slambb
+ * @date:2020/3/25
+ */
+@RestController
+@RequestMapping("/client_game")
+public class ClientGameInfoController {
+    @Autowired
+    private AiInfoService aiInfoService;
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @GetMapping("/ai_random_info")
+    public ResultVO getRandomAIInfo(){
+
+        List<AiInfo> aiInfoList = aiInfoService.getAllAiInfo();
+        Random random = new Random();
+        int n = random.nextInt(aiInfoList.size());
+        AiInfo aiInfo= aiInfoList.get(n);
+        //输出一个前端用的vo
+        AiInfoVO aiInfoVO = new AiInfoVO();
+        BeanUtils.copyProperties(aiInfo, aiInfoVO);
+        //修改url,添加访问域名
+        String url = aliyunOSSUtil.addDomainName(aiInfoVO.getAiAvatar());
+        aiInfoVO.setAiAvatar(url);
+
+        return ResultVOUtil.success(aiInfoVO);
+    }
+
+
+    @GetMapping("/transfer_picture")
+    public ResultVO transferPicture(String url){
+
+        Map map  = new HashMap();
+        map.put("url",url);
+
+        return ResultVOUtil.success(url);
+    }
+
+
+
+}
+

+ 86 - 0
src/main/java/com/YuyeTech/TPlat/controller/DeviceController.java

@@ -0,0 +1,86 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.DeviceInfo;
+import com.YuyeTech.TPlat.dto.DeviceBindDTO;
+import com.YuyeTech.TPlat.enums.DeviceEnum;
+import com.YuyeTech.TPlat.service.DeviceInfoService;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 操作设备相关
+ * @author:slambb
+ * @date:2020/6/12
+ */
+@RestController
+@RequestMapping("/device")
+@Slf4j
+public class DeviceController {
+
+    @Autowired
+    private DeviceInfoService deviceInfoService;
+
+    @GetMapping(value = "/bind")
+    public ResultVO generateDeviceInfo(@RequestParam(value = "uuid") String uuid,
+                                       @RequestParam(value = "type") Integer type,
+                                       @RequestParam(value = "userId") String userId){
+
+        if(!type.equals(1)&&!type.equals(2)){
+            return  ResultVOUtil.error(DeviceEnum.NOT_DEVICE_TYPE.getCode(),
+                    DeviceEnum.NOT_DEVICE_TYPE.getMessage());
+        }
+
+        //1.判断是否存在userId 绑定对应的类型设备
+        DeviceInfo deviceUserInfo = deviceInfoService.findByUserIdAndType(userId,type);
+        if(deviceUserInfo != null){
+            //如果绑定过,返回
+            return  ResultVOUtil.error(DeviceEnum.HAS_BIND_DEVICE_TYPE.getCode(),
+                    DeviceEnum.HAS_BIND_DEVICE_TYPE.getMessage());
+        }
+        //2.未绑定过,判断uuid 对应的设备type 是否合法
+        DeviceInfo deviceInfo = deviceInfoService.findByUUIDAndType(uuid,type);
+        if(deviceInfo == null){
+            //不合法
+            return  ResultVOUtil.error(DeviceEnum.NOT_DEVICE_UUID.getCode(),
+                    DeviceEnum.NOT_DEVICE_UUID.getMessage());
+        }
+
+        //3.合法后判断是否绑定使用过
+        if(deviceInfo.getDeviceStatus().equals(1)){
+            //已经使用过,返回
+            return ResultVOUtil.error(DeviceEnum.UUID_HAD_USED.getCode(),
+                    DeviceEnum.UUID_HAD_USED.getMessage());
+        }
+
+        //4.合法,绑定用户信息
+        deviceInfo.setUserId(userId);
+        deviceInfo.setDeviceStatus(1);
+
+        DeviceInfo backDevice = deviceInfoService.saveDeviceInfo(deviceInfo);
+        Map map = new HashMap();
+        map.put("BindUUID",backDevice.getDeviceUuid());
+        return ResultVOUtil.success(map);
+
+    }
+
+    @GetMapping(value = "/binding_list")
+    public ResultVO getBindDeviceInfo(@RequestParam(value = "userId") String userId){
+
+        List<DeviceBindDTO> deviceBindDTO = deviceInfoService.findAllByUserId(userId);
+        Map map = new HashMap();
+        map.put("devices",deviceBindDTO);
+        return ResultVOUtil.success(map);
+
+    }
+
+}

+ 158 - 0
src/main/java/com/YuyeTech/TPlat/controller/FavoritesController.java

@@ -0,0 +1,158 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.dataobject.Favorites;
+import com.YuyeTech.TPlat.service.FavoritesService;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.enums.UserEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/1/14
+ */
+@RestController
+@RequestMapping("/favorites")
+@Slf4j
+public class FavoritesController {
+    @Autowired
+    private FavoritesService favoritesService;
+
+    @GetMapping("/get")
+    public ResultVO getFavorites(@RequestParam(value = "userId", required = false) String userId,
+                                 @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                 @RequestParam(value = "size", defaultValue = "10") Integer size) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createTime"));
+        Map map = favoritesService.findByUserId(userId, 0, request);
+
+        if (map == null) {
+            return ResultVOUtil.error(UserEnum.USER_NOT_FAVORITES.getCode(), UserEnum.USER_NOT_FAVORITES.getMessage());
+        }
+
+        return ResultVOUtil.success(map);
+    }
+    @GetMapping("/get_by_platform")
+    public ResultVO getFavoritesByPlatform(@RequestParam(value = "userId", required = false) String userId,
+                                 @RequestParam(value = "platform", required = false) Integer platform,
+                                 @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                 @RequestParam(value = "size", defaultValue = "10") Integer size) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createTime"));
+        Map map = favoritesService.findByUserIdAndPlatform(userId, 0,platform, request);
+
+        if (map == null) {
+            return ResultVOUtil.error(UserEnum.USER_NOT_FAVORITES.getCode(), UserEnum.USER_NOT_FAVORITES.getMessage());
+        }
+
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 收藏对象
+     *
+     * @param userId
+     * @param fObjectId     收藏对象id
+     * @param favoritesType 收藏类型(0 : 是游戏,)
+     * @return
+     */
+    @GetMapping("/add")
+    public ResultVO addFavorites(@RequestParam(value = "userId", required = false) String userId,
+                                 @RequestParam(value = "fObjectId") String fObjectId,
+                                 @RequestParam(value = "favoritesType") Integer favoritesType) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+
+        try {
+            boolean bHasFavoriteItem = favoritesService.findByUserIdAndFObjectId(userId, fObjectId);
+
+            if (bHasFavoriteItem) {
+                Map tempMap = new HashMap();
+                tempMap.put("bHas", true);
+                tempMap.put("msg", "已收藏过");
+                return ResultVOUtil.success(tempMap);
+            }
+
+            //查询对应数据
+            Favorites favorites = new Favorites();
+            favorites.setUserId(userId);
+            favorites.setFObjectId(fObjectId);
+            favorites.setFavoritesType(favoritesType);
+            favorites.setCreateTime(new Date());
+            //添加后返回值 Favorites tempFavorite  =
+            favoritesService.addFavorite(favorites);
+            Map tempMap = new HashMap();
+            tempMap.put("bHas", false);
+            tempMap.put("msg", "新收藏");
+//        tempMap.put("favorite",tempFavorite);
+            return ResultVOUtil.success(tempMap);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/modify")
+    @Transactional
+    public ResultVO modifyFavorites(@RequestParam(value = "userId", required = false) String userId,
+                                    @RequestParam(value = "fObjectId") String fObjectId,
+                                    @RequestParam(value = "favoritesType") Integer favoritesType) {
+
+        try {
+            boolean bHasFavoriteItem = favoritesService.findByUserIdAndFObjectId(userId, fObjectId);
+
+            //如果有数据
+            if (bHasFavoriteItem) {
+                String temp = favoritesService.delectFavorite(userId, fObjectId);
+                Map tempMap = new HashMap();
+                tempMap.put("bHas", false);
+                tempMap.put("msg", "已删除");
+                return ResultVOUtil.success(tempMap);
+
+            }
+            //没有数据,创建新的对象,写入数据库
+            //查询对应数据
+            Favorites favorites = new Favorites();
+            favorites.setUserId(userId);
+            favorites.setFObjectId(fObjectId);
+            favorites.setFavoritesType(favoritesType);
+            favorites.setCreateTime(new Date());
+            //添加后返回值 Favorites tempFavorite  =
+            favoritesService.addFavorite(favorites);
+            Map tempMap = new HashMap();
+            tempMap.put("bHas", true);
+            tempMap.put("msg", "新收藏");
+//        tempMap.put("favorite",tempFavorite);
+            return ResultVOUtil.success(tempMap);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+    }
+}

+ 130 - 0
src/main/java/com/YuyeTech/TPlat/controller/FcController.java

@@ -0,0 +1,130 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.config.GameConfig;
+import com.YuyeTech.TPlat.dataobject.FcCategory;
+import com.YuyeTech.TPlat.dataobject.GameCategory;
+import com.YuyeTech.TPlat.dataobject.GameInfo;
+import com.YuyeTech.TPlat.dto.FcDTO;
+import com.YuyeTech.TPlat.dto.GameDTO;
+import com.YuyeTech.TPlat.form.GameInfoForm;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@RestController
+@RequestMapping("/FC")
+@Slf4j
+public class FcController {
+
+    @Autowired
+    private FcCategoryService fcCategoryService;
+
+    @Autowired
+    private FcInfoService fcInfoService;
+
+
+    @Autowired
+    private FcCategoryReferenceService fcCategoryReferenceService;
+
+    @Value("${Fc.endTime}")
+    private String getEndTime;
+    /**
+     * 获取游戏分类
+     * @return
+     */
+    @GetMapping("/category_by_all")
+    public ResultVO getFcCategoryByAll(){
+       List<FcCategory> fcCategoryList =  fcCategoryService.findAll();
+       return ResultVOUtil.success(fcCategoryList);
+    }
+    /**
+     * 获取游戏分类
+     * @return
+     */
+    @GetMapping("/category_by_type")
+    public ResultVO getFcCategoryByType(@RequestParam(value = "categoryType", required = false) Integer categoryType){
+        List<FcCategory> fcCategoryList =  fcCategoryService.findByType(categoryType);
+        return ResultVOUtil.success(fcCategoryList);
+    }
+    /**
+     * 根据游戏类目,获取游戏列表
+     * @return
+     */
+//    @GetMapping("/list_from_category")
+//    public ResultVO getGameListFromCategory(@RequestParam(value = "categoryType", required = false) Integer categoryType,
+//                                            @RequestParam(value = "userId", required = false) String userId,
+//                                            @RequestParam(value = "endTime", required = false) String endTime,
+//                                            @RequestParam(value = "page", defaultValue = "1") Integer page,
+//                                            @RequestParam(value = "size", defaultValue = "10") Integer size){
+//        if(StringUtils.isEmpty(endTime)){
+//            endTime = gameConfig.getEndTime();
+//        }
+//        //查询对应游戏数据
+//        PageRequest request = PageRequest.of(page - 1, size);
+//        List<GameDTO> gameDTOList =  gameInfoService.findList(userId,categoryType,endTime,request);
+//
+//        return ResultVOUtil.success(gameDTOList);
+//    }
+
+//    /**
+//     * 根据Fc类目,获取Fc对应的列表
+//     * @return
+//     */
+//    @GetMapping("/list_by_category")
+//    public ResultVO getFcListByCategory(@RequestParam(value = "categoryType", required = false) Integer categoryType,
+//                                        @RequestParam(value = "userId", required = false) String userId,
+//                                        @RequestParam(value = "endTime", required = false) String endTime,
+//                                        @RequestParam(value = "page", defaultValue = "1") Integer page,
+//                                        @RequestParam(value = "size", defaultValue = "10") Integer size){
+//        if(StringUtils.isEmpty(endTime)){
+//            endTime = getEndTime;
+//        }
+//        //查询对应游戏数据
+//        PageRequest request = PageRequest.of(page - 1, size);
+//        List<FcDTO> fcDTOList =  fcInfoService.findList(userId,categoryType,endTime,request);
+//
+//        return ResultVOUtil.success(fcDTOList);
+//    }
+
+    /**
+     * 根据Fc分类,查询引用类目对应的分类,获取Fc引用下分类对应的游戏列表
+     * @return
+     */
+    @GetMapping("/list_by_category")
+    public ResultVO getFcListByCategoryReference(@RequestParam(value = "categoryNumber", required = false) Integer categoryNumber,
+                                        @RequestParam(value = "userId", required = false) String userId,
+                                        @RequestParam(value = "endTime", required = false) String endTime,
+                                        @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                        @RequestParam(value = "size", defaultValue = "10") Integer size){
+        if(StringUtils.isEmpty(endTime)){
+            endTime = getEndTime;
+        }
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<FcDTO> fcDTOList =  fcInfoService.findListByType(userId,categoryNumber,endTime,request);
+
+        return ResultVOUtil.success(fcDTOList);
+    }
+
+}

+ 85 - 0
src/main/java/com/YuyeTech/TPlat/controller/FitnessProgramController.java

@@ -0,0 +1,85 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.FitnessVO;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.enums.UserEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.form.FitnessForm;
+import com.YuyeTech.TPlat.dataobject.FitnessProgram;
+import com.YuyeTech.TPlat.service.FitnessProgramService;
+import com.YuyeTech.TPlat.utils.PropertyUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * @author:slambb
+ * @date:2019/12/31
+ */
+@RestController
+@RequestMapping("/fitness_program")
+@Slf4j
+public class FitnessProgramController {
+
+    @Autowired
+    private FitnessProgramService fitnessProgramService;
+
+    @PostMapping("add")
+    public ResultVO addFitnessInfo(@Valid FitnessForm form,
+                                   @RequestParam(value = "userId") String userId) {
+
+//        log.info("addFitnessInfo userId"+userId);
+        FitnessProgram fitnessProgram = new FitnessProgram();
+        try {
+            fitnessProgram = fitnessProgramService.findFitnessProgramById(userId);
+
+
+            if (fitnessProgram != null) {
+                //获取数据库的卡路里数量
+                Integer _fitnessCumulativeCalorie = fitnessProgram.getCumulativeCalorie();
+
+                BeanUtils.copyProperties(form, fitnessProgram, PropertyUtil.getNullPropertyNames(form));
+
+                if (fitnessProgram.getCumulativeCalorie() < _fitnessCumulativeCalorie)
+                    fitnessProgram.setCumulativeCalorie(_fitnessCumulativeCalorie);
+
+            } else {
+                fitnessProgram = new FitnessProgram();
+                form.setUserId(userId);
+                BeanUtils.copyProperties(form, fitnessProgram);
+            }
+            //保存数据库,获取保存后的字段
+            fitnessProgram = fitnessProgramService.addFitnessProgram(fitnessProgram);
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+        //返回对应展示的信息
+        FitnessVO fitnessVO = new FitnessVO();
+        BeanUtils.copyProperties(fitnessProgram, fitnessVO);
+        return ResultVOUtil.success(fitnessVO);
+    }
+
+    @GetMapping("/get")
+    public ResultVO getUserInfo(@RequestParam(value = "userId", required = false) String userId) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+        FitnessProgram fitnessProgram = fitnessProgramService.findFitnessProgramById(userId);
+
+        if (fitnessProgram == null) {
+            return ResultVOUtil.error(UserEnum.FITNESS_NOT_DATA.getCode(), UserEnum.FITNESS_NOT_DATA.getMessage());
+        }
+        //返回对应展示的信息
+        FitnessVO fitnessVO = new FitnessVO();
+        BeanUtils.copyProperties(fitnessProgram, fitnessVO);
+        return ResultVOUtil.success(fitnessVO);
+    }
+}

+ 244 - 0
src/main/java/com/YuyeTech/TPlat/controller/GameInfoController.java

@@ -0,0 +1,244 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.config.GameConfig;
+import com.YuyeTech.TPlat.dataobject.GameCategory;
+import com.YuyeTech.TPlat.form.GameInfoForm;
+import com.YuyeTech.TPlat.service.GameCategoryService;
+import com.YuyeTech.TPlat.service.RecommendService;
+import com.YuyeTech.TPlat.dataobject.GameInfo;
+import com.YuyeTech.TPlat.dto.GameDTO;
+import com.YuyeTech.TPlat.service.GameInfoService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@RestController
+@RequestMapping("/game")
+@Slf4j
+public class GameInfoController {
+    @Autowired
+    private GameInfoService gameInfoService;
+
+    @Autowired
+    private GameCategoryService gameCategoryService;
+
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @Autowired
+    private RecommendService recommendService;
+
+    @Autowired
+    private GameConfig gameConfig;
+
+    @GetMapping("/list")
+    public ResultVO getAllGame(
+    ) {
+        List<GameInfo> gameInfos = gameInfoService.findAll();
+
+        for (GameInfo gameInfo : gameInfos) {
+            //修改url,添加访问域名
+
+            String gameIcon = gameInfo.getGameIcon();
+            if (gameIcon != null) {
+                String urlIcon = aliyunOSSUtil.addDomainName(gameIcon);
+                gameInfo.setGameIcon(urlIcon);
+            }
+
+            String gamePicture = gameInfo.getGamePicture();
+            if (gamePicture != null) {
+                String urlPicture = aliyunOSSUtil.addDomainName(gamePicture);
+                gameInfo.setGamePicture(urlPicture);
+            }
+
+        }
+
+        return ResultVOUtil.success(gameInfos);
+
+    }
+
+
+    @GetMapping("/detail")
+    public ResultVO getGameDetail(
+            @RequestParam(value = "gameId") String gameId
+    ) {
+        Map map = gameInfoService.findByGameDetail(gameId);
+
+        return ResultVOUtil.success(map);
+
+    }
+
+    @PostMapping("/add_dontLogin")
+    public ResultVO addGameInfo(@Valid GameInfoForm gameInfoForm, HttpServletRequest request) {
+
+        //文件上传
+        if (request instanceof MultipartHttpServletRequest) {
+            MultipartHttpServletRequest mrequest = (MultipartHttpServletRequest) request;
+            List<MultipartFile> files = mrequest.getFiles("gamePicture");
+            Iterator<MultipartFile> iter = files.iterator();
+            while (iter.hasNext()) {
+                MultipartFile photo = iter.next();
+                // 现在有文件上传
+                if (photo != null) {
+                    System.out.println("【*** 文件上传 ***】 name= test");
+                    System.out.println("【*** 文件上传 ***】 photoName="
+                            + photo.getName());
+                    System.out.println("【*** 文件上传 ***】 photoContentType="
+                            + photo.getContentType());
+                    System.out.println("【*** 文件上传 ***】 photoSize="
+                            + photo.getSize());
+//                    try {
+//                        photo.getInputStream();
+//                    } catch (IOException e) {
+//                        e.printStackTrace();
+//                    }
+                }
+            }
+        }
+        //1.向gameInfo 添加数据
+        GameInfo gameInfo = new GameInfo();
+        BeanUtils.copyProperties(gameInfoForm, gameInfo);
+        GameInfo gameInfoTemp = gameInfoService.addGameInfo(gameInfo);
+        //TODO 2. pictures 里面添加图片,获取图片id,
+        //TODO 3. 把游戏id,和图片id,关联起来。在关系表中添加数据 gamePicture
+
+
+        return ResultVOUtil.success(gameInfoTemp);
+    }
+
+    /**
+     * 获取游戏推荐列表
+     * @return
+     */
+    @GetMapping("/recommend_list")
+    public ResultVO getRecommendAllGame(@RequestParam(value = "recommendType", required = false) Integer recommendType,
+                                        @RequestParam(value = "userId", required = false) String userId,
+                                        @RequestParam(value = "endTime", required = false) String endTime,
+                                        @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                       @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+        if(StringUtils.isEmpty(endTime)){
+            endTime = gameConfig.getEndTime();
+        }
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.ASC,"createTime"));
+        Map map = recommendService.findByRecommendType(userId,recommendType,endTime,request);
+
+        return ResultVOUtil.success(map);
+    }
+
+    @GetMapping("/recommend_list_platform")
+    public ResultVO getRecommendAllGame(@RequestParam(value = "recommendType", required = false) Integer recommendType,
+                                        @RequestParam(value = "userId", required = false) String userId,
+                                        @RequestParam(value = "platform", required = false) Integer platform,
+                                        @RequestParam(value = "endTime", required = false) String endTime,
+                                        @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                        @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+        if(StringUtils.isEmpty(endTime)){
+            endTime = gameConfig.getEndTime();
+        }
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.ASC,"createTime"));
+        Map map = recommendService.findByRecommendTypeAndPlatform(userId,recommendType,platform,endTime,request);
+
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 获取游戏分类
+     * @return
+     */
+    @GetMapping("/game_category_list")
+    public ResultVO getGameCategory(){
+       List<GameCategory> gameCategoryList =  gameCategoryService.findAll();
+        return ResultVOUtil.success(gameCategoryList);
+    }
+    /**
+     * 根据游戏类目,获取游戏列表
+     * @return
+     */
+    @GetMapping("/list_from_category")
+    public ResultVO getGameListFromCategory(@RequestParam(value = "categoryType", required = false) Integer categoryType,
+                                            @RequestParam(value = "userId", required = false) String userId,
+                                            @RequestParam(value = "endTime", required = false) String endTime,
+                                            @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                            @RequestParam(value = "size", defaultValue = "10") Integer size){
+        if(StringUtils.isEmpty(endTime)){
+            endTime = gameConfig.getEndTime();
+        }
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<GameDTO> gameDTOList =  gameInfoService.findList(userId,categoryType,endTime,request);
+
+        return ResultVOUtil.success(gameDTOList);
+    }
+
+
+    /**
+     * 根据游戏类目,获取游戏列表
+     * @return
+     */
+    @GetMapping("/list_from_category_platform")
+    public ResultVO getGameListFromCategoryAndPlatform(@RequestParam(value = "categoryType", required = false) Integer categoryType,
+                                            @RequestParam(value = "userId", required = false) String userId,
+                                            @RequestParam(value = "platform",required = false) Integer platform,
+                                            @RequestParam(value = "endTime", required = false) String endTime,
+                                            @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                            @RequestParam(value = "size", defaultValue = "10") Integer size){
+        if(StringUtils.isEmpty(endTime)){
+            endTime = gameConfig.getEndTime();
+        }
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<GameDTO> gameDTOList =  gameInfoService.findListByTypeAndPlatform(userId,categoryType,platform,endTime,request);
+
+        return ResultVOUtil.success(gameDTOList);
+    }
+
+    @GetMapping("/list_by_ranking_show")
+    public ResultVO getGameListByRankingShow(@RequestParam(value = "userId", required = false) String userId,
+                                            @RequestParam(value = "rankingShow", required = false) Integer rankingShow,
+                                            @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                            @RequestParam(value = "size", defaultValue = "10") Integer size){
+
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<GameDTO> gameDTOList =  gameInfoService.findAllByRankingShow(userId,rankingShow,request);
+
+        return ResultVOUtil.success(gameDTOList);
+    }
+
+    @GetMapping("/list_by_ranking_show_and_platform")
+    public ResultVO getGameListByRankingShowAndPlatform(@RequestParam(value = "userId", required = false) String userId,
+                                             @RequestParam(value = "rankingShow", required = false) Integer rankingShow,
+                                             @RequestParam(value = "platform", required = false) Integer platform,
+                                             @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                             @RequestParam(value = "size", defaultValue = "10") Integer size){
+
+        //查询对应游戏数据
+        PageRequest request = PageRequest.of(page - 1, size);
+        List<GameDTO> gameDTOList =  gameInfoService.findAllByRankingShowAndPlatform(userId,rankingShow,platform,request);
+
+        return ResultVOUtil.success(gameDTOList);
+    }
+}

+ 374 - 0
src/main/java/com/YuyeTech/TPlat/controller/LevelController.java

@@ -0,0 +1,374 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.*;
+import com.YuyeTech.TPlat.dto.LevelConditionDTO;
+import com.YuyeTech.TPlat.dto.LevelHonorDTO;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.RSAUtils;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * @author:slambb
+ * @date:2021/8/4
+ */
+@RestController
+@RequestMapping("/level")
+@Slf4j
+public class LevelController {
+
+    @Autowired
+    private LevelJumpService levelJumpService;
+
+    @Autowired
+    private LevelConditionService levelConditionService;
+
+    @Autowired
+    private UserLevelService userLevelService;
+
+    @Autowired
+    private UserWalletsService userWalletsService;
+
+    @Autowired
+    private UserRewardService userRewardService;
+
+    @Autowired
+    private LevelHonorService levelHonorService;
+
+
+    @Value("${RSA.friendId.publicKey}")
+    private String friendIdPublicKey;
+    @Value("${RSA.friendId.privateKey}")
+    private String friendIdPrivateKey;
+
+    /**
+     * 获取levelJump关卡列表
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getLevelJumpList")
+    public ResultVO getLevelJumpList(@RequestParam(value = "userId") String userId) {
+        Map map = levelJumpService.findLevelJumpsAll(userId);
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 过关调用此处,第一次过关,添加对应的信息
+     * 只处理levelJump信息
+     *
+     * @param userId
+     * @param eventId 关卡id
+     * @return
+     */
+    @GetMapping("/passTheLevel")
+    @Transactional(rollbackFor = Exception.class)
+    public ResultVO passTheLevel(@RequestParam(value = "userId") String userId,
+                                 @RequestParam(value = "levelType") Integer eventType,
+                                 @RequestParam(value = "levelId") Integer eventId) {
+
+        // todo 后面看是否需要处理判断过关条件
+        //根据id和类型获取关卡信息
+        UserLevel userLevel = userLevelService.findByUserIdAndEventType(userId, eventType);
+
+        if (userLevel == null) {
+            userLevel = new UserLevel();
+            userLevel.setUserId(userId);
+            userLevel.setCreateTime(new Date());
+            //1 代表 levelJump
+            userLevel.setEventType(eventType);
+            userLevel.setPassedState(eventId.toString());
+            //本身已解锁的默认不用记录解锁
+            userLevel.setUnlockState("");
+            userLevelService.saveUserLevel(userLevel);
+        } else {
+            //存在数据。默认是第二次过关
+            String passed = userLevel.getPassedState();
+            if (passed.length() > 0) {
+                List<Integer> passedStateList = Pattern.compile(",").splitAsStream(passed).map((x) -> Integer.parseInt(x))
+                        .collect(Collectors.toList());
+                if (!passedStateList.contains(eventId)) {
+                    passed = passed.concat("," + eventId);
+                    userLevel.setPassedState(passed);
+                    userLevelService.saveUserLevel(userLevel);
+                }
+            } else {
+                userLevel.setPassedState(eventId.toString());
+                userLevelService.saveUserLevel(userLevel);
+            }
+
+        }
+        //todo 过关后,发放对应奖励,金币,钻石和荣誉,等等。
+
+        Map map = new HashMap();
+        UserReward userReward = userRewardService.findByUserIdAndEventId(userId,eventId);
+        if (eventType.equals(1)) {
+            LevelJump levelJump = levelJumpService.findById(eventId);
+            LevelHonorDTO levelHonorDTO = levelHonorService.findByHonorType(levelJump.getRewardHonor());
+            if (userReward == null) {
+                userReward = new UserReward();
+                userReward.setUserId(userId);
+                userReward.setCreateTime(new Date());
+                userReward.setEventId(levelJump.getId());
+                userReward.setEventName(levelJump.getName());
+                userReward.setEventType(eventType);
+                userReward.setEventState(1);
+                userReward.setPlayCount(1);
+            }else{
+                //如果存在数据,+1次数
+                userReward.setPlayCount(userReward.getPlayCount()+1);
+            }
+            userReward.setGold(levelJump.getRewardGold());
+            userReward.setDiamond(levelJump.getRewardDiamond());
+            userReward.setHonor(levelJump.getRewardHonor());
+            userReward.setHonorName(levelHonorDTO.getName());
+            userReward.setHonorExplain(levelHonorDTO.getExplain());
+            userReward.setHonorUrl(levelHonorDTO.getUrl());
+
+            userRewardService.saveUserReward(userReward);
+            //如果需要奖励
+            //todo 奖励用户相应信息
+            UserWallets userWallets = userWalletsService.modifyGoldAndDiamondInUserWallets(userId, levelJump.getRewardGold(), levelJump.getRewardDiamond(),true);
+
+            map.put("rewardHonor",levelHonorDTO);
+            map.put("rewardGold",levelJump.getRewardGold());
+            map.put("rewardDiamond",levelJump.getRewardDiamond());
+            //返回一个钱包情况
+            map.put("gold", userWallets.getGold());
+            map.put("diamond", userWallets.getDiamond());
+
+        }
+
+
+        map.put("unlockState", userLevel.getUnlockState());
+        map.put("passedState", userLevel.getPassedState());
+        return ResultVOUtil.success(map);
+    }
+
+    @GetMapping("/unlockLevel")
+    public ResultVO UnlockLevel(@RequestParam(value = "userId") String userId,
+                                @RequestParam(value = "numberType") Integer numberType,
+                                @RequestParam(value = "levelType") Integer eventType,
+                                @RequestParam(value = "levelId") Integer eventId) {
+
+        try {
+            //0自动解锁
+            //单人模式解锁条件:1上一关,2金币,3钻石,
+            //双人模式解锁条件:单人模式解锁*(4躲猫猫,5恐龙,6醉拳,7拳霸,8蹦迪,9大威天龙)
+            //1.第一步先判断除了金币和钻石的条件。目前除了2,3.其余的只有一个条件需要判断
+            // 单人条件下,只需要判断上一关的是否已经解锁
+            // 拿到用户记录的关卡数据 levelType = levelJump(1),
+            UserLevel userLevel = userLevelService.findByUserIdAndEventType(userId, eventType);
+            if (userLevel == null) {
+                //提示必须通过第一个自动解锁的关卡。这样才能记录
+                return ResultVOUtil.error(ResultEnum.MUST_PASS_FIRST_LEVEL.getCode(), ResultEnum.MUST_PASS_FIRST_LEVEL.getMessage());
+            }
+            List<Integer> _passedStateList = Pattern.compile(",").splitAsStream(userLevel.getPassedState()).map((x) -> Integer.parseInt(x))
+                    .collect(Collectors.toList());
+            List<Integer> _unlockStateList = Pattern.compile(",").splitAsStream(userLevel.getUnlockState()).map((x) -> Integer.parseInt(x))
+                    .collect(Collectors.toList());
+            //先处理关卡数据
+            if (_unlockStateList.size() > 0) {
+                if (!_unlockStateList.contains(eventId)) {
+                    String _unlock = userLevel.getUnlockState().concat("," + eventId);
+                    userLevel.setUnlockState(_unlock);
+                }
+            } else {
+                userLevel.setUnlockState(eventId.toString());
+            }
+
+            LevelJump curLevelJump = null;
+            Boolean isPassed = false;
+            List<Map> _unlockMapList = new ArrayList<>();
+            //单人条件下判断上一关一个条件
+            if (numberType.equals(1)) {
+                List<LevelJump> levelJumpList = levelJumpService.findLevelJumpsByNumberType(numberType);
+                for (int i = 0; i < levelJumpList.size(); i++) {
+                    curLevelJump = levelJumpList.get(i);
+                    if (curLevelJump.getId().equals(eventId)) {
+                        //如果需要解锁的关卡,如果判断上一关是否通过,并且需要i>0
+                        isPassed = _passedStateList.contains(levelJumpList.get(i - 1).getId());
+                        break;
+                    }
+                }
+
+            } else if (numberType.equals(2)) {
+                //2人模式下,处理条件是需要判断单人模式下对应的关卡是否解锁
+                //todo 拿到当前条件下得limitLevel
+                curLevelJump = levelJumpService.findById(eventId);
+                List<LevelConditionDTO> _lcDTOList = levelConditionService.findByConditionUnlockIn(curLevelJump.getConditionUnlock());
+
+                Map _itemMap = new HashMap();
+                for (int j = 0; j < _lcDTOList.size(); j++) {
+                    LevelConditionDTO levelConditionDTO = _lcDTOList.get(j);
+                    if (levelConditionDTO.getLimitLevel() != null
+                            && !levelConditionDTO.getLimitLevel().equals(2)
+                            && !levelConditionDTO.getLimitLevel().equals(3)) {
+                        //判断是否解锁
+                        _itemMap.put("levelId", levelConditionDTO.getLimitType());
+                        _itemMap.put("explain", levelConditionDTO.getExplain());
+                        _unlockMapList.add(_itemMap);
+                        isPassed = _unlockStateList.contains(levelConditionDTO.getLimitLevel());
+                        break;
+                    }
+                }
+            }
+
+            //如果已经解锁。判断是否需要金币
+            if (isPassed) {
+                if (curLevelJump.getConsumeGold() == 0 && curLevelJump.getConsumeDiamond() == 0) {
+                    //如果不存在扣金币和钻石的情况。即直接解锁
+                    //记录关卡信息
+                    userLevelService.saveUserLevel(userLevel);
+                    Map map = new HashMap();
+//                    map.put("userLevel",userLevel);
+                    return ResultVOUtil.success(map);
+                } else {
+                    //如果需要扣除金币或者钻石
+                    //todo 获取用户钱包信息
+                    UserWallets userWallets = userWalletsService.modifyGoldAndDiamondInUserWallets(userId, curLevelJump.getConsumeGold(), curLevelJump.getConsumeDiamond(),false);
+
+                    //扣费后记录关卡信息
+                    userLevelService.saveUserLevel(userLevel);
+                    Map map = new HashMap();
+                    map.put("gold", userWallets.getGold());
+                    map.put("diamond", userWallets.getDiamond());
+//                    map.put("userLevel",userLevel);
+                    return ResultVOUtil.success(map);
+                }
+
+            } else {
+                if (eventType.equals(1)) {
+                    //目前levelJump = 1
+                    if (numberType.equals(1)) {
+                        return ResultVOUtil.error(ResultEnum.PREVIOUS_LEVEL_NO_PASSED.getCode(), ResultEnum.PREVIOUS_LEVEL_NO_PASSED.getMessage());
+
+                    } else if (numberType.equals(2)) {
+                        return ResultVOUtil.error(ResultEnum.ASSOCIATED_LEVEL_NO_UNLOCKED.getCode(), ResultEnum.ASSOCIATED_LEVEL_NO_UNLOCKED.getMessage(), _unlockMapList);
+
+                    }
+                } else {
+                    //todo 后续处理不同的eventType,关卡类型
+                    return ResultVOUtil.error(ResultEnum.OTHER_LEVEL_NO_UNLOCKED.getCode(), ResultEnum.OTHER_LEVEL_NO_UNLOCKED.getMessage());
+
+                }
+            }
+
+            return ResultVOUtil.error(ResultEnum.LEVEL_NO_UNLOCKED.getCode(), ResultEnum.LEVEL_NO_UNLOCKED.getMessage());
+
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+    }
+
+
+    /**
+     * pk 关卡奖励
+     *
+     */
+    @GetMapping("/pkLevelReward")
+    @Transactional(rollbackFor = Exception.class)
+    public ResultVO passTheLevel(@RequestParam(value = "userId") String userId,
+                                 @RequestParam(value = "friendId") String friendRSA,
+                                 @RequestParam(value = "isMyWin") Boolean isMyWin,
+                                 @RequestParam(value = "levelType") Integer eventType,
+                                 @RequestParam(value = "levelId") Integer eventId) throws InvalidKeySpecException, NoSuchAlgorithmException {
+        //不管谁获胜。都处理通过userId的关卡
+        //根据id和类型获取关卡信息
+        UserLevel userLevel = userLevelService.findByUserIdAndEventType(userId, eventType);
+
+        if (userLevel == null) {
+            userLevel = new UserLevel();
+            userLevel.setUserId(userId);
+            userLevel.setCreateTime(new Date());
+            //1 代表 levelJump
+            userLevel.setEventType(eventType);
+            userLevel.setPassedState(eventId.toString());
+            //本身已解锁的默认不用记录解锁
+            userLevel.setUnlockState("");
+            userLevelService.saveUserLevel(userLevel);
+        } else {
+            //存在数据。默认是第二次过关
+            String passed = userLevel.getPassedState();
+            if (passed.length() > 0) {
+                List<Integer> passedStateList = Pattern.compile(",").splitAsStream(passed).map((x) -> Integer.parseInt(x))
+                        .collect(Collectors.toList());
+                if (!passedStateList.contains(eventId)) {
+                    passed = passed.concat("," + eventId);
+                    userLevel.setPassedState(passed);
+                    userLevelService.saveUserLevel(userLevel);
+                }
+            } else {
+                userLevel.setPassedState(eventId.toString());
+                userLevelService.saveUserLevel(userLevel);
+            }
+
+        }
+        //todo pk后,发放对应奖励,金币,钻石和荣誉,等等。
+        Map map = new HashMap();
+        String decFriendId = RSAUtils.privateDecrypt(friendRSA, RSAUtils.getPrivateKey(friendIdPrivateKey));
+
+        String curId = isMyWin?userId:decFriendId;
+        UserReward userReward = userRewardService.findByUserIdAndEventId(curId,eventId);
+        if (eventType.equals(1)) {
+            LevelJump levelJump = levelJumpService.findById(eventId);
+            LevelHonorDTO levelHonorDTO = levelHonorService.findByHonorType(levelJump.getRewardHonor());
+            if (userReward == null) {
+                userReward = new UserReward();
+                userReward.setUserId(curId);
+                userReward.setCreateTime(new Date());
+                userReward.setEventId(levelJump.getId());
+                userReward.setEventName(levelJump.getName());
+                userReward.setEventType(eventType);
+                userReward.setEventState(1);
+                userReward.setPlayCount(1);
+            }else{
+                //如果存在数据,+1次数
+                userReward.setPlayCount(userReward.getPlayCount()+1);
+            }
+            userReward.setGold(levelJump.getRewardGold());
+            userReward.setDiamond(levelJump.getRewardDiamond());
+            userReward.setHonor(levelJump.getRewardHonor());
+            userReward.setHonorName(levelHonorDTO.getName());
+            userReward.setHonorExplain(levelHonorDTO.getExplain());
+            userReward.setHonorUrl(levelHonorDTO.getUrl());
+
+            userRewardService.saveUserReward(userReward);
+
+            //如果需要奖励
+            //todo 奖励用户相应信息
+            UserWallets userWallets = userWalletsService.modifyGoldAndDiamondInUserWallets(curId, levelJump.getRewardGold(), levelJump.getRewardDiamond(),true);
+
+            map.put("rewardHonor",levelHonorDTO);
+            map.put("rewardGold",levelJump.getRewardGold());
+            map.put("rewardDiamond",levelJump.getRewardDiamond());
+            //如果是自己赢的,返回给当前客户端一个自己用户的钱包情况
+            if(isMyWin){
+                map.put("gold", userWallets.getGold());
+                map.put("diamond", userWallets.getDiamond());
+            }
+
+        }
+        map.put("unlockState", userLevel.getUnlockState());
+        map.put("passedState", userLevel.getPassedState());
+        return ResultVOUtil.success(map);
+    }
+
+}

+ 718 - 0
src/main/java/com/YuyeTech/TPlat/controller/LoginController.java

@@ -0,0 +1,718 @@
+package com.YuyeTech.TPlat.controller;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
+import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
+import com.YuyeTech.TPlat.dataobject.*;
+import com.YuyeTech.TPlat.form.ClientForm;
+import com.YuyeTech.TPlat.form.FeedbackForm;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.*;
+import com.alibaba.fastjson.JSONObject;
+import com.YuyeTech.TPlat.VO.LoginVO;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.VO.UserInfoVO;
+import com.YuyeTech.TPlat.config.WxMaConfiguration;
+import com.YuyeTech.TPlat.constant.CookieConstant;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.enums.UserEnum;
+import com.YuyeTech.TPlat.enums.WxInfoEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.exception.WxInfoException;
+
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 登录
+ *
+ * @author:slambb
+ * @date:2019/12/4
+ */
+@RestController
+@RequestMapping("/program")
+@Slf4j
+public class LoginController {
+
+    @Autowired
+    private StringRedisTemplate redisTemplate;
+
+    @Autowired
+    private MainInfoService mainInfoService;
+
+
+    @Autowired
+    private WxInfoService wxInfoService;
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+    @Autowired
+    private AliyunSMSUtil aliyunSMSUtil;
+
+    @Autowired
+    private AppleInfoService appleInfoService;
+
+    @Autowired
+    private ClientInfoService clientInfoService;
+
+    @Autowired
+    private VersionCodeService versionCodeService;
+
+
+    @GetMapping("/getSessionToken")
+    public ResultVO getSessionToken(@RequestParam("code") String code) {
+
+        log.info("进入getSessionToken 方法。");
+        log.info("code={}", code);
+
+        String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx463e58507db8f1ef&secret=ba04f48301d083e961d6f84cc696aeb2&code=" + code + "&grant_type=authorization_code";
+
+        RestTemplate restTemplate = new RestTemplate();
+        String response = restTemplate.getForObject(url, String.class);
+        log.info("response={}", response);
+        ResultVO resultVO = new ResultVO();
+        resultVO.setCode(0);
+        resultVO.setMsg("成功");
+        resultVO.setData(response);
+
+        return resultVO;
+
+    }
+
+    /**
+     * android 端登录,微信登录
+     * 只要带login,都不用权鉴
+     *
+     * @param openid
+     * @param unionid
+     * @param response
+     * @param request
+     * @return
+     */
+    @GetMapping("/client_wx_login")
+    public ResultVO androidWxLogin(@RequestParam("openid") String openid,
+                                   @RequestParam("unionid") String unionid,
+                                   HttpServletResponse response,
+                                   HttpServletRequest request) {
+        //检查redis 的token 是否存在,存在则删除
+        String headToken = request.getHeader("token");
+        if (StringUtils.isNotBlank(headToken)) {
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            if (!bSuccess) {
+                //删除不成功,redis不存在,是非法token
+                log.info("redis 没有对应的token");
+            }
+        }
+        try {
+            String token = UUID.randomUUID().toString();
+            Integer expire = RedisConstant.EXPIRE;//过期时间
+            Map<String, String> tokenMap = new HashMap<>();
+
+            //1.openid 和 wxInfo数据库的对比,没有用户的话,添加新增用户
+            WxInfo wxInfo = wxInfoService.findWxInfoByOpenid(openid);
+            //2. wxInfo 没有数据,添加新数据
+            MainInfo mainInfo = new MainInfo();
+            if (wxInfo == null) {
+                //先main_info主表添加信息
+                mainInfo = createMainInfo();
+                mainInfoService.addMainInfo(mainInfo);
+                //微信表添加信息 wx_info
+                wxInfo = new WxInfo();
+                wxInfo.setUserId(mainInfo.getUserId());
+                wxInfo.setOpenid(openid);
+                wxInfo.setUnionid(unionid);
+                wxInfoService.addWxInfo(wxInfo);
+            } else {
+                mainInfo = mainInfoService.findMainInfoById(wxInfo.getUserId());
+            }
+
+            //拿到用户userid
+            tokenMap.put("userId", mainInfo.getUserId());
+            tokenMap.put("openid", openid);
+            tokenMap.put("unionid", unionid);
+
+            //2.设置token 到redis
+            redisTemplate.opsForHash().putAll(String.format(RedisConstant.TOKEN_PREFIX, token), tokenMap);
+            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+            //3.设置token到cookie
+            CookieUtil.set(response, CookieConstant.TOKEN, token, expire);
+            //TODO 可以增加自己的逻辑,关联业务相关数据
+            //用userInfo 来判断是否存在userInfo 表中,
+            LoginVO loginVO = new LoginVO();
+            loginVO.setToken(token);
+            loginVO.setNewUser(bUserInfoByUserId(mainInfo.getUserId()));
+            return ResultVOUtil.success(loginVO);
+        } catch (UserException e) {
+            log.error(e.getMessage(), e);
+            return ResultVOUtil.error(e.getCode(), e.toString());
+        }
+
+    }
+
+    //调用创建一个mainInfo
+    public MainInfo createMainInfo() {
+        String _id = KeyUtil.genUniqueKey();
+        MainInfo mainInfo = new MainInfo();
+        mainInfo.setUserId(_id);
+        mainInfo.setUsername("u_" + _id);
+        mainInfo.setPassword("p_" + _id);
+        return mainInfo;
+    }
+
+    //查看是否存在 UserInfo里面;
+    public Boolean bUserInfoByUserId(String userId) {
+        UserInfo saveUserInfo = userInfoService.findUserInfoById(userId, true);
+        Boolean bNewUser = saveUserInfo == null ? true : false;
+        return bNewUser;
+    }
+
+    /**
+     * 小程序端登录
+     *
+     * @param appid
+     * @param code
+     * @param platFrom
+     * @param response
+     * @param request
+     * @return
+     */
+    @GetMapping("/client_login")
+    public ResultVO client_login(@RequestParam("appid") String appid,
+                                 @RequestParam("code") String code,
+                                 @RequestParam("platfrom") String platFrom,
+                                 HttpServletResponse response,
+                                 HttpServletRequest request) {
+        //检查redis 的token 是否存在,存在则删除
+        String headToken = request.getHeader("token");
+        if (StringUtils.isNotBlank(headToken)) {
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            if (!bSuccess) {
+                //删除不成功,redis不存在,是非法token
+//                throw new WxInfoException(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+                log.info("redis 没有对应的token");
+            }
+        }
+
+        //1.配置
+        //2.调用方法
+        final WxMaService wxService = WxMaConfiguration.getMaService(appid);
+
+        try {
+            //token
+            String token = UUID.randomUUID().toString();
+            Integer expire = RedisConstant.EXPIRE;//过期时间
+
+            Map<String, String> tokenMap = new HashMap<>();
+            if (StringUtils.equals(platFrom, "weixin")) {
+                WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(code);
+                //1.openid 和数据库的对比,没有用户的话,添加新增用户
+                WxInfo wxInfo = wxInfoService.findWxInfoByOpenid(session.getOpenid());
+
+                if (wxInfo == null) {
+                    //先main_info主表添加信息
+                    MainInfo mainInfo = createMainInfo();
+                    mainInfoService.addMainInfo(mainInfo);
+                    //微信表添加信息 wx_info
+                    wxInfo = new WxInfo();
+                    wxInfo.setUserId(mainInfo.getUserId());
+                    wxInfo.setOpenid(session.getOpenid());
+                    wxInfoService.addWxInfo(wxInfo);
+                }
+
+                //拿到微信对应的用户userid
+                tokenMap.put("userId", wxInfo.getUserId());
+                tokenMap.put("openid", session.getOpenid());
+                tokenMap.put("sessionKey", session.getSessionKey());
+                tokenMap.put("unionid", session.getUnionid());
+            }
+            //2.设置token 到redis
+            // redisTemplate.opsForValue().set(String.format(RedisConstant.TOKEN_PREFIX,token),session.getOpenid()+session.getSessionKey(),expire, TimeUnit.SECONDS);
+            redisTemplate.opsForHash().putAll(String.format(RedisConstant.TOKEN_PREFIX, token), tokenMap);
+            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+            //3.设置token到cookie
+            CookieUtil.set(response, CookieConstant.TOKEN, token, expire);
+            //TODO 可以增加自己的逻辑,关联业务相关数据
+            LoginVO loginVO = new LoginVO();
+            loginVO.setToken(token);
+            return ResultVOUtil.success(loginVO);
+        } catch (WxErrorException e) {
+            log.error(e.getMessage(), e);
+            return ResultVOUtil.error(500, e.toString());
+        }
+    }
+
+    /**
+     * <pre>
+     * 获取用户信息接口
+     * </pre>
+     */
+    @GetMapping("/wx_getUserInfo")
+    public ResultVO wxGetUserInfo(
+            @RequestParam("appid") String appid,
+            @RequestParam("signature") String signature,
+            @RequestParam("rawData") String rawData,
+            @RequestParam("encryptedData") String encryptedData,
+            @RequestParam("iv") String iv,
+            @RequestParam("userId") String userId,
+            HttpServletRequest request) {
+        final WxMaService wxService = WxMaConfiguration.getMaService(appid);
+//        String cookie= request.getHeader("cookies");
+        //获取到请求后,查询cookie
+//        Cookie cookie = CookieUtil.get(request, CookieConstant.TOKEN);
+        String token = request.getHeader("token");
+        Object sessionKey = redisTemplate.opsForHash().get(String.format(RedisConstant.TOKEN_PREFIX, token), "sessionKey");
+        // 用户信息校验
+        if (!wxService.getUserService().checkUserInfo(sessionKey.toString(), rawData, signature)) {
+//            return "user check failed";
+            throw new WxInfoException(WxInfoEnum.USER_WX_ENCRYPTED_DATA_ERROR);
+        }
+        // 解密用户信息
+        WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey.toString(), encryptedData, iv);
+
+        //解密用户信息时候,如果是新用户,则把用户信息存入数据库
+        UserInfo saveUserInfo = userInfoService.findUserInfoById(userId, true);
+        if (saveUserInfo == null) {
+            saveUserInfo = new UserInfo();
+            saveUserInfo.setUserId(request.getParameterValues("userId")[0]);
+            saveUserInfo.setUsername(userInfo.getNickName());
+            saveUserInfo.setGender(userInfo.getGender());
+            saveUserInfo.setBirthday(new Date());
+            saveUserInfo.setSignature("");
+            saveUserInfo.setAvatarUrl(userInfo.getAvatarUrl());
+            saveUserInfo.setHeight(0.0);
+            saveUserInfo.setWeight(0.0);
+            saveUserInfo.setRegisterTime(new Date());
+            saveUserInfo.setStatus(1);//1为新注册
+            userInfoService.addUserInfo(saveUserInfo);
+        }
+
+
+//        return JsonUtils.toJson(userInfo);
+        //vo 返回给前端的字段筛选
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(saveUserInfo, userInfoVO);
+        return ResultVOUtil.success(userInfoVO);
+    }
+
+    /**
+     * 获取验证码
+     *
+     * @param phoneNumber
+     * @return
+     */
+    @GetMapping("/getCode")
+    public ResultVO getCode(@RequestParam(value = "phoneNumber") String phoneNumber) {
+        Integer expire = RedisConstant.CODE_EXPIRE;//过期时间
+        String code = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
+        if (phoneNumber != null) {
+            aliyunSMSUtil.sendSms(phoneNumber, code);
+            //成功后保存code到redis
+            redisTemplate.opsForValue().set(String.format(RedisConstant.SMS_PREFIX, phoneNumber), code, expire, TimeUnit.SECONDS);
+            log.info("getCode:" + code);
+            return ResultVOUtil.success();
+        } else {
+            return ResultVOUtil.error(200, "获取code失败");
+        }
+    }
+
+    /**
+     * 验证码绑定号码
+     *
+     * @param phoneNumber
+     * @param code
+     * @return
+     */
+    @GetMapping("/SMS_bind_phone")
+    public ResultVO userBindPhoneNumber(@RequestParam("phoneNumber") String phoneNumber,
+                                        @RequestParam("code") String code,
+                                        @RequestParam("userId") String userId) {
+
+        String codeValue = redisTemplate.opsForValue().get(String.format(RedisConstant.SMS_PREFIX, phoneNumber));
+        if (!StringUtils.equals(codeValue, code)) {
+            return ResultVOUtil.error(UserEnum.USER_CODE_ERROR.getCode(), UserEnum.USER_CODE_ERROR.getMessage());
+        }
+        log.info("codeValue:" + codeValue);
+
+        try {
+
+            MainInfo phoneMainInfo = mainInfoService.findMainInfoByPhoneNumber(phoneNumber);
+            if (phoneMainInfo != null) {
+                //如果存在,此手机号提示已注册
+                return ResultVOUtil.error(UserEnum.USER_HAS_REGISTER_PHONE.getCode(), UserEnum.USER_HAS_REGISTER_PHONE.getMessage());
+            }
+
+            MainInfo mainInfo = mainInfoService.findMainInfoById(userId);
+            //TODO 验证码登录流程
+            //如果不存在用户
+            if (mainInfo == null) {
+                return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+            }
+
+            mainInfo.setTelephoneNumber(phoneNumber);
+            mainInfoService.addMainInfo(mainInfo);
+            //TODO 写入成功后,删除redis里面保存的code
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.SMS_PREFIX, phoneNumber));
+            if (!bSuccess) {
+                //删除不成功,redis不存在
+                log.info("redis 没有对应的token");
+            }
+            return ResultVOUtil.success();
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/delete_phone")
+    public ResultVO userDeletePhoneNumber(@RequestParam("userId") String userId) {
+        try {
+            MainInfo mainInfo = mainInfoService.findMainInfoById(userId);
+            //TODO 验证码登录流程
+            //如果不存在用户
+            if (mainInfo == null) {
+                return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+            }
+            mainInfo.setTelephoneNumber(null);
+            mainInfoService.addMainInfo(mainInfo);
+            return ResultVOUtil.success();
+        } catch (UserException e) {
+            return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/bind_wx_info")
+    public ResultVO userBindWXInfo(@RequestParam("openid") String openid,
+                                   @RequestParam("unionid") String unionid,
+                                   @RequestParam("userId") String userId) {
+        try {
+            MainInfo mainInfo = mainInfoService.findMainInfoById(userId);
+            //TODO 验证码登录流程
+            //如果不存在用户
+            if (mainInfo == null) {
+                return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+            }
+
+            //需要检查微信是否被绑定过,如果wxInfo 表存在openid 对应的用户,提示微信已绑定,用户需绑定其他微信账号
+            WxInfo wxInfo = wxInfoService.findWxInfoByOpenid(openid);
+            if (wxInfo == null) {
+                wxInfo = new WxInfo();
+                wxInfo.setUnionid(unionid);
+                wxInfo.setOpenid(openid);
+                wxInfo.setUserId(userId);
+                wxInfoService.addWxInfo(wxInfo);
+            } else {
+                //提示用户微信已被使用
+                return ResultVOUtil.error(UserEnum.USER_HAS_REGISTER_WX.getCode(), UserEnum.USER_HAS_REGISTER_WX.getMessage());
+            }
+
+            return ResultVOUtil.success();
+        } catch (UserException e) {
+            return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+        }
+
+    }
+
+    /**
+     * 验证码登录
+     *
+     * @param phoneNumber
+     * @param code
+     * @return
+     */
+    @GetMapping("/SMS_login")
+    public ResultVO userRegistrationAndSMSLogin(String phoneNumber, String code) {
+        String codeValue = redisTemplate.opsForValue().get(String.format(RedisConstant.SMS_PREFIX, phoneNumber));
+        if (!StringUtils.equals(codeValue, code)) {
+            log.warn("【code校验】Redis 中查找不到验证码 {},==,{}", codeValue, code);
+            return ResultVOUtil.error(UserEnum.USER_CODE_ERROR.getCode(), UserEnum.USER_CODE_ERROR.getMessage());
+        }
+        log.info("codeValue:" + codeValue);
+        //token
+        String token = UUID.randomUUID().toString();
+        Integer expire = RedisConstant.EXPIRE;//过期时间
+        Map<String, String> tokenMap = new HashMap<>();
+
+        try {
+            MainInfo mainInfo = mainInfoService.findMainInfoByPhoneNumber(phoneNumber);
+            //TODO 验证码登录流程
+            //如果不存在用户
+            if (mainInfo == null) {
+                //先main_info主表添加信息
+                mainInfo = createMainInfo();
+                mainInfo.setTelephoneNumber(phoneNumber);
+                mainInfoService.addMainInfo(mainInfo);
+            }
+            //TODO 写入成功后,删除redis里面保存的code
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.SMS_PREFIX, phoneNumber));
+            if (!bSuccess) {
+                //删除不成功,redis不存在
+                log.info("redis 没有对应的token");
+            }
+
+            tokenMap.put("userId", mainInfo.getUserId());
+
+            redisTemplate.opsForHash().putAll(String.format(RedisConstant.TOKEN_PREFIX, token), tokenMap);
+            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+
+            //返回一个token
+            LoginVO loginVO = new LoginVO();
+            loginVO.setToken(token);
+            loginVO.setNewUser(bUserInfoByUserId(mainInfo.getUserId()));
+            return ResultVOUtil.success(loginVO);
+
+        } catch (UserException e) {
+
+            log.error(e.getMessage(), e);
+            return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+        }
+
+    }
+
+    /**
+     * 密码登录
+     *
+     * @param phoneNumber
+     * @param password
+     * @return
+     */
+    @GetMapping("/password_login")
+    public ResultVO userPasswordLogin(String phoneNumber, String password) {
+        try {
+            MainInfo mainInfo = mainInfoService.findMainInfoByPhoneNumberAndPassword(phoneNumber, password);
+
+            //TODO 密码登录流程判断
+//            if(!StringUtils.equals(mainInfo.getTelephoneNumber(),phoneNumber)){
+//                return ResultVOUtil.error(UserEnum.USER_NOT_PHONE_NUMBER.getCode(),UserEnum.USER_NOT_PHONE_NUMBER.getMessage());
+//            }
+//            if(!StringUtils.equals(mainInfo.getPassword(),password)){
+//                return ResultVOUtil.error(UserEnum.USER_PASSWORD_ERROR.getCode(),UserEnum.USER_PASSWORD_ERROR.getMessage());
+//            }
+            if (mainInfo == null) {
+                return ResultVOUtil.error(UserEnum.USER_PASSWORD_ERROR.getCode(), UserEnum.USER_PASSWORD_ERROR.getMessage());
+            }
+            //token
+            String token = UUID.randomUUID().toString();
+            Integer expire = RedisConstant.EXPIRE;//过期时间
+            Map<String, String> tokenMap = new HashMap<>();
+
+            //TODO 登录成功,返回对应的字段
+            tokenMap.put("userId", mainInfo.getUserId());
+            redisTemplate.opsForHash().putAll(String.format(RedisConstant.TOKEN_PREFIX, token), tokenMap);
+            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+
+            //返回一个token
+            LoginVO loginVO = new LoginVO();
+            loginVO.setToken(token);
+            loginVO.setNewUser(bUserInfoByUserId(mainInfo.getUserId()));
+            return ResultVOUtil.success(loginVO);
+        } catch (UserException e) {
+
+            log.error(e.getMessage(), e);
+            return ResultVOUtil.error(UserEnum.USER_REGISTER_ERROR.getCode(), UserEnum.USER_REGISTER_ERROR.getMessage());
+        }
+
+
+    }
+
+    /**
+     * 用来验证一下信息
+     *
+     * @return
+     */
+    @GetMapping("/Verification_Info")
+    public ResultVO VerificationInfo(@RequestParam(value = "token", required = false) String token,
+                                     @RequestParam("userId") String userId) {
+
+        //如果有token,刷新信息
+//        if (null == token || token.isEmpty())
+//        {
+//            Integer expire = RedisConstant.EXPIRE;//过期时间
+//            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+//        }
+        LoginVO loginVO = new LoginVO();
+        loginVO.setNewUser(bUserInfoByUserId(userId));
+        return ResultVOUtil.success(loginVO);
+    }
+
+    /**
+     * 删除token
+     *
+     * @param request
+     * @return
+     */
+    @GetMapping("/delete_token")
+    public ResultVO delectToken(HttpServletRequest request) {
+
+        String headToken = request.getHeader("token");
+        if (StringUtils.isNotBlank(headToken)) {
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            if (!bSuccess) {
+                //删除不成功,redis不存在,是非法token
+                log.info("redis 没有对应的token");
+                return ResultVOUtil.error(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+            }
+        }
+        return ResultVOUtil.success();
+    }
+
+
+
+
+    @GetMapping("/client_apple_login")
+    public ResultVO appleLogin(@RequestParam("identityToken") String identityToken,
+                                   HttpServletResponse response,
+                                   HttpServletRequest request) {
+
+
+        //检查redis 的token 是否存在,存在则删除
+        String headToken = request.getHeader("token");
+        if (StringUtils.isNotBlank(headToken)) {
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            if (!bSuccess) {
+                //删除不成功,redis不存在,是非法token
+                log.info("redis 没有对应的token");
+            }
+        }
+
+        //todo 处理identityToken,判断是否是非法,暂时默认全部合法
+
+
+        try {
+            //验证identityToken
+            if(!AppleUtil.verify(identityToken)){
+                log.info("identityToken:{}",ResultEnum.APPLE_LOGIN_VALIDATION_FAIL.getMessage());
+                return ResultVOUtil.error(ResultEnum.APPLE_LOGIN_VALIDATION_FAIL.getCode(),
+                    ResultEnum.APPLE_LOGIN_VALIDATION_FAIL.getMessage());
+            }
+            //对identityToken解码
+            JSONObject json = AppleUtil.parserIdentityToken(identityToken);
+            if(json == null){
+                log.info("identityToken:{}",ResultEnum.APPLE_LOGIN_TOKEN_FAIL.getMessage());
+                return ResultVOUtil.error(ResultEnum.APPLE_LOGIN_TOKEN_FAIL.getCode(),
+                        ResultEnum.APPLE_LOGIN_TOKEN_FAIL.getMessage());
+            }
+
+            log.info("验证通过的json信息:{}",json);
+
+            String token = UUID.randomUUID().toString();
+            Integer expire = RedisConstant.EXPIRE;//过期时间
+            Map<String, String> tokenMap = new HashMap<>();
+
+            //1.userID 和 appleInfo数据库的appleId对比,没有用户的话,添加新增用户
+            AppleInfo appleInfo = appleInfoService.findByAppleId(json.getString("sub"));
+            //2. appleInfo 没有数据,添加新数据
+            MainInfo mainInfo = new MainInfo();
+            if (appleInfo == null) {
+                //先main_info主表添加信息
+                mainInfo = createMainInfo();
+                mainInfoService.addMainInfo(mainInfo);
+                //微信表添加信息 wx_info
+                appleInfo = new AppleInfo();
+                appleInfo.setUserId(mainInfo.getUserId());
+                appleInfo.setAppleId(json.getString("sub"));
+                appleInfoService.addAppleInfo(appleInfo);
+            } else {
+                mainInfo = mainInfoService.findMainInfoById(appleInfo.getUserId());
+            }
+
+            //拿到用户userid
+            tokenMap.put("userId", mainInfo.getUserId());
+            tokenMap.put("appleId", appleInfo.getAppleId());
+
+            //2.设置token 到redis
+            redisTemplate.opsForHash().putAll(String.format(RedisConstant.TOKEN_PREFIX, token), tokenMap);
+            redisTemplate.expire(String.format(RedisConstant.TOKEN_PREFIX, token), expire, TimeUnit.SECONDS);
+            //3.设置token到cookie
+            CookieUtil.set(response, CookieConstant.TOKEN, token, expire);
+            //TODO 可以增加自己的逻辑,关联业务相关数据
+            //用userInfo 来判断是否存在userInfo 表中,
+            LoginVO loginVO = new LoginVO();
+            loginVO.setToken(token);
+            loginVO.setNewUser(bUserInfoByUserId(mainInfo.getUserId()));
+            return ResultVOUtil.success(loginVO);
+        } catch (UserException e) {
+            log.error(e.getMessage(), e);
+            return ResultVOUtil.error(e.getCode(), e.toString());
+        } catch (Exception e){
+            log.error("app wxLogin error:" + e.getMessage(),e);
+            return ResultVOUtil.error(500, "apple login 系统错误");
+        }
+
+    }
+
+    /**
+     * 更新用户使用的客户端信息
+     * @param clientForm
+     * @return
+     */
+    @PostMapping("/add_client_info")
+    public ResultVO addClientInfo(
+            @Valid ClientForm clientForm) {
+
+
+        ClientInfo clientInfo = clientInfoService.findClientInfoByUserId(clientForm.getUserId());
+        if(clientInfo == null){
+            clientInfo = new ClientInfo();
+        }
+        BeanUtils.copyProperties(clientForm, clientInfo, PropertyUtil.getNullPropertyNames(clientForm));
+//        log.info("==={}",clientInfo);
+        clientInfo = clientInfoService.AddClientInfo(clientInfo);
+        return ResultVOUtil.success(clientInfo);
+    }
+
+
+
+    @GetMapping("/get_version_code_state")
+    public ResultVO getVersionCodeState(@RequestParam("code") String code,
+                                        @RequestParam(value = "platform", required = false) Integer platform ) {
+        try {
+            VersionCode versionCode = versionCodeService.findByCode(code);
+
+            if(versionCode ==  null){
+                return ResultVOUtil.error(ResultEnum.VERSION_CODE_NULL.getCode(), ResultEnum.VERSION_CODE_NULL.getMessage());
+            }
+
+            HashMap map = new HashMap();
+
+            //platform 0:android 1:ios 2:all
+            //getLimitPlatform 0:全都限制,1:限制android,2:限制ios,3:都不限制
+            if(versionCode.getLimitPlatform().equals(0)
+                    ||(platform.equals(0) && versionCode.getLimitPlatform().equals(1))  // android
+                    ||(platform.equals(1) && versionCode.getLimitPlatform().equals(2))) // ios
+            {
+                map.put("showGame",false);
+                map.put("showVideo",false);
+            }else{
+                map.put("showGame",versionCode.getIsShowGame().equals(1));
+                map.put("showVideo",versionCode.getIsShowVideo().equals(1));
+            }
+            map.put("versionCode",versionCode.getCode());
+            map.put("title",versionCode.getTitle());
+
+            return ResultVOUtil.success(map);
+        } catch (UserException e) {
+            return ResultVOUtil.error(ResultEnum.VERSION_CODE_ERROR.getCode(), ResultEnum.VERSION_CODE_ERROR.getMessage());
+        }
+
+    }
+
+}

+ 127 - 0
src/main/java/com/YuyeTech/TPlat/controller/ManagerController.java

@@ -0,0 +1,127 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.constant.RedisConstant;
+import com.YuyeTech.TPlat.dataobject.UserInfo;
+import com.YuyeTech.TPlat.enums.ResultEnum;
+import com.YuyeTech.TPlat.form.FeedbackForm;
+import com.YuyeTech.TPlat.service.GameInfoService;
+import com.YuyeTech.TPlat.service.MainInfoService;
+import com.YuyeTech.TPlat.service.UserInfoService;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.util.Map;
+
+/**
+ * 管理数据库数据
+ *
+ * @author:slambb
+ * @date:2020/4/3
+ */
+@RestController
+@RequestMapping("/manager")
+@Slf4j
+public class ManagerController {
+
+    @Autowired
+    private MainInfoService mainInfoService;
+
+    @Autowired
+    private GameInfoService gameInfoService;
+
+    @Autowired
+    private StringRedisTemplate redisTemplate;
+
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+    /**
+     * 删除用户数据
+     * @param userId
+     * @return
+     */
+    @GetMapping("/deleteUser")
+    public ResultVO deleteUser(@RequestParam("userId") String userId,
+                               HttpServletRequest request) {
+        //1.删除token
+        String headToken = request.getHeader("token");
+        log.info("{}",request.getParameterValues("userId")[0]);
+        if (StringUtils.isNotBlank(headToken)) {
+            log.info(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            Boolean bSuccess = redisTemplate.delete(String.format(RedisConstant.TOKEN_PREFIX, headToken));
+            if (!bSuccess) {
+                //删除不成功,redis不存在,是非法token
+                log.info("redis 没有对应的token");
+                return ResultVOUtil.error(ResultEnum.TOKEN_IS_ILLEGAL.getCode(), ResultEnum.TOKEN_IS_ILLEGAL.getMessage());
+            }
+        }
+        //2.删除头像W
+        UserInfo userInfo = userInfoService.findUserInfoById(userId, false);
+        if (!userInfo.getAvatarUrl().equals("publicAvatar/defaultAvatar.png") && userInfo.getAvatarUrl() != null && userInfo.getAvatarUrl().length() != 0) {
+            if (aliyunOSSUtil.deleteBlog(userInfo.getAvatarUrl())) {
+                log.info("删除头像成功");
+            }
+        }
+        //3.删除数据库数据
+        mainInfoService.deleteMainInfoById(userId);
+
+        return ResultVOUtil.success();
+    }
+
+    /**
+     * 更加userId 来删除信息
+     * @param userId
+     * @return
+     */
+    @GetMapping("/deleteUserById")
+    public ResultVO deleteUserById(@RequestParam("userId") String userId) {
+        UserInfo userInfo = userInfoService.findUserInfoById(userId, false);
+        if (!userInfo.getAvatarUrl().equals("publicAvatar/defaultAvatar.png") && userInfo.getAvatarUrl() != null && userInfo.getAvatarUrl().length() != 0) {
+            if (aliyunOSSUtil.deleteBlog(userInfo.getAvatarUrl())) {
+                log.info("删除头像成功");
+            }
+        }
+        //3.删除数据库数据
+        mainInfoService.deleteMainInfoById(userId);
+
+        return ResultVOUtil.success();
+    }
+
+    /**
+     * 删除游戏
+     * @param gameId
+     * @return
+     */
+    @GetMapping("/deleteGame")
+    @Transactional
+    public ResultVO deleteGame(@RequestParam("gameId") String gameId) {
+        gameInfoService.deleteByGameId(gameId);
+        return ResultVOUtil.success();
+    }
+
+
+    @PostMapping("/upload_feedback")
+    @ResponseBody
+    public ResultVO toUploadBlogPost(@RequestParam(value = "files", required = false) MultipartFile[] files,
+                                     @Valid FeedbackForm feedbackForm,
+                                     Map<String, Object> map) {
+
+        log.info("{}",files.length);
+
+
+        return ResultVOUtil.success();
+    }
+}

+ 28 - 0
src/main/java/com/YuyeTech/TPlat/controller/NavigationController.java

@@ -0,0 +1,28 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 导航栏分类
+ * @author:slambb
+ * @date:2019/12/2
+ * @RestController  :返回是json
+ * @RequestMapping  :前缀
+ */
+@RestController
+@RequestMapping("/navigation")
+public class NavigationController {
+
+    @GetMapping("/categories")
+    public ResultVO categories(){
+        ResultVO resultVO = new ResultVO();
+        resultVO.setCode(0);
+        resultVO.setMsg("成功");
+//        resultVO.setTestName("测试jsonProperty。");
+        return resultVO;
+    }
+
+}

+ 49 - 0
src/main/java/com/YuyeTech/TPlat/controller/OtaController.java

@@ -0,0 +1,49 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.OtaInfo;
+import com.YuyeTech.TPlat.service.OtaInfoService;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static com.YuyeTech.TPlat.enums.ResultEnum.NO_OTA;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@RestController
+@RequestMapping("/OTA")
+@Slf4j
+public class OtaController {
+
+    @Autowired
+    private OtaInfoService otaInfoService;
+    /**
+     * 获取游戏分类
+     * @return
+     */
+    @GetMapping("/get_ota")
+    public ResultVO getFcCategoryByType(@RequestParam(value = "bleType", required = false) Integer bleType){
+        OtaInfo ota =  otaInfoService.findOTAByBLETypeAndStatus(bleType,1);
+        if(ota == null){
+            return ResultVOUtil.error(NO_OTA.getCode(), NO_OTA.getMessage());
+
+        }
+        Map otaMap = new HashMap();
+        otaMap.put("otaName",ota.getOtaName());
+        otaMap.put("bleName",ota.getBleName());
+        otaMap.put("otaDownload",ota.getOtaDownload());
+        return ResultVOUtil.success(otaMap);
+    }
+
+}

+ 285 - 0
src/main/java/com/YuyeTech/TPlat/controller/RankingController.java

@@ -0,0 +1,285 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.*;
+import com.YuyeTech.TPlat.dataobject.Ranking;
+import com.YuyeTech.TPlat.dataobject.UserInfo;
+import com.YuyeTech.TPlat.dto.UserDTO;
+import com.YuyeTech.TPlat.service.RankingService;
+import com.YuyeTech.TPlat.service.UserInfoService;
+
+import com.YuyeTech.TPlat.constant.RankingConstant;
+import com.YuyeTech.TPlat.dataobject.GameInfo;
+import com.YuyeTech.TPlat.dataobject.RankInfo;
+import com.YuyeTech.TPlat.enums.GameEnum;
+import com.YuyeTech.TPlat.service.GameInfoService;
+import com.YuyeTech.TPlat.service.RankInfoService;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.core.ZSetOperations;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 排行榜
+ *
+ * @author:slambb
+ * @date:2020/3/19
+ */
+@Controller
+@RequestMapping("/ranking")
+@Slf4j
+public class RankingController {
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    @Autowired
+    private UserInfoService userInfoService;
+
+    @Autowired
+    private RankInfoService rankInfoService;
+
+    @Autowired
+    private RankingService rankingService;
+
+    @Autowired
+    private GameInfoService gameInfoService;
+
+    @ResponseBody
+    @PostMapping("/add_rank_game")
+    public ResultVO addRankInfo(@RequestParam(required = false) String gameId,
+                                @RequestParam(required = false) Double score,
+                                @RequestParam String userId) {
+        //1.查找对应的RankInfo,把游戏id 写入进去
+
+        RankInfo rankInfo = rankInfoService.findShowRankInfoByUserId(userId);
+        //修改对应游戏id ,就用这个id 来保存,此gameId 就是排行榜显示的游戏id;
+        if (rankInfo == null) {
+            rankInfo = new RankInfo();
+        }
+        rankInfo.setRankType(0);
+        rankInfo.setRObjectId(gameId);
+        rankInfo.setRankScore(score);
+        rankInfo.setUserId(userId);
+        rankInfo.setRankShow(1);
+
+        rankInfo = rankInfoService.addRankInfo(rankInfo);
+
+        RankInfoVO rankInfoVO = new RankInfoVO();
+        rankInfoVO.setRObjectId(rankInfo.getRObjectId());
+        rankInfoVO.setRankScore(rankInfo.getRankScore());
+        rankInfoVO.setRankShow(rankInfo.getRankShow());
+        rankInfoVO.setRankType(rankInfo.getRankType());
+        return ResultVOUtil.success(rankInfoVO);
+    }
+
+    @ResponseBody
+    @GetMapping("/get_rank_game")
+    public ResultVO getRankGameInfo(@RequestParam String userId) {
+        RankInfo rankInfo = rankInfoService.findShowRankInfoByUserId(userId);
+        if (rankInfo == null) {
+            return ResultVOUtil.error(GameEnum.NOT_RANK_GAME_INFO.getCode(), GameEnum.NOT_RANK_GAME_INFO.getMessage());
+        }
+        //1.先查游戏基本数据
+        GameInfo gameInfo = gameInfoService.findByGameId(rankInfo.getRObjectId());
+        GameVO gameVO = new GameVO();
+        BeanUtils.copyProperties(gameInfo, gameVO);
+        return ResultVOUtil.success(gameVO);
+    }
+
+    @ResponseBody
+    @PostMapping("/upload")
+    public ResultVO uploadRanking(@RequestParam(required = false) String cityCode,
+                                  @RequestParam(required = false) String gameId,
+                                  @RequestParam(required = false) Boolean bMaxLimit,
+                                  @RequestParam String userId,
+                                  @RequestParam Double score) {
+
+        //1. key 存储是拆分区域码,前两位是省,中间两位是市,如果是辖市区,以省为主(cityCode 取前四位);
+        //2. 存储一个市的key 值,存储一个全国的key 值。
+        //3. cityKey 的拼接是市的 cityCode+gameId,chinaKey 全国的是 gameId
+
+        String cityKey = String.format(RankingConstant.cityKey, cityCode.substring(0, 4), gameId);
+        String chinaKey = String.format(RankingConstant.chinaKey, gameId);
+
+        ZSetOperations zSetOperations = stringRedisTemplate.opsForZSet();
+
+        //如果不存在,直接添加,如果存在,更新最大值
+        //在redis中那排名分数,
+//        Double getScore = zSetOperations.score(cityKey, userId);
+//        if (StringUtils.isEmpty(getScore)) {
+        //不用查看redis 分数,直接拿服务器的分数,写入redis 和 更新服务器
+        Ranking ranking = rankingService.findRankingByUserIdAndGameIdAndCityCode(userId, gameId, cityCode);
+        if (ranking == null) {
+            if (score.compareTo(0.0) < 0) {
+                //空时候,小于0,设置最小值0
+                score = 0.0;
+            } else if (score.compareTo(9000.0) > 0) {
+                //如果传入值大于9000,设置最大值为9000
+                if (!StringUtils.isEmpty(bMaxLimit) && bMaxLimit) {
+                    score = 9000.0;
+                }
+            }
+            ranking = new Ranking();
+            ranking.setCityCode(cityCode);
+            ranking.setRankType(0);
+            ranking.setRObjectId(gameId);
+            ranking.setUserId(userId);
+            ranking.setRankScore(score);
+            rankingService.addRanking(ranking);
+        } else {
+            Double _getScore = ranking.getRankScore();
+            score = add(_getScore, score, bMaxLimit);
+            ranking.setRankScore(score);
+            rankingService.addRanking(ranking);
+        }
+        zSetOperations.add(cityKey, userId, score);
+
+        //todo 获取全国分数,以最大值为主,比如很多个地区,不同的地区玩的这个游戏
+        //     都会产生一个对应的分数,全国的分数,以最高的地区为主
+        Double chinaScore = zSetOperations.score(chinaKey, userId);
+        //如果不存在分数,或者记录的分数小于当前的输入分数,则添加更新
+        if (StringUtils.isEmpty(chinaScore) || chinaScore < score) {
+            zSetOperations.add(chinaKey, userId, score);
+        }
+//        } else {
+//            //假如redis 存在,
+//            Ranking ranking = rankingService.findRankingByUserIdAndGameIdAndCityCode(userId, gameId, cityCode);
+//            if (ranking == null) {
+//                //redis 存在,但是服务器不存在
+//                ranking = new Ranking();
+//                ranking.setCityCode(cityCode);
+//                ranking.setRankType(0);
+//                ranking.setRObjectId(gameId);
+//                ranking.setUserId(userId);
+//                //假如redis 分数大于 传入分数
+////               if(getScore>score){
+////                   ranking.setRankScore(getScore);
+////                   zSetOperations.add(cityKey, userId, getScore);
+////                   zSetOperations.add(chinaKey, userId, getScore);
+////               }else{
+////                   ranking.setRankScore(score);
+////                   zSetOperations.add(cityKey, userId, score);
+////                   zSetOperations.add(chinaKey, userId, score);
+////               }
+//                //把两个值相加判断
+//                double _addScore = add(getScore,score);
+//                ranking.setRankScore(_addScore);
+//                zSetOperations.add(cityKey, userId, _addScore);
+//                zSetOperations.add(chinaKey, userId, _addScore);
+//
+//                rankingService.addRanking(ranking);
+//
+//            } else {
+//                //if (getScore < score)
+//                //ranking 存在分数, redis getScore 小于存入
+//                ranking.setRankScore(score);
+//                rankingService.addRanking(ranking);
+//                zSetOperations.add(cityKey, userId, score);
+//                zSetOperations.add(chinaKey, userId, score);
+//            }
+//
+//        }
+
+        return ResultVOUtil.success();
+    }
+
+    //相加
+    public static double add(Double v1, Double v2, Boolean bMaxLimit) {
+        BigDecimal b1 = new BigDecimal(v1);
+        BigDecimal b2 = new BigDecimal(v2);
+        Double _addScore = b1.add(b2).doubleValue();
+
+        //如果服务器的值,加传入值小于0,设置为 0
+        if (_addScore.compareTo(0.0) < 0) {
+            //空时候,小于0,设置最小值0
+            _addScore = 0.0;
+        } else if (_addScore.compareTo(9000.0) > 0) {
+            //如果score大于9000,设置最大值为9000
+            if (!StringUtils.isEmpty(bMaxLimit) && bMaxLimit) {
+                _addScore = 9000.0;
+            }
+        }
+
+        return _addScore;
+    }
+
+    @GetMapping("/get")
+    @ResponseBody
+    public ResultVO getRanking(@RequestParam String key, @RequestParam String userId) {
+//        stringRedisTemplate.opsForValue().get(key);
+        Double score = stringRedisTemplate.opsForZSet().score(key, userId);
+        return ResultVOUtil.success(score);
+    }
+
+    @ResponseBody
+    @GetMapping("/get_range")
+    public ResultVO getRangeRanking(@RequestParam(required = false) String type,
+                                    @RequestParam(required = false) String cityCode,
+                                    @RequestParam(required = false) String gameId,
+                                    @RequestParam String userId) {
+
+        //1.先查游戏基本数据
+        GameInfo gameInfo = gameInfoService.findByGameId(gameId);
+        GameVO gameVO = new GameVO();
+        if (gameInfo == null) {
+            return ResultVOUtil.error(GameEnum.NOT_GAME_INFO.getCode(), GameEnum.NOT_GAME_INFO.getMessage());
+        }
+        BeanUtils.copyProperties(gameInfo, gameVO);
+        //cityKey 默认是全国
+        String cityKey = String.format(RankingConstant.chinaKey, gameInfo.getGameId());
+        if (type.equals("city")) {
+            //1. 根据gameId 和 cityCode 来查询
+            cityKey = String.format(RankingConstant.cityKey, cityCode.substring(0, 4), gameInfo.getGameId());
+        }
+
+        ZSetOperations zSetOperations = stringRedisTemplate.opsForZSet();
+
+        //2.redis查询排行前十的数据,再先mysql 里面查询对应的参数
+        Set<ZSetOperations.TypedTuple<Object>> rankTen = zSetOperations.reverseRangeWithScores(cityKey, 0, 19);
+        Iterator<ZSetOperations.TypedTuple<Object>> iterator = rankTen.iterator();
+        List<String> userIdList = new ArrayList<>();
+        List<Double> scoreList = new ArrayList<>();
+        while (iterator.hasNext()) {
+            ZSetOperations.TypedTuple<Object> typedTuple = iterator.next();
+            userIdList.add(typedTuple.getValue().toString());
+            scoreList.add(typedTuple.getScore());
+        }
+        List<UserDTO> userInfoList = new ArrayList<>();
+        if (userIdList.size() != 0) {
+            userInfoList = userInfoService.findUserInfoListByIDs(userIdList);
+        }
+
+        Long myRank = zSetOperations.reverseRank(cityKey, userId);
+        Double myScore = zSetOperations.score(cityKey, userId);
+
+        //3. 查询用户的数据
+        UserInfo userInfo = userInfoService.findUserInfoById(userId, true);
+
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+
+
+        RankingVO rankingVO = new RankingVO();
+        rankingVO.setUserInfo(userInfoVO);
+        rankingVO.setUserScore(myScore);
+        if (myRank != null) {
+            rankingVO.setUserRank(myRank + 1);
+        }
+        rankingVO.setUserInfoVOList(userInfoList);
+        rankingVO.setScoreList(scoreList);
+        rankingVO.setType(type);
+
+        Map map = new HashMap();
+        map.put("gameInfo", gameVO);
+        map.put("rankInfo", rankingVO);
+
+        return ResultVOUtil.success(map);
+    }
+}

+ 130 - 0
src/main/java/com/YuyeTech/TPlat/controller/RecentlyPlayingController.java

@@ -0,0 +1,130 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.dataobject.RecentlyPlaying;
+import com.YuyeTech.TPlat.service.RecentlyPlayingService;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.enums.UserEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+/**
+ * 最近在在返回接口
+ *
+ * @author:slambb
+ * @date:2020/1/15
+ */
+@RestController
+@RequestMapping("/recently_playing")
+@Slf4j
+public class RecentlyPlayingController {
+    @Autowired
+    private RecentlyPlayingService recentlyPlayingService;
+
+    /**
+     * 添加用户在玩列表
+     *
+     * @param userId
+     * @param fObjectId    对象id,如游戏id
+     * @param recentlyType 对象类型(0:游戏 TODO 1:视频)
+     * @return
+     */
+    @GetMapping("/add")
+    public ResultVO addRecentlyPlaying(@RequestParam(value = "userId", required = false) String userId,
+                                       @RequestParam(value = "fObjectId") String fObjectId,
+                                       @RequestParam(value = "recentlyType") Integer recentlyType) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        try {
+            RecentlyPlaying getRecently = recentlyPlayingService.findByUserIdAndFObjectId(userId, fObjectId);
+//            DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式
+//            Date date = new Date(System.currentTimeMillis());//获取时间
+//
+//            String dateString = df.format(date);//进行转换
+            if (getRecently != null) {
+
+//                tempMap.put("msg", "已收藏过");
+
+                getRecently.setCreateTime(new Date());
+               RecentlyPlaying temp =   recentlyPlayingService.addRecentlyItem(getRecently);
+               if(temp!=null){
+                   Map tempMap = new HashMap();
+                   tempMap.put("createTime", temp.getCreateTime());
+                   return ResultVOUtil.success(tempMap);
+               }else{
+                   throw new UserException(UserEnum.RECENTLY_ADD_ERROR);
+               }
+
+            }
+
+            //查询对应数据
+            RecentlyPlaying recentlyPlayingItem = new RecentlyPlaying();
+            recentlyPlayingItem.setUserId(userId);
+            recentlyPlayingItem.setFObjectId(fObjectId);
+            recentlyPlayingItem.setRecentlyType(recentlyType);
+            recentlyPlayingItem.setCreateTime(new Date());
+            RecentlyPlaying callbackItem = recentlyPlayingService.addRecentlyItem(recentlyPlayingItem);
+            if(callbackItem!=null){
+                Map tempMap = new HashMap();
+                tempMap.put("createTime", callbackItem.getCreateTime());
+                return ResultVOUtil.success(tempMap);
+            }else{
+                throw new UserException(UserEnum.RECENTLY_ADD_ERROR);
+            }
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+    }
+
+    @GetMapping("/get")
+    public ResultVO getRecentlyPlaying(@RequestParam(value = "userId", required = false) String userId,
+                                       @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                       @RequestParam(value = "size", defaultValue = "10") Integer size) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+
+//        Map map = recentlyPlayingService.findByUserId(userId, 0 );
+        PageRequest request = PageRequest.of(page - 1, size,Sort.by(Sort.Direction.DESC,"createTime"));
+        Map map = recentlyPlayingService.findByUserId(userId,0,request);
+
+        if(map == null){
+            return ResultVOUtil.error(UserEnum.USER_NOT_RECENTLY.getCode(),UserEnum.USER_NOT_RECENTLY.getMessage());
+        }
+        return ResultVOUtil.success(map);
+    }
+
+    @GetMapping("/get_by_platform")
+    public ResultVO getRecentlyPlayingByPlatform(@RequestParam(value = "userId", required = false) String userId,
+                                       @RequestParam(value = "platform", required = false) Integer platform,
+                                       @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                       @RequestParam(value = "size", defaultValue = "10") Integer size) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+
+//        Map map = recentlyPlayingService.findByUserId(userId, 0 );
+        PageRequest request = PageRequest.of(page - 1, size,Sort.by(Sort.Direction.DESC,"createTime"));
+        Map map = recentlyPlayingService.findByUserIdAndPlatform(userId,0,platform,request);
+
+        if(map == null){
+            return ResultVOUtil.error(UserEnum.USER_NOT_RECENTLY.getCode(),UserEnum.USER_NOT_RECENTLY.getMessage());
+        }
+        return ResultVOUtil.success(map);
+    }
+}

+ 47 - 0
src/main/java/com/YuyeTech/TPlat/controller/RewardController.java

@@ -0,0 +1,47 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.dataobject.UserReward;
+import com.YuyeTech.TPlat.dto.LevelHonorDTO;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author:slambb
+ * @date:2021/8/18
+ */
+@RestController
+@RequestMapping("/reward")
+@Slf4j
+public class RewardController {
+
+    @Autowired
+    private UserRewardService userRewardService;
+
+    @Autowired
+    private LevelHonorService levelHonorService;
+
+    /**
+     * 获取levelJump关卡列表
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getAllHonorList")
+    public ResultVO getLevelJumpList(@RequestParam(value = "userId") String userId) {
+        List<LevelHonorDTO> levelHonorDTOList= userRewardService.findAllHonorByAndUserId(userId).stream()
+                .map(e-> levelHonorService.findByHonorType(e.getHonor())).collect(Collectors.toList());
+        return ResultVOUtil.success(levelHonorDTOList);
+    }
+
+
+}

+ 102 - 0
src/main/java/com/YuyeTech/TPlat/controller/UploadController.java

@@ -0,0 +1,102 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.repository.UserInfoRepository;
+import com.YuyeTech.TPlat.service.impl.UserInfoServiceImpl;
+import com.YuyeTech.TPlat.utils.ImageUtils;
+import com.YuyeTech.TPlat.utils.ResultVOUtil;
+import com.YuyeTech.TPlat.config.AliyunConfig;
+import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.List;
+
+/**
+ * @author:slambb
+ * @date:2019/12/16
+ */
+@Controller
+@RequestMapping("/oss")
+@Slf4j
+public class UploadController {
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+    @Autowired
+    private AliyunConfig aliyunConfig;
+
+    @Autowired
+    private UserInfoServiceImpl userInfoService;
+
+    @Autowired
+    private UserInfoRepository userInfoRepository;
+
+    private ImageUtils imageUtils;
+
+    @GetMapping("/toUploadBlog")
+    public String toUploadBlog() {
+        return "oss/upload";
+    }
+
+    @PostMapping("/toUploadBlog")
+    @ResponseBody
+    public ResultVO toUploadBlogPost(MultipartFile file, @RequestParam(value = "fileType", required = false) String fileType) {
+        log.info("=========>文件上传::", fileType);
+
+        //存的项目的中模版图片
+        String contextPath = "";
+        File uploadFile = null;
+        try {
+            String uploadUrl = "";
+            if (null != file) {
+                String filename = file.getOriginalFilename();
+                if (!"".equals(filename.trim())) {
+                    if (fileType.equals("avatar") ) {
+                        contextPath = imageUtils.getCompressPath(file, 200);
+                        uploadFile = new File(contextPath);
+                    } else {
+                        uploadFile= new File(filename);
+                        FileOutputStream os = new FileOutputStream(uploadFile);
+                        os.write(file.getBytes());
+                        os.close();
+                        file.transferTo(uploadFile);
+                    }
+                    //上传到OSS
+                    uploadUrl = aliyunOSSUtil.upload(uploadFile, fileType);
+                    uploadUrl = aliyunOSSUtil.addDomainName(uploadUrl);
+                    log.info("domain uploadUrl=" + uploadUrl);
+                }
+            }
+            return ResultVOUtil.success(uploadUrl);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (!contextPath.equals("")) {
+                imageUtils.deleteImage(contextPath);
+            }
+            uploadFile.delete();
+        }
+        return ResultVOUtil.success();
+    }
+
+    @GetMapping("/getObjectList")
+    @ResponseBody
+    public List<String> getObjectList() {
+        String bucketName = aliyunConfig.getBucketName();
+        System.out.println(bucketName);
+        List<String> objectList = aliyunOSSUtil.getObjectList(bucketName);
+        return objectList;
+    }
+
+    @GetMapping("/delete")
+    @ResponseBody
+    public String deleteBlog(@RequestParam("key") String key) {
+        aliyunOSSUtil.deleteBlog(key);
+        return "删除成功";
+    }
+}

+ 618 - 0
src/main/java/com/YuyeTech/TPlat/controller/UserInfoController.java

@@ -0,0 +1,618 @@
+package com.YuyeTech.TPlat.controller;
+
+import com.YuyeTech.TPlat.VO.FriendInfoVO;
+import com.YuyeTech.TPlat.dataobject.*;
+import com.YuyeTech.TPlat.dto.FriendInfoDTO;
+import com.YuyeTech.TPlat.dto.UserDTO;
+import com.YuyeTech.TPlat.enums.UserEnum;
+import com.YuyeTech.TPlat.exception.UserException;
+import com.YuyeTech.TPlat.service.*;
+import com.YuyeTech.TPlat.utils.*;
+import com.YuyeTech.TPlat.VO.ResultVO;
+import com.YuyeTech.TPlat.VO.UserInfoVO;
+
+import com.YuyeTech.TPlat.form.UserForm;
+
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.DigestUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+import java.io.File;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author:slambb
+ * @date:2019/12/5
+ */
+@RestController
+@RequestMapping("/user_info")
+@Slf4j
+public class UserInfoController {
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
+    @Autowired
+    private UserInfoService userInfoService;
+
+    @Autowired
+    private MainInfoService mainInfoService;
+
+    @Autowired
+    private WxInfoService wxInfoService;
+
+    @Autowired
+    private WeightInfoService weightInfoService;
+
+    private ImageUtils imageUtils;
+
+    @Autowired
+    private FriendInfoService friendInfoService;
+
+    @Autowired
+    private UserWalletsService userWalletsService;
+
+
+    @Value("${RSA.friendId.publicKey}")
+    private String friendIdPublicKey;
+    @Value("${RSA.friendId.privateKey}")
+    private String friendIdPrivateKey;
+
+    @GetMapping("/get")
+    public ResultVO getUserInfo(@RequestParam(value = "userId", required = false) String userId) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        //查询对应数据
+        UserInfo userInfo = userInfoService.findUserInfoById(userId, true);
+        if (userInfo == null) {
+            return ResultVOUtil.error(UserEnum.USER_NOT_EXIST.getCode(), UserEnum.USER_NOT_EXIST.getMessage());
+        }
+        Map map = new HashMap();
+        //返回对应展示的信息
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+
+        map.put("userInfo", userInfoVO);
+        //还需要返回openid 和 phoneNumber
+        //mainInfo 肯定是不为null 的
+        MainInfo mainInfo = mainInfoService.findMainInfoById(userId);
+        map.put("phoneNumber", mainInfo.getTelephoneNumber());
+
+        WxInfo wxInfo = wxInfoService.findWxInfoById(userId);
+        if (wxInfo == null) {
+            map.put("openid", null);
+        } else {
+            map.put("openid", wxInfo.getOpenid());
+        }
+
+        return ResultVOUtil.success(map);
+    }
+
+    @GetMapping("delete")
+    public ResultVO deleteUserInfo(@RequestParam(value = "userId") String userId) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+        try {
+            String callback = userInfoService.deleteUserInfoById(userId);
+            return ResultVOUtil.success(callback);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+    }
+
+    @PostMapping(value = "add_avatar", headers = "content-type=multipart/form-data")
+    @Transactional
+    public ResultVO addUserImage(@RequestParam(value = "file", required = false) MultipartFile file,
+                                 @Valid UserForm form) {
+//        String userId = request.getParameterValues("userId")[0];
+        UserInfo userInfo = new UserInfo();
+        //存的项目的中模版图片
+        String contextPath = "";
+        File uploadFile = null;
+        try {
+            String uploadUrl = "";
+            log.info("{}", file);
+            String filename = file.getOriginalFilename();
+            if (!"".equals(filename.trim())) {
+                contextPath = imageUtils.getCompressPath(file, 200);
+                uploadFile = new File(contextPath);
+                uploadUrl = aliyunOSSUtil.upload(uploadFile, "avatar");
+                log.info("uploadUrl=" + uploadUrl);
+            }
+            userInfo = userInfoService.findUserInfoById(form.getUserId(), false);
+            //数据表没有数据
+            if (userInfo == null) {
+                userInfo = new UserInfo();
+                userInfo.setUserId(form.getUserId());
+                userInfo.setUsername("");
+                userInfo.setGender("其他");
+                userInfo.setBirthday(new Date());
+                userInfo.setSignature("");
+                userInfo.setAvatarUrl(uploadUrl);
+                userInfo.setHeight(0.0);
+                userInfo.setWeight(0.0);
+                userInfo.setRegisterTime(new Date());
+                userInfo.setStatus(1);//1为新注册
+            } else {
+//                if (uploadUrl != "") {
+//                log.info("旧数据,设置头像地址=" + uploadUrl);
+                //这里判断处理,把旧的头像数据删除
+                //默认头像不用删除
+                if (!userInfo.getAvatarUrl().equals("publicAvatar/defaultAvatar.png") && userInfo.getAvatarUrl() != null && userInfo.getAvatarUrl().length() != 0) {
+                    if (aliyunOSSUtil.deleteBlog(userInfo.getAvatarUrl())) {
+                        userInfo.setAvatarUrl(uploadUrl);
+                    }
+                } else {
+                    userInfo.setAvatarUrl(uploadUrl);
+                }
+//                }
+            }
+            BeanUtils.copyProperties(form, userInfo, PropertyUtil.getNullPropertyNames(form));
+            //保存数据库,获取保存后的字段
+            userInfo = userInfoService.addUserInfo(userInfo);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (!contextPath.equals("")) {
+                imageUtils.deleteImage(contextPath);
+            }
+            uploadFile.delete();
+        }
+
+        //vo 返回给前端的字段筛选
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+        //修改url,添加访问域名
+        String url = aliyunOSSUtil.addDomainName(userInfoVO.getAvatarUrl());
+        userInfoVO.setAvatarUrl(url);
+        return ResultVOUtil.success(userInfoVO);
+    }
+
+    @PostMapping("add_wx_avatar_info")
+    @Transactional
+    public ResultVO addAvatarUserInfo(@RequestParam(value = "file", required = false) MultipartFile file,
+                                      @RequestParam("username") String username,
+                                      @RequestParam("gender") String gender,
+                                      @RequestParam("userId") String userId) {
+        UserInfo userInfo = new UserInfo();
+
+        //微信头像时候新增的用户
+        //存的项目的中模版图片
+        String contextPath = "";
+        File uploadFile = null;
+
+        try {
+            String uploadUrl = "";
+            String filename = file.getOriginalFilename();
+            if (!"".equals(filename.trim())) {
+//                File newFile = new File(filename);
+//                FileOutputStream os = new FileOutputStream(newFile);
+//                os.write(file.getBytes());
+//                os.close();
+//                file.transferTo(newFile);
+                contextPath = imageUtils.getCompressPath(file, 200);
+                uploadFile = new File(contextPath);
+                //上传到OSS
+                uploadUrl = aliyunOSSUtil.upload(uploadFile, "avatar");
+                log.info("uploadUrl=" + uploadUrl);
+            }
+
+            //数据表没有数据
+            userInfo.setUsername(username);
+            userInfo.setUserId(userId);
+            userInfo.setGender(gender);
+            userInfo.setBirthday(new Date());
+            userInfo.setAvatarUrl(uploadUrl);
+            userInfo.setHeight(0.0);
+            userInfo.setWeight(0.0);
+            userInfo.setRegisterTime(new Date());
+            userInfo.setStatus(1);//1为新注册
+            //保存数据库,获取保存后的字段
+            userInfo = userInfoService.addUserInfo(userInfo);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            if (!contextPath.equals("")) {
+                imageUtils.deleteImage(contextPath);
+            }
+            uploadFile.delete();
+        }
+
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+        String url = aliyunOSSUtil.addDomainName(userInfoVO.getAvatarUrl());
+        userInfoVO.setAvatarUrl(url);
+        return ResultVOUtil.success(userInfoVO);
+    }
+
+    @PostMapping("appleAdd")
+    public ResultVO appleAddUserInfo(@RequestParam("username") String username,
+                                     @RequestParam("gender") String gender,
+                                     @RequestParam("userId") String userId) {
+        UserInfo userInfo = new UserInfo();
+        try {
+            userInfo = userInfoService.findUserInfoById(userId, false);
+            //数据表没有数据
+            if (userInfo == null) {
+                userInfo = new UserInfo();
+                //使用默认头像,数据库设定
+                List<Pictures> picturesList = userInfoService.getDefaultAvatar();
+                if (picturesList.size() != 0) {
+                    userInfo.setAvatarUrl(picturesList.get(0).getPictureUrl());
+                } else {
+                    return ResultVOUtil.error(UserEnum.USER_DEFAULT_NULL.getCode(), UserEnum.USER_DEFAULT_NULL.getMessage());
+                }
+                userInfo.setUserId(userId);
+                userInfo.setUsername(username);
+                userInfo.setGender(gender);
+                userInfo.setBirthday(new Date());
+                userInfo.setSignature("");
+                userInfo.setHeight(0.0);
+                userInfo.setWeight(0.0);
+                userInfo.setRegisterTime(new Date());
+                userInfo.setStatus(1);//1为新注册
+                //保存数据库,获取保存后的字段
+                userInfo = userInfoService.addUserInfo(userInfo);
+            } else {
+                userInfo.setUserId(userId);
+                userInfo.setUsername(username);
+                userInfo.setGender(gender);
+            }
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        //vo 返回给前端的字段筛选
+
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+        //修改url,添加访问域名
+        String url = aliyunOSSUtil.addDomainName(userInfoVO.getAvatarUrl());
+        userInfoVO.setAvatarUrl(url);
+        return ResultVOUtil.success(userInfoVO);
+    }
+
+    @PostMapping("add")
+    @Transactional
+    public ResultVO addUserInfo(@Valid UserForm form,
+                                @RequestParam(value = "bAddWeightInfo", required = false, defaultValue = "false") Boolean bAddWeightInfo) {
+        UserInfo userInfo = new UserInfo();
+        try {
+            userInfo = userInfoService.findUserInfoById(form.getUserId(), false);
+            //数据表没有数据
+            if (userInfo == null) {
+                userInfo = new UserInfo();
+                //使用默认头像,数据库设定
+                List<Pictures> picturesList = userInfoService.getDefaultAvatar();
+                if (picturesList.size() != 0) {
+                    userInfo.setAvatarUrl(picturesList.get(0).getPictureUrl());
+                } else {
+                    return ResultVOUtil.error(UserEnum.USER_DEFAULT_NULL.getCode(), UserEnum.USER_DEFAULT_NULL.getMessage());
+                }
+                userInfo.setUserId(form.getUserId());
+                userInfo.setUsername(form.getUsername());
+                userInfo.setGender(form.getGender());
+                userInfo.setBirthday(new Date());
+                userInfo.setSignature(form.getSignature());
+                userInfo.setHeight(0.0);
+                userInfo.setWeight(0.0);
+                userInfo.setRegisterTime(new Date());
+                userInfo.setStatus(1);//1为新注册
+                bAddWeightInfo = true;
+            }
+
+            BeanUtils.copyProperties(form, userInfo, PropertyUtil.getNullPropertyNames(form));
+            //保存数据库,获取保存后的字段
+            userInfo = userInfoService.addUserInfo(userInfo);
+            if (bAddWeightInfo) {
+                //第一次把体重保存到weightInfo表
+                saveWeightInfo(userInfo);
+            }
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        //vo 返回给前端的字段筛选
+
+        UserInfoVO userInfoVO = new UserInfoVO();
+        BeanUtils.copyProperties(userInfo, userInfoVO);
+        //修改url,添加访问域名
+        String url = aliyunOSSUtil.addDomainName(userInfoVO.getAvatarUrl());
+        userInfoVO.setAvatarUrl(url);
+        return ResultVOUtil.success(userInfoVO);
+    }
+
+    private void saveWeightInfo(UserInfo userInfo) {
+        WeightInfo weightInfo = new WeightInfo();
+        weightInfo.setUserId(userInfo.getUserId());
+        weightInfo.setWeight(userInfo.getWeight());
+        weightInfo.setWeightId(KeyUtil.genUniqueKey());
+        weightInfo.setCreateTime(new Date());
+        //保存数据库,获取保存后的字段
+        weightInfoService.addWeightInfo(weightInfo);
+    }
+
+    @PostMapping("add_weight")
+    @Transactional
+    public ResultVO addUserWeightInfo(@RequestParam(value = "weight") Double weight, @RequestParam(value = "userId") String userId) {
+
+        WeightInfo weightInfo = new WeightInfo();
+        try {
+            weightInfo.setUserId(userId);
+            weightInfo.setWeight(weight);
+            weightInfo.setWeightId(KeyUtil.genUniqueKey());
+            weightInfo.setCreateTime(new Date());
+            //保存数据库,获取保存后的字段
+            weightInfo = weightInfoService.addWeightInfo(weightInfo);
+
+            //把体重同步到user_info 里面
+            UserInfo userInfo = userInfoService.findUserInfoById(userId, false);
+            if (userInfo != null) {
+                userInfo.setWeight(weightInfo.getWeight());
+                userInfoService.addUserInfo(userInfo);
+            }
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+//        Map listWeightInfo = weightInfoService.findAll(userId);
+        Integer page = 1;
+        Integer size = 32;
+        PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createTime"));
+        Map listWeightInfo = weightInfoService.findWeightInfoByPage(userId, request);
+
+        Map map = new HashMap();
+        map.put("currentWeight", weightInfo.getWeight());
+        map.put("weightList", listWeightInfo);
+        return ResultVOUtil.success(map);
+    }
+
+    @GetMapping("get_weight")
+    public ResultVO getWeightList(@RequestParam(value = "userId") String userId) {
+
+        try {
+            Integer page = 1;
+            Integer size = 32;
+            PageRequest request = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createTime"));
+            Map weightInfo = weightInfoService.findWeightInfoByPage(userId, request);
+//            Map weightInfo = weightInfoService.findAll(userId);
+            return ResultVOUtil.success(weightInfo);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+    }
+
+    /**
+     * 获取好友信息列表
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping("get_friend_list")
+    public ResultVO getFriendList(@RequestParam(value = "userId") String userId,
+                                  @RequestParam(value = "page", defaultValue = "1") Integer page,
+                                  @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+        PageRequest request = PageRequest.of(page - 1, size);
+
+        Page<FriendInfo> friendInfoPage = friendInfoService.getFriendUserInfo(request, userId);
+        List<String> friendIds = friendInfoPage.getContent()
+                .stream().map(e -> e.getFriendId()).collect(Collectors.toList());
+
+        List<FriendInfoDTO> friendInfoVOList = new ArrayList<>();
+
+        List<UserDTO> userInfos = userInfoService.findUserInfoListByIDs(friendIds);
+        for (int i = 0; i < userInfos.size(); i++) {
+            UserDTO e = userInfos.get(i);
+            String encodedData = null; //friendId,不对外暴露,直接用RSA加密
+            try {
+                encodedData = RSAUtils.publicEncrypt(friendInfoPage.getContent().get(i).getFriendId(), RSAUtils.getPublicKey(friendIdPublicKey));
+            } catch (NoSuchAlgorithmException ex) {
+                ex.printStackTrace();
+            } catch (InvalidKeySpecException ex) {
+                ex.printStackTrace();
+            }
+            FriendInfoDTO friendInfoDTO = new FriendInfoDTO(
+                    e.getUsername(),
+                    e.getGender(),
+                    e.getSignature(),
+                    e.getAvatarUrl(),
+                    e.getCityCode(),
+                    e.getHeight(),
+                    e.getWeight(),
+                    e.getBirthday(),
+                    true,
+                    encodedData // friendInfoPage.getContent().get(i).getId()
+            );
+
+            friendInfoVOList.add(friendInfoDTO);
+        }
+
+        Map map = new HashMap();
+        map.put("friends", friendInfoVOList);
+        map.put("page", friendInfoPage.getNumber() + 1);
+        map.put("size", friendInfoPage.getSize());
+
+        return ResultVOUtil.success(map);
+    }
+
+    /**
+     * 模糊搜索用户信息·
+     *
+     * @param username
+     * @param page
+     * @param size
+     * @return
+     */
+    @GetMapping("friend_search_list")
+    public ResultVO searchListFromUserInfo(
+            @RequestParam(value = "userId") String userId,
+            @RequestParam(value = "username") String username,
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "size", defaultValue = "10") Integer size) {
+
+        PageRequest request = PageRequest.of(page - 1, size);
+        Page<UserInfo> userInfoPage = userInfoService.searchByUsername(request, username);
+
+        List<FriendInfoDTO> friendInfoVOList = userInfoPage.stream().map(e -> {
+            FriendInfo friendInfo = friendInfoService.findByUserIdAndFriendId(userId, e.getUserId());
+
+            String encodedData = null; //显示用户id,不对外暴露,直接用RSA加密
+            try {
+                encodedData = RSAUtils.publicEncrypt(e.getUserId(), RSAUtils.getPublicKey(friendIdPublicKey));
+            } catch (NoSuchAlgorithmException ex) {
+                ex.printStackTrace();
+            } catch (InvalidKeySpecException ex) {
+                ex.printStackTrace();
+            }
+            return new FriendInfoDTO(
+                        e.getUsername(),
+                        e.getGender(),
+                        e.getSignature(),
+                        aliyunOSSUtil.addDomainName(e.getAvatarUrl()),
+                        e.getCityCode(),
+                        e.getHeight(),
+                        e.getWeight(),
+                        e.getBirthday(),
+                        friendInfo != null ? true : false,
+                        encodedData
+                );
+        }).collect(Collectors.toList());
+        //处理关注状态。比如已关注之类的
+
+        Map map = new HashMap();
+        map.put("friends", friendInfoVOList);
+        map.put("page", userInfoPage.getNumber() + 1);
+        map.put("size", userInfoPage.getSize());
+
+        return ResultVOUtil.success(map);
+
+    }
+
+    /**
+     * 添加一个好友
+     *
+     * @param userId
+     * @param friendRSA RSA处理的值,对外是显示friendId
+     * @return
+     */
+    @GetMapping("/friend_add")
+    public ResultVO addFriendInfo(@RequestParam(value = "userId", required = false) String userId,
+                                  @RequestParam(value = "friendId") String friendRSA) {
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+
+        try {
+            String decFriendId = RSAUtils.privateDecrypt(friendRSA, RSAUtils.getPrivateKey(friendIdPrivateKey));
+            FriendInfo friendInfo = friendInfoService.findByUserIdAndFriendId(userId, decFriendId);
+
+            if (friendInfo != null) {
+                Map tempMap = new HashMap();
+                tempMap.put("bHas", true);
+                tempMap.put("msg", "已添加过关注");
+                return ResultVOUtil.success(tempMap);
+            }
+
+            //添加好友信息
+            String _id = KeyUtil.genUniqueKey();
+            friendInfo = new FriendInfo();
+            friendInfo.setId(_id);
+            friendInfo.setUserId(userId);
+            friendInfo.setFriendId(decFriendId);
+            friendInfo.setIsOut(0);//单向添加,类似于关注
+            friendInfo.setCreatedAt(new Date());
+            //添加后返回值 Favorites tempFavorite  =
+            friendInfoService.addFriendInfo(friendInfo);
+            Map tempMap = new HashMap();
+            tempMap.put("isFriend", true);
+            tempMap.put("msg", "新关注的好友");
+
+            return ResultVOUtil.success(tempMap);
+
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (NoSuchAlgorithmException e) {
+            return ResultVOUtil.error(400, e.getMessage());
+        } catch (InvalidKeySpecException e) {
+            return ResultVOUtil.error(400, e.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/friend_delete")
+    @Transactional
+    public ResultVO deleteFriendInfo(@RequestParam(value = "userId", required = false) String userId,
+                                     @RequestParam(value = "friendId") String friendRSA) {
+
+        //请求userId为空时候
+        if (userId == null) {
+            throw new UserException(UserEnum.USER_NOT_EXIST);
+        }
+
+        try {
+//            friendInfoService.deleteById(id);
+            friendInfoService.deleteFriendInfo(userId,RSAUtils.privateDecrypt(friendRSA, RSAUtils.getPrivateKey(friendIdPrivateKey)));
+            Map tempMap = new HashMap();
+            tempMap.put("isFriend", false);
+            tempMap.put("msg", "已删除好友信息");
+            return ResultVOUtil.success(tempMap);
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        } catch (NoSuchAlgorithmException e) {
+            return ResultVOUtil.error(400, e.getMessage());
+        } catch (InvalidKeySpecException e) {
+            return ResultVOUtil.error(400, e.getMessage());
+        }
+
+    }
+
+
+    @GetMapping("/get_user_wallets")
+    public ResultVO getUserWalletsInfo(@RequestParam(value = "userId") String userId) {
+
+        try {
+            UserWallets userWallets = userWalletsService.findUserWalletsByUserId(userId);
+            Map tempMap = new HashMap();
+            tempMap.put("gold", userWallets.getGold());
+            tempMap.put("diamond", userWallets.getDiamond());
+            return ResultVOUtil.success(tempMap);
+        } catch (UserException e) {
+            return ResultVOUtil.error(e.getCode(), e.getMessage());
+        }
+
+    }
+
+}

+ 30 - 0
src/main/java/com/YuyeTech/TPlat/controller/wxController.java

@@ -0,0 +1,30 @@
+package com.YuyeTech.TPlat.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author:slambb
+ * @date:2020/4/21
+ */
+
+@Controller
+@RequestMapping("/wxlogin")
+@Slf4j
+public class wxController {
+    @ResponseBody
+    @RequestMapping(value = "/test", method = RequestMethod.GET, produces = {"application/json;charset=utf-8"})
+   public String getWxUserInfo(HttpServletRequest request,@RequestParam(required = true) String echostr) {
+        try {
+            //只需要把微信请求的 echostr, 返回给微信就可以了
+            log.info("测试来过===================" + echostr);
+            return echostr;
+        } catch (Exception e) {
+            log.info("测试微信公众号的接口配置信息发生异常:", e);
+            return "系统异常!";
+        }
+    }
+}

+ 19 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/AdminInfo.java

@@ -0,0 +1,19 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+@Data
+@Entity
+public class AdminInfo {
+    @Id
+    private Integer adminId;
+    private String adminName;
+    private String adminPassword;
+    private Date loginTime;
+    private Date createTime;
+    private Date updateTime;
+}

+ 26 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/AiInfo.java

@@ -0,0 +1,26 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/3/25
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class AiInfo {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer aiId;
+    private String aiType;
+    private String aiName;
+    private Integer aiGender;
+    private String aiAvatar;
+}

+ 25 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/AppleInfo.java

@@ -0,0 +1,25 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/6/4
+ */
+
+@Data
+@Entity
+public class AppleInfo {
+
+    @Id
+    private String userId;
+
+    /**
+     * 苹果用户的userID
+     */
+    private String appleId;
+
+}

+ 35 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/BluetoothInfo.java

@@ -0,0 +1,35 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/9/4
+ */
+@Data
+@Entity
+public class BluetoothInfo {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer bluetoothId;
+
+    private String userId;
+
+    private String bluetoothName;
+
+    private String bluetoothMac;
+
+    private Integer bluetoothStatus;
+
+    private Integer bluetoothType;
+
+    private Integer isShare;
+
+    private String identifier;
+}

+ 39 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/ClientInfo.java

@@ -0,0 +1,39 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/6/11
+ */
+@Data
+@Entity
+public class ClientInfo {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer clientId;
+
+    private String userId;
+
+    private String brand;
+
+    private String model;
+
+    private Integer screenWidth;
+
+    private Integer screenHeight;
+
+    private String clientSystem;
+
+    private String version;
+
+    private String platform;
+
+    private String sdkVersion;
+}

+ 32 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/DeviceInfo.java

@@ -0,0 +1,32 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/6/11
+ */
+@Data
+@Entity
+public class DeviceInfo {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer deviceId;
+
+    private String userId;
+
+    private String deviceUuid;
+
+    private Integer deviceStatus;
+
+    private Integer deviceType;
+
+    private String identifier;
+
+}

+ 26 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/Favorites.java

@@ -0,0 +1,26 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/14
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class Favorites {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer favoritesId;
+    private Integer favoritesType;
+
+    @Column(name="f_object_id")
+    private String FObjectId;
+    private String userId;
+    private Date createTime;
+}

+ 38 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/FcCategory.java

@@ -0,0 +1,38 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/2/5
+ */
+@Entity
+@DynamicUpdate
+@Data
+public class FcCategory {
+    // 类目id
+    //采用的是 IDENTITY。主键由数据库自动生成(主要是自动增长型)
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer categoryId;
+    //类目名字
+    private String categoryName;
+    //类目编号
+    private Integer categoryNumber;
+    //类目编号
+    private Integer categoryType;
+
+    public FcCategory() {
+    }
+
+    public FcCategory(String categoryName, Integer categoryType) {
+        this.categoryName = categoryName;
+        this.categoryType = categoryType;
+    }
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/FcCategoryReference.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/1/16
+ */
+@Data
+@Entity
+public class FcCategoryReference {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private Integer categoryId;
+
+    private Integer gameId;
+    private Integer status;
+}

+ 34 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/FcInfo.java

@@ -0,0 +1,34 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class FcInfo {
+    @Id
+    private Integer fcId;
+    private String fcName;
+    private String fcDescription;
+    private String fcIcon;
+    private String fcPicture;
+    private Integer fcStatus;
+    private Integer fcType;
+    /** 资源列表. */
+    private String fcDownloadUrl;
+    /** 排行榜的游戏id. */
+    private String fcRankingId;
+    /** 是否在排行榜显示的游戏 0 是隐藏,1是显示. */
+    private Integer fcRankingShow;
+    /** 创建时间. */
+    private Date createTime;
+}

+ 25 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/FitnessProgram.java

@@ -0,0 +1,25 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2019/12/31
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class FitnessProgram {
+    @Id
+    private String userId;
+    private Date startTime;
+    private Date endTime;
+    private Double targetWeight;
+    private Integer cumulativeCalorie;
+    private Integer calorie;
+    private Double sportTime;
+}

+ 27 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/FriendInfo.java

@@ -0,0 +1,27 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/7/26
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class FriendInfo {
+    @Id
+    private String id;
+    private String userId;
+    private String friendId;
+    private Integer isOut;
+
+    private Date createdAt;
+}

+ 36 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/GameCategory.java

@@ -0,0 +1,36 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/2/5
+ */
+@Entity
+@DynamicUpdate
+@Data
+public class GameCategory {
+    // 类目id
+    //采用的是 IDENTITY。主键由数据库自动生成(主要是自动增长型)
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer categoryId;
+    //类目名字
+    private String categoryName;
+    //类目编号
+    private Integer categoryType;
+
+    public GameCategory() {
+    }
+
+    public GameCategory(String categoryName, Integer categoryType) {
+        this.categoryName = categoryName;
+        this.categoryType = categoryType;
+    }
+}

+ 40 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/GameInfo.java

@@ -0,0 +1,40 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class GameInfo {
+    @Id
+    private String gameId;
+    private String gameName;
+    private String gameDescription;
+    private String gameIcon;
+    private String gamePicture;
+    private Integer gameStatus;
+    private Integer gameType;
+    private String gameWebUrl;
+    /** 排行榜的游戏id. */
+    private String gameRankingId;
+    /** 是否在排行榜显示的游戏 0 是隐藏,1是显示. */
+    private Integer gameRankingShow;
+    /** 显示的平台 0:android 1:ios 2:android & ios*/
+    private Integer platform;
+
+    /** 游戏显示时间. */
+    private Date showTime;
+    /** 创建时间. */
+    private Date createTime;
+
+
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/GamePicture.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/1/16
+ */
+@Data
+@Entity
+public class GamePicture {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer gpId;
+    private Integer gpType;
+
+    private String gameId;
+    private Integer pictureId;
+}

+ 32 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/GameTag.java

@@ -0,0 +1,32 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/16
+ */
+@Data
+@Entity
+public class GameTag {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String title;
+    private String mode;
+
+    private Integer status;
+    private Integer isDefault;
+    private Integer gameCount;
+    private Integer style;
+    private Integer seq;
+    private Date deleteTime;
+    private Date createTime;
+    private Date updateTime;
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/GameTagReference.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/1/16
+ */
+@Data
+@Entity
+public class GameTagReference {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer referenceId;
+    private Integer tagId;
+
+    private String gameId;
+    private Integer status;
+}

+ 37 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/LevelCondition.java

@@ -0,0 +1,37 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/8/4
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class LevelCondition {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private Integer type;
+    private String explain;
+    /**
+     * 用于条件说明。比如关卡结束时候的限制条件
+     */
+    private Integer limitType;
+    /**
+     * 是否是分数,和一个分数限制值
+     */
+    private Integer isScore;
+    private Integer limitScore;
+    /**
+     * 对应的关卡
+     */
+    private Integer limitLevel;
+}

+ 26 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/LevelHonor.java

@@ -0,0 +1,26 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/8/4
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class LevelHonor {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String name;
+    private Integer type;
+    private String explain;
+    private String url;
+}

+ 43 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/LevelJump.java

@@ -0,0 +1,43 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2021/8/4
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class LevelJump {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String name;
+    private String describe;
+    private Integer rewardGold;
+    private Integer rewardDiamond;
+    private Integer rewardHonor;//过关荣誉
+    private Integer consumeGold;
+    private Integer consumeDiamond;
+    private Integer signCount;
+    private String signType;
+    private Integer limitTime;
+    /** 解锁条件类型. */
+    private String conditionUnlock;
+    /** 通过关卡时候的类型. */
+    private Integer conditionPassed;
+    /** 补充说明 */
+    private String explain;
+    /** 人数类型 1单人 */
+    private Integer numberType;
+    /** 顺序设计,和number type 一起使用。用于游戏排序 */
+    private Integer sort;
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/MainInfo.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2019/12/31
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class MainInfo {
+    @Id
+    private String  userId;
+
+    private String username;
+    private String password;
+
+    private String telephoneNumber;
+}

+ 25 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/OtaInfo.java

@@ -0,0 +1,25 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class OtaInfo {
+    @Id
+    private Integer otaId;
+    private String otaName;
+    private String bleName;
+    private Integer bleType;
+    private Integer otaStatus;
+    private String otaDownload;
+}

+ 22 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/Pictures.java

@@ -0,0 +1,22 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2020/1/16
+ */
+@Data
+@Entity
+public class Pictures {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer pictureId;
+    private Integer pictureType;
+    private String pictureUrl;
+}

+ 42 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/ProductCategory.java

@@ -0,0 +1,42 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * 类目
+ *
+ * @author:slambb
+ * @date:2019/11/28
+ * @Data 需要引入组件lombok,之后这里get,set ,toString 方法可省略处理步骤
+ * 编译时候处理get set ,不影响性能
+ */
+
+@Entity
+@DynamicUpdate
+@Data
+public class ProductCategory {
+    // 类目id
+    //采用的是 IDENTITY。主键由数据库自动生成(主要是自动增长型)
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer categoryId;
+    //类目名字
+    private String categoryName;
+    //类目编号
+    private Integer categoryType;
+
+    public ProductCategory() {
+    }
+
+    public ProductCategory(String categoryName, Integer categoryType) {
+        this.categoryName = categoryName;
+        this.categoryType = categoryType;
+    }
+}

+ 29 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/RankInfo.java

@@ -0,0 +1,29 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/3/20
+ */
+@Data
+@Entity
+public class RankInfo {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer rankId;
+    private Integer rankType;
+    //是否显示
+    private Integer rankShow;
+    private Double rankScore;
+
+    @Column(name="r_object_id")
+    private String RObjectId;
+
+    private String userId;
+
+}

+ 30 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/Ranking.java

@@ -0,0 +1,30 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.*;
+
+/**
+ * @author:slambb
+ * @date:2020/3/20
+ */
+@Data
+@Entity
+public class Ranking {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer rankingId;
+    private Integer rankType;
+    /**
+     * 城市代码
+     */
+    private String cityCode;
+    private Double rankScore;
+
+    @Column(name="r_object_id")
+    private String RObjectId;
+
+    private String userId;
+
+}

+ 31 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/RecentlyPlaying.java

@@ -0,0 +1,31 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/14
+ */
+@Data
+@Entity
+//@DynamicUpdate
+public class RecentlyPlaying {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer recentlyId;
+    private Integer recentlyType;
+
+    @Column(name="f_object_id")
+    private String FObjectId;
+    private String userId;
+
+//    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date createTime;
+
+}

+ 29 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/Recommend.java

@@ -0,0 +1,29 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/2/3
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class Recommend {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer recommendId;
+    private Integer recommendType;
+
+    @Column(name="r_object_id")
+    private String RObjectId;
+    /** 游戏显示时间. */
+    private Date showTime;
+    private Date createTime;
+
+
+}

+ 43 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/UserInfo.java

@@ -0,0 +1,43 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2019/12/5
+ */
+@Data
+@Entity
+public class UserInfo {
+
+    @Id
+    private String userId;
+
+    private String username;
+
+    private String gender;
+
+    /**
+     * 城市代码
+     */
+    private String cityCode;
+
+    private Date birthday;
+
+    private String signature;
+
+    private String avatarUrl;
+
+    private Double height;
+
+    private Double weight;
+
+    /** 创建时间. */
+    private Date registerTime;
+
+    private Integer status;
+}

+ 31 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/UserLevel.java

@@ -0,0 +1,31 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2021/8/5
+ */
+
+@Data
+@Entity
+public class UserLevel {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String userId;
+    private String unlockState;
+    private String passedState;
+    /**
+     * 这里是处理记录的关卡类型,比如1代表 数据表level_jump 对应的关卡数据
+     */
+    private Integer eventType;
+    /** 创建时间. */
+    private Date createTime;
+}

+ 43 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/UserReward.java

@@ -0,0 +1,43 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2021/8/5
+ */
+
+@Data
+@Entity
+public class UserReward {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String userId;
+    private Integer gold;
+    private String goldExplain;
+    private Integer diamond;
+    private String diamondExplain;
+    private Integer honor;
+    private String honorName;
+    private String honorExplain;
+    private String honorUrl;
+
+    private Integer eventId;
+    private String eventName;
+    private Integer eventState;
+    private Integer eventType;
+    /**
+     * 玩通过的次数
+     */
+    private Integer playCount;
+
+    /** 创建时间. */
+    private Date createTime;
+}

+ 27 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/UserWallets.java

@@ -0,0 +1,27 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2021/8/5
+ */
+
+@Data
+@Entity
+public class UserWallets {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String userId;
+    private Integer gold;
+    private Integer diamond;
+    /** 创建时间. */
+    private Date createTime;
+}

+ 32 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/VersionCode.java

@@ -0,0 +1,32 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class VersionCode {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+    private String title;
+    private String code;
+    /**0:全都限制,1:限制 android ,2:限制ios,*/
+    private Integer limitPlatform;
+    @Column(name="is_show_game")
+    private Integer isShowGame;
+    @Column(name="is_show_video")
+    private Integer isShowVideo;
+    private String describe;
+    private Date deleteTime;
+    private Date createTime;
+    private Date updateTime;
+}

+ 30 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/VersionInfo.java

@@ -0,0 +1,30 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+@Entity
+@DynamicUpdate
+public class VersionInfo {
+    @Id
+    private Integer versionId;
+    private String versionName;
+    private String versionNumber;
+    private String versionCode;
+    private String versionAppid;
+    private String versionDescribe;
+    private String versionNote;
+    private Integer versionStatus;
+    /** 资源列表. */
+    private String apk;
+    private String ios;
+}

+ 24 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/WeightInfo.java

@@ -0,0 +1,24 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+import org.hibernate.annotations.DynamicUpdate;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Date;
+
+
+/**
+ * @author:slambb
+ * @date:2019/12/31
+ */
+@Data
+@DynamicUpdate
+@Entity
+public class WeightInfo {
+    @Id
+    private String weightId;
+    private String userId;
+    private Double weight;
+    private Date createTime;
+}

+ 26 - 0
src/main/java/com/YuyeTech/TPlat/dataobject/WxInfo.java

@@ -0,0 +1,26 @@
+package com.YuyeTech.TPlat.dataobject;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author:slambb
+ * @date:2019/12/13
+ */
+@Data
+@Entity
+public class WxInfo {
+
+    @Id
+    private String userId;
+
+    private String openid;
+
+    private String unionid;
+
+
+
+
+}

+ 28 - 0
src/main/java/com/YuyeTech/TPlat/dto/BLToothDTO.java

@@ -0,0 +1,28 @@
+package com.YuyeTech.TPlat.dto;
+
+import lombok.Data;
+
+/**
+ * 绑定的设备信息
+ *
+ * @author:slambb
+ * @date:2020/6/12
+ */
+@Data
+public class BLToothDTO {
+    private Integer bluetoothId;
+    private Integer bluetoothType;
+    private String bluetoothMac;
+    private String identifier;
+
+    public BLToothDTO(Integer bluetoothId,
+                      Integer bluetoothType,
+                      String bluetoothMac,
+                      String identifier)
+    {
+        this.bluetoothId = bluetoothId;
+        this.bluetoothType = bluetoothType;
+        this.bluetoothMac = bluetoothMac;
+        this.identifier = identifier;
+    }
+}

+ 28 - 0
src/main/java/com/YuyeTech/TPlat/dto/DeviceBindDTO.java

@@ -0,0 +1,28 @@
+package com.YuyeTech.TPlat.dto;
+
+import lombok.Data;
+
+/**
+ * 绑定的设备信息
+ *
+ * @author:slambb
+ * @date:2020/6/12
+ */
+@Data
+public class DeviceBindDTO {
+    private Integer deviceId;
+    private Integer deviceType;
+    private String deviceUuid;
+    private String identifier;
+
+    public DeviceBindDTO(Integer deviceId,
+                         Integer deviceType,
+                         String deviceUuid,
+                         String identifier)
+    {
+        this.deviceId = deviceId;
+        this.deviceType = deviceType;
+        this.deviceUuid = deviceUuid;
+        this.identifier = identifier;
+    }
+}

+ 54 - 0
src/main/java/com/YuyeTech/TPlat/dto/FcDTO.java

@@ -0,0 +1,54 @@
+package com.YuyeTech.TPlat.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+public class FcDTO {
+    private Integer gameId;
+    private String gameName;
+    private String gameDescription;
+    private String gameIcon;
+    private String gamePicture;
+    private String gameDownloadUrl;
+    private Boolean gameFavorite;
+
+    /** 排行榜的游戏id. */
+    private String gameRankingId;
+    /** 是否在排行榜显示的游戏 0 是隐藏,1是显示. */
+    private Boolean gameRankingShow;
+
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
+    private Date createTime;
+//    private Integer gameStatus;
+//    private Integer gameType;
+
+    public FcDTO(Integer gameId,
+                 String gameName,
+                 String gameIcon,
+                 String gameDescription,
+                 String gamePicture,
+                 String gameDownloadUrl,
+                 Boolean gameFavorite,
+                 String gameRankingId,
+                 Boolean gameRankingShow,
+                 Date createTime) {
+        this.gameId = gameId;
+        this.gameIcon = gameIcon;
+        this.gameName = gameName;
+        this.gameDescription = gameDescription;
+        this.gamePicture = gamePicture;
+        this.gameDownloadUrl = gameDownloadUrl;
+        this.gameFavorite = gameFavorite;
+        this.gameRankingId = gameRankingId;
+        this.gameRankingShow = gameRankingShow;
+        this.createTime = createTime;
+    }
+}

+ 60 - 0
src/main/java/com/YuyeTech/TPlat/dto/FriendInfoDTO.java

@@ -0,0 +1,60 @@
+package com.YuyeTech.TPlat.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+public class FriendInfoDTO {
+    private String username;
+
+    private String gender;
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy/MM/dd",timezone="GMT+8")
+    private Date birthday;
+
+    private String signature;
+
+    private String avatarUrl;
+
+    private String cityCode;
+
+    private Double height;
+
+    private Double weight;
+
+    private Boolean isFriend;
+
+    //关注的信息列表对应的一个id
+    private String friendId;
+
+
+    public FriendInfoDTO(String username,
+                   String gender,
+                   String signature,
+                   String avatarUrl,
+                   String cityCode,
+                   Double height,
+                   Double weight,
+                   Date birthday,
+                   Boolean bFriend,
+                   String friendId) {
+        this.username = username;
+        this.gender = gender;
+        this.signature = signature;
+        this.avatarUrl = avatarUrl;
+        this.cityCode = cityCode;
+        this.height = height;
+        this.weight = weight;
+        this.birthday = birthday;
+        this.isFriend = bFriend;
+        this.friendId = friendId;
+    }
+}

+ 60 - 0
src/main/java/com/YuyeTech/TPlat/dto/GameDTO.java

@@ -0,0 +1,60 @@
+package com.YuyeTech.TPlat.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author:slambb
+ * @date:2020/1/10
+ */
+@Data
+public class GameDTO {
+    private String gameId;
+    private String gameName;
+    private String gameDescription;
+    private String gameIcon;
+    private String gamePicture;
+    private Boolean gameFavorite;
+    /** 平台区分,0 :android ,1:ios ,2:android & ios*/
+    private Integer  platform;
+
+    /** 排行榜的游戏id. */
+    private String gameRankingId;
+    /** 是否在排行榜显示的游戏 0 是隐藏,1是显示. */
+    private Boolean gameRankingShow;
+
+
+    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
+    private Date createTime;
+//    private Integer gameStatus;
+//    private Integer gameType;
+    private List<GameTagDTO> gameTags;
+
+    public GameDTO(String gameId,
+                   String gameName,
+                   String gameIcon,
+                   String gameDescription,
+                   String gamePicture,
+                   Boolean gameFavorite,
+                   String gameRankingId,
+                   Boolean gameRankingShow,
+                   Date createTime,
+                   List<GameTagDTO> gameTags,
+                   Integer platform) {
+        this.gameId = gameId;
+        this.gameIcon = gameIcon;
+        this.gameName = gameName;
+        this.gameDescription = gameDescription;
+        this.gamePicture = gamePicture;
+        this.gameFavorite = gameFavorite;
+        this.gameRankingId = gameRankingId;
+        this.gameRankingShow = gameRankingShow;
+        this.createTime = createTime;
+        this.gameTags = gameTags;
+        this.platform = platform;
+    }
+}

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff