瀏覽代碼

first commit

张延森 4 年之前
當前提交
5e4d843955
共有 98 個檔案被更改,包括 4795 行新增0 行删除
  1. 33
    0
      .gitignore
  2. 117
    0
      .mvn/wrapper/MavenWrapperDownloader.java
  3. 二進制
      .mvn/wrapper/maven-wrapper.jar
  4. 2
    0
      .mvn/wrapper/maven-wrapper.properties
  5. 310
    0
      mvnw
  6. 182
    0
      mvnw.cmd
  7. 98
    0
      pom.xml
  8. 20
    0
      src/main/java/com/xiaoniu/niucai/TaskApplication.java
  9. 105
    0
      src/main/java/com/xiaoniu/niucai/common/ArrayUtils.java
  10. 267
    0
      src/main/java/com/xiaoniu/niucai/common/BizUtils.java
  11. 191
    0
      src/main/java/com/xiaoniu/niucai/common/DateUtils.java
  12. 76
    0
      src/main/java/com/xiaoniu/niucai/common/EncryptUtils.java
  13. 104
    0
      src/main/java/com/xiaoniu/niucai/common/ListUtils.java
  14. 134
    0
      src/main/java/com/xiaoniu/niucai/common/StringUtils.java
  15. 83
    0
      src/main/java/com/xiaoniu/niucai/entity/TaBettingPlan.java
  16. 79
    0
      src/main/java/com/xiaoniu/niucai/entity/TaBettingPlanItem.java
  17. 47
    0
      src/main/java/com/xiaoniu/niucai/entity/TaBettingPlanSportDetail.java
  18. 90
    0
      src/main/java/com/xiaoniu/niucai/entity/TaCustomerBetting.java
  19. 54
    0
      src/main/java/com/xiaoniu/niucai/entity/TaCustomerBettingItem.java
  20. 49
    0
      src/main/java/com/xiaoniu/niucai/entity/TaCustomerBettingSport.java
  21. 82
    0
      src/main/java/com/xiaoniu/niucai/entity/TaLotteryResult.java
  22. 45
    0
      src/main/java/com/xiaoniu/niucai/entity/TaLotteryResultDetail.java
  23. 120
    0
      src/main/java/com/xiaoniu/niucai/entity/TaMatch.java
  24. 69
    0
      src/main/java/com/xiaoniu/niucai/entity/TaMatchOdds.java
  25. 56
    0
      src/main/java/com/xiaoniu/niucai/entity/TaOrder.java
  26. 59
    0
      src/main/java/com/xiaoniu/niucai/entity/TaOrderPay.java
  27. 182
    0
      src/main/java/com/xiaoniu/niucai/entity/TdLottery.java
  28. 47
    0
      src/main/java/com/xiaoniu/niucai/entity/TdLotteryOnSale.java
  29. 54
    0
      src/main/java/com/xiaoniu/niucai/entity/TdLotteryPrize.java
  30. 111
    0
      src/main/java/com/xiaoniu/niucai/entity/TdSportPass.java
  31. 42
    0
      src/main/java/com/xiaoniu/niucai/enums/BaseEnum.java
  32. 16
    0
      src/main/java/com/xiaoniu/niucai/enums/SportOpeningStatusEnum.java
  33. 19
    0
      src/main/java/com/xiaoniu/niucai/enums/SportStatusEnum.java
  34. 15
    0
      src/main/java/com/xiaoniu/niucai/enums/StatusEnum.java
  35. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanItemMapper.java
  36. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanMapper.java
  37. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanSportDetailMapper.java
  38. 23
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingItemMapper.java
  39. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingMapper.java
  40. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingSportMapper.java
  41. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaLotteryResultDetailMapper.java
  42. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaLotteryResultMapper.java
  43. 21
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaMatchMapper.java
  44. 17
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaMatchOddsMapper.java
  45. 17
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaOrderMapper.java
  46. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TaOrderPayMapper.java
  47. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TdLotteryMapper.java
  48. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TdLotteryOnSaleMapper.java
  49. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TdLotteryPrizeMapper.java
  50. 18
    0
      src/main/java/com/xiaoniu/niucai/mapper/TdSportPassMapper.java
  51. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanItemService.java
  52. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanService.java
  53. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanSportDetailService.java
  54. 23
    0
      src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingItemService.java
  55. 20
    0
      src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingService.java
  56. 19
    0
      src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingSportService.java
  57. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaLotteryResultService.java
  58. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaMatchOddsService.java
  59. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITaMatchService.java
  60. 15
    0
      src/main/java/com/xiaoniu/niucai/service/ITaOrderService.java
  61. 18
    0
      src/main/java/com/xiaoniu/niucai/service/ITdLotteryOnSaleService.java
  62. 19
    0
      src/main/java/com/xiaoniu/niucai/service/ITdLotteryPrizeService.java
  63. 16
    0
      src/main/java/com/xiaoniu/niucai/service/ITdLotteryService.java
  64. 15
    0
      src/main/java/com/xiaoniu/niucai/service/ITdSportPassService.java
  65. 20
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanItemServiceImpl.java
  66. 88
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanServiceImpl.java
  67. 20
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanSportDetailServiceImpl.java
  68. 44
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingItemServiceImpl.java
  69. 76
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingServiceImpl.java
  70. 32
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingSportServiceImpl.java
  71. 354
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaLotteryResultServiceImpl.java
  72. 33
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaMatchOddsServiceImpl.java
  73. 287
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaMatchServiceImpl.java
  74. 19
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TaOrderServiceImpl.java
  75. 33
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryOnSaleServiceImpl.java
  76. 33
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryPrizeServiceImpl.java
  77. 29
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryServiceImpl.java
  78. 25
    0
      src/main/java/com/xiaoniu/niucai/service/impl/TdSportPassServiceImpl.java
  79. 41
    0
      src/main/java/com/xiaoniu/niucai/task/Lottery.java
  80. 36
    0
      src/main/java/com/xiaoniu/niucai/task/Order.java
  81. 15
    0
      src/main/resources/application.yml
  82. 5
    0
      src/main/resources/mapper/TaBettingPlanItemMapper.xml
  83. 5
    0
      src/main/resources/mapper/TaBettingPlanMapper.xml
  84. 5
    0
      src/main/resources/mapper/TaBettingPlanSportDetailMapper.xml
  85. 17
    0
      src/main/resources/mapper/TaCustomerBettingItemMapper.xml
  86. 5
    0
      src/main/resources/mapper/TaCustomerBettingMapper.xml
  87. 5
    0
      src/main/resources/mapper/TaCustomerBettingSportMapper.xml
  88. 5
    0
      src/main/resources/mapper/TaLotteryResultDetailMapper.xml
  89. 5
    0
      src/main/resources/mapper/TaLotteryResultMapper.xml
  90. 17
    0
      src/main/resources/mapper/TaMatchMapper.xml
  91. 5
    0
      src/main/resources/mapper/TaMatchOddsMapper.xml
  92. 5
    0
      src/main/resources/mapper/TaOrderMapper.xml
  93. 5
    0
      src/main/resources/mapper/TaOrderPayMapper.xml
  94. 5
    0
      src/main/resources/mapper/TdLotteryMapper.xml
  95. 5
    0
      src/main/resources/mapper/TdLotteryOnSaleMapper.xml
  96. 5
    0
      src/main/resources/mapper/TdLotteryPrizeMapper.xml
  97. 5
    0
      src/main/resources/mapper/TdSportPassMapper.xml
  98. 13
    0
      src/test/java/com/xiaoniu/niucai/TaskApplicationTests.java

+ 33
- 0
.gitignore 查看文件

@@ -0,0 +1,33 @@
1
+HELP.md
2
+target/
3
+!.mvn/wrapper/maven-wrapper.jar
4
+!**/src/main/**/target/
5
+!**/src/test/**/target/
6
+
7
+### STS ###
8
+.apt_generated
9
+.classpath
10
+.factorypath
11
+.project
12
+.settings
13
+.springBeans
14
+.sts4-cache
15
+
16
+### IntelliJ IDEA ###
17
+.idea
18
+*.iws
19
+*.iml
20
+*.ipr
21
+
22
+### NetBeans ###
23
+/nbproject/private/
24
+/nbbuild/
25
+/dist/
26
+/nbdist/
27
+/.nb-gradle/
28
+build/
29
+!**/src/main/**/build/
30
+!**/src/test/**/build/
31
+
32
+### VS Code ###
33
+.vscode/

+ 117
- 0
.mvn/wrapper/MavenWrapperDownloader.java 查看文件

@@ -0,0 +1,117 @@
1
+/*
2
+ * Copyright 2007-present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *      https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+import java.net.*;
17
+import java.io.*;
18
+import java.nio.channels.*;
19
+import java.util.Properties;
20
+
21
+public class MavenWrapperDownloader {
22
+
23
+    private static final String WRAPPER_VERSION = "0.5.6";
24
+    /**
25
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26
+     */
27
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28
+        + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29
+
30
+    /**
31
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32
+     * use instead of the default one.
33
+     */
34
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35
+            ".mvn/wrapper/maven-wrapper.properties";
36
+
37
+    /**
38
+     * Path where the maven-wrapper.jar will be saved to.
39
+     */
40
+    private static final String MAVEN_WRAPPER_JAR_PATH =
41
+            ".mvn/wrapper/maven-wrapper.jar";
42
+
43
+    /**
44
+     * Name of the property which should be used to override the default download url for the wrapper.
45
+     */
46
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47
+
48
+    public static void main(String args[]) {
49
+        System.out.println("- Downloader started");
50
+        File baseDirectory = new File(args[0]);
51
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52
+
53
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
54
+        // wrapperUrl parameter.
55
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56
+        String url = DEFAULT_DOWNLOAD_URL;
57
+        if(mavenWrapperPropertyFile.exists()) {
58
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
59
+            try {
60
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61
+                Properties mavenWrapperProperties = new Properties();
62
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64
+            } catch (IOException e) {
65
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66
+            } finally {
67
+                try {
68
+                    if(mavenWrapperPropertyFileInputStream != null) {
69
+                        mavenWrapperPropertyFileInputStream.close();
70
+                    }
71
+                } catch (IOException e) {
72
+                    // Ignore ...
73
+                }
74
+            }
75
+        }
76
+        System.out.println("- Downloading from: " + url);
77
+
78
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79
+        if(!outputFile.getParentFile().exists()) {
80
+            if(!outputFile.getParentFile().mkdirs()) {
81
+                System.out.println(
82
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83
+            }
84
+        }
85
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86
+        try {
87
+            downloadFileFromURL(url, outputFile);
88
+            System.out.println("Done");
89
+            System.exit(0);
90
+        } catch (Throwable e) {
91
+            System.out.println("- Error downloading");
92
+            e.printStackTrace();
93
+            System.exit(1);
94
+        }
95
+    }
96
+
97
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99
+            String username = System.getenv("MVNW_USERNAME");
100
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101
+            Authenticator.setDefault(new Authenticator() {
102
+                @Override
103
+                protected PasswordAuthentication getPasswordAuthentication() {
104
+                    return new PasswordAuthentication(username, password);
105
+                }
106
+            });
107
+        }
108
+        URL website = new URL(urlString);
109
+        ReadableByteChannel rbc;
110
+        rbc = Channels.newChannel(website.openStream());
111
+        FileOutputStream fos = new FileOutputStream(destination);
112
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113
+        fos.close();
114
+        rbc.close();
115
+    }
116
+
117
+}

二進制
.mvn/wrapper/maven-wrapper.jar 查看文件


+ 2
- 0
.mvn/wrapper/maven-wrapper.properties 查看文件

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

+ 310
- 0
mvnw 查看文件

@@ -0,0 +1,310 @@
1
+#!/bin/sh
2
+# ----------------------------------------------------------------------------
3
+# Licensed to the Apache Software Foundation (ASF) under one
4
+# or more contributor license agreements.  See the NOTICE file
5
+# distributed with this work for additional information
6
+# regarding copyright ownership.  The ASF licenses this file
7
+# to you under the Apache License, Version 2.0 (the
8
+# "License"); you may not use this file except in compliance
9
+# with the License.  You may obtain a copy of the License at
10
+#
11
+#    https://www.apache.org/licenses/LICENSE-2.0
12
+#
13
+# Unless required by applicable law or agreed to in writing,
14
+# software distributed under the License is distributed on an
15
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+# KIND, either express or implied.  See the License for the
17
+# specific language governing permissions and limitations
18
+# under the License.
19
+# ----------------------------------------------------------------------------
20
+
21
+# ----------------------------------------------------------------------------
22
+# Maven Start Up Batch script
23
+#
24
+# Required ENV vars:
25
+# ------------------
26
+#   JAVA_HOME - location of a JDK home dir
27
+#
28
+# Optional ENV vars
29
+# -----------------
30
+#   M2_HOME - location of maven2's installed home dir
31
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
32
+#     e.g. to debug Maven itself, use
33
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35
+# ----------------------------------------------------------------------------
36
+
37
+if [ -z "$MAVEN_SKIP_RC" ] ; then
38
+
39
+  if [ -f /etc/mavenrc ] ; then
40
+    . /etc/mavenrc
41
+  fi
42
+
43
+  if [ -f "$HOME/.mavenrc" ] ; then
44
+    . "$HOME/.mavenrc"
45
+  fi
46
+
47
+fi
48
+
49
+# OS specific support.  $var _must_ be set to either true or false.
50
+cygwin=false;
51
+darwin=false;
52
+mingw=false
53
+case "`uname`" in
54
+  CYGWIN*) cygwin=true ;;
55
+  MINGW*) mingw=true;;
56
+  Darwin*) darwin=true
57
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+    if [ -z "$JAVA_HOME" ]; then
60
+      if [ -x "/usr/libexec/java_home" ]; then
61
+        export JAVA_HOME="`/usr/libexec/java_home`"
62
+      else
63
+        export JAVA_HOME="/Library/Java/Home"
64
+      fi
65
+    fi
66
+    ;;
67
+esac
68
+
69
+if [ -z "$JAVA_HOME" ] ; then
70
+  if [ -r /etc/gentoo-release ] ; then
71
+    JAVA_HOME=`java-config --jre-home`
72
+  fi
73
+fi
74
+
75
+if [ -z "$M2_HOME" ] ; then
76
+  ## resolve links - $0 may be a link to maven's home
77
+  PRG="$0"
78
+
79
+  # need this for relative symlinks
80
+  while [ -h "$PRG" ] ; do
81
+    ls=`ls -ld "$PRG"`
82
+    link=`expr "$ls" : '.*-> \(.*\)$'`
83
+    if expr "$link" : '/.*' > /dev/null; then
84
+      PRG="$link"
85
+    else
86
+      PRG="`dirname "$PRG"`/$link"
87
+    fi
88
+  done
89
+
90
+  saveddir=`pwd`
91
+
92
+  M2_HOME=`dirname "$PRG"`/..
93
+
94
+  # make it fully qualified
95
+  M2_HOME=`cd "$M2_HOME" && pwd`
96
+
97
+  cd "$saveddir"
98
+  # echo Using m2 at $M2_HOME
99
+fi
100
+
101
+# For Cygwin, ensure paths are in UNIX format before anything is touched
102
+if $cygwin ; then
103
+  [ -n "$M2_HOME" ] &&
104
+    M2_HOME=`cygpath --unix "$M2_HOME"`
105
+  [ -n "$JAVA_HOME" ] &&
106
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107
+  [ -n "$CLASSPATH" ] &&
108
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109
+fi
110
+
111
+# For Mingw, ensure paths are in UNIX format before anything is touched
112
+if $mingw ; then
113
+  [ -n "$M2_HOME" ] &&
114
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
115
+  [ -n "$JAVA_HOME" ] &&
116
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117
+fi
118
+
119
+if [ -z "$JAVA_HOME" ]; then
120
+  javaExecutable="`which javac`"
121
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
122
+    # readlink(1) is not available as standard on Solaris 10.
123
+    readLink=`which readlink`
124
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
125
+      if $darwin ; then
126
+        javaHome="`dirname \"$javaExecutable\"`"
127
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
128
+      else
129
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
130
+      fi
131
+      javaHome="`dirname \"$javaExecutable\"`"
132
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
133
+      JAVA_HOME="$javaHome"
134
+      export JAVA_HOME
135
+    fi
136
+  fi
137
+fi
138
+
139
+if [ -z "$JAVACMD" ] ; then
140
+  if [ -n "$JAVA_HOME"  ] ; then
141
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
142
+      # IBM's JDK on AIX uses strange locations for the executables
143
+      JAVACMD="$JAVA_HOME/jre/sh/java"
144
+    else
145
+      JAVACMD="$JAVA_HOME/bin/java"
146
+    fi
147
+  else
148
+    JAVACMD="`which java`"
149
+  fi
150
+fi
151
+
152
+if [ ! -x "$JAVACMD" ] ; then
153
+  echo "Error: JAVA_HOME is not defined correctly." >&2
154
+  echo "  We cannot execute $JAVACMD" >&2
155
+  exit 1
156
+fi
157
+
158
+if [ -z "$JAVA_HOME" ] ; then
159
+  echo "Warning: JAVA_HOME environment variable is not set."
160
+fi
161
+
162
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
163
+
164
+# traverses directory structure from process work directory to filesystem root
165
+# first directory with .mvn subdirectory is considered project base directory
166
+find_maven_basedir() {
167
+
168
+  if [ -z "$1" ]
169
+  then
170
+    echo "Path not specified to find_maven_basedir"
171
+    return 1
172
+  fi
173
+
174
+  basedir="$1"
175
+  wdir="$1"
176
+  while [ "$wdir" != '/' ] ; do
177
+    if [ -d "$wdir"/.mvn ] ; then
178
+      basedir=$wdir
179
+      break
180
+    fi
181
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
182
+    if [ -d "${wdir}" ]; then
183
+      wdir=`cd "$wdir/.."; pwd`
184
+    fi
185
+    # end of workaround
186
+  done
187
+  echo "${basedir}"
188
+}
189
+
190
+# concatenates all lines of a file
191
+concat_lines() {
192
+  if [ -f "$1" ]; then
193
+    echo "$(tr -s '\n' ' ' < "$1")"
194
+  fi
195
+}
196
+
197
+BASE_DIR=`find_maven_basedir "$(pwd)"`
198
+if [ -z "$BASE_DIR" ]; then
199
+  exit 1;
200
+fi
201
+
202
+##########################################################################################
203
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
205
+##########################################################################################
206
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207
+    if [ "$MVNW_VERBOSE" = true ]; then
208
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
209
+    fi
210
+else
211
+    if [ "$MVNW_VERBOSE" = true ]; then
212
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213
+    fi
214
+    if [ -n "$MVNW_REPOURL" ]; then
215
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216
+    else
217
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218
+    fi
219
+    while IFS="=" read key value; do
220
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221
+      esac
222
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223
+    if [ "$MVNW_VERBOSE" = true ]; then
224
+      echo "Downloading from: $jarUrl"
225
+    fi
226
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227
+    if $cygwin; then
228
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229
+    fi
230
+
231
+    if command -v wget > /dev/null; then
232
+        if [ "$MVNW_VERBOSE" = true ]; then
233
+          echo "Found wget ... using wget"
234
+        fi
235
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236
+            wget "$jarUrl" -O "$wrapperJarPath"
237
+        else
238
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239
+        fi
240
+    elif command -v curl > /dev/null; then
241
+        if [ "$MVNW_VERBOSE" = true ]; then
242
+          echo "Found curl ... using curl"
243
+        fi
244
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245
+            curl -o "$wrapperJarPath" "$jarUrl" -f
246
+        else
247
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248
+        fi
249
+
250
+    else
251
+        if [ "$MVNW_VERBOSE" = true ]; then
252
+          echo "Falling back to using Java to download"
253
+        fi
254
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255
+        # For Cygwin, switch paths to Windows format before running javac
256
+        if $cygwin; then
257
+          javaClass=`cygpath --path --windows "$javaClass"`
258
+        fi
259
+        if [ -e "$javaClass" ]; then
260
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261
+                if [ "$MVNW_VERBOSE" = true ]; then
262
+                  echo " - Compiling MavenWrapperDownloader.java ..."
263
+                fi
264
+                # Compiling the Java class
265
+                ("$JAVA_HOME/bin/javac" "$javaClass")
266
+            fi
267
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268
+                # Running the downloader
269
+                if [ "$MVNW_VERBOSE" = true ]; then
270
+                  echo " - Running MavenWrapperDownloader.java ..."
271
+                fi
272
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273
+            fi
274
+        fi
275
+    fi
276
+fi
277
+##########################################################################################
278
+# End of extension
279
+##########################################################################################
280
+
281
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
282
+if [ "$MVNW_VERBOSE" = true ]; then
283
+  echo $MAVEN_PROJECTBASEDIR
284
+fi
285
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
286
+
287
+# For Cygwin, switch paths to Windows format before running java
288
+if $cygwin; then
289
+  [ -n "$M2_HOME" ] &&
290
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
291
+  [ -n "$JAVA_HOME" ] &&
292
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
293
+  [ -n "$CLASSPATH" ] &&
294
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
295
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
296
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
297
+fi
298
+
299
+# Provide a "standardized" way to retrieve the CLI args that will
300
+# work with both Windows and non-Windows executions.
301
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302
+export MAVEN_CMD_LINE_ARGS
303
+
304
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
305
+
306
+exec "$JAVACMD" \
307
+  $MAVEN_OPTS \
308
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
309
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
310
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182
- 0
mvnw.cmd 查看文件

@@ -0,0 +1,182 @@
1
+@REM ----------------------------------------------------------------------------
2
+@REM Licensed to the Apache Software Foundation (ASF) under one
3
+@REM or more contributor license agreements.  See the NOTICE file
4
+@REM distributed with this work for additional information
5
+@REM regarding copyright ownership.  The ASF licenses this file
6
+@REM to you under the Apache License, Version 2.0 (the
7
+@REM "License"); you may not use this file except in compliance
8
+@REM with the License.  You may obtain a copy of the License at
9
+@REM
10
+@REM    https://www.apache.org/licenses/LICENSE-2.0
11
+@REM
12
+@REM Unless required by applicable law or agreed to in writing,
13
+@REM software distributed under the License is distributed on an
14
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+@REM KIND, either express or implied.  See the License for the
16
+@REM specific language governing permissions and limitations
17
+@REM under the License.
18
+@REM ----------------------------------------------------------------------------
19
+
20
+@REM ----------------------------------------------------------------------------
21
+@REM Maven Start Up Batch script
22
+@REM
23
+@REM Required ENV vars:
24
+@REM JAVA_HOME - location of a JDK home dir
25
+@REM
26
+@REM Optional ENV vars
27
+@REM M2_HOME - location of maven2's installed home dir
28
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
30
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
+@REM     e.g. to debug Maven itself, use
32
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34
+@REM ----------------------------------------------------------------------------
35
+
36
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37
+@echo off
38
+@REM set title of command window
39
+title %0
40
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
42
+
43
+@REM set %HOME% to equivalent of $HOME
44
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45
+
46
+@REM Execute a user defined script before this one
47
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
49
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51
+:skipRcPre
52
+
53
+@setlocal
54
+
55
+set ERROR_CODE=0
56
+
57
+@REM To isolate internal variables from possible post scripts, we use another setlocal
58
+@setlocal
59
+
60
+@REM ==== START VALIDATION ====
61
+if not "%JAVA_HOME%" == "" goto OkJHome
62
+
63
+echo.
64
+echo Error: JAVA_HOME not found in your environment. >&2
65
+echo Please set the JAVA_HOME variable in your environment to match the >&2
66
+echo location of your Java installation. >&2
67
+echo.
68
+goto error
69
+
70
+:OkJHome
71
+if exist "%JAVA_HOME%\bin\java.exe" goto init
72
+
73
+echo.
74
+echo Error: JAVA_HOME is set to an invalid directory. >&2
75
+echo JAVA_HOME = "%JAVA_HOME%" >&2
76
+echo Please set the JAVA_HOME variable in your environment to match the >&2
77
+echo location of your Java installation. >&2
78
+echo.
79
+goto error
80
+
81
+@REM ==== END VALIDATION ====
82
+
83
+:init
84
+
85
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86
+@REM Fallback to current working directory if not found.
87
+
88
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90
+
91
+set EXEC_DIR=%CD%
92
+set WDIR=%EXEC_DIR%
93
+:findBaseDir
94
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
95
+cd ..
96
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
97
+set WDIR=%CD%
98
+goto findBaseDir
99
+
100
+:baseDirFound
101
+set MAVEN_PROJECTBASEDIR=%WDIR%
102
+cd "%EXEC_DIR%"
103
+goto endDetectBaseDir
104
+
105
+:baseDirNotFound
106
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107
+cd "%EXEC_DIR%"
108
+
109
+:endDetectBaseDir
110
+
111
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112
+
113
+@setlocal EnableExtensions EnableDelayedExpansion
114
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116
+
117
+:endReadAdditionalConfig
118
+
119
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122
+
123
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124
+
125
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127
+)
128
+
129
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131
+if exist %WRAPPER_JAR% (
132
+    if "%MVNW_VERBOSE%" == "true" (
133
+        echo Found %WRAPPER_JAR%
134
+    )
135
+) else (
136
+    if not "%MVNW_REPOURL%" == "" (
137
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138
+    )
139
+    if "%MVNW_VERBOSE%" == "true" (
140
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
141
+        echo Downloading from: %DOWNLOAD_URL%
142
+    )
143
+
144
+    powershell -Command "&{"^
145
+		"$webclient = new-object System.Net.WebClient;"^
146
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148
+		"}"^
149
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150
+		"}"
151
+    if "%MVNW_VERBOSE%" == "true" (
152
+        echo Finished downloading %WRAPPER_JAR%
153
+    )
154
+)
155
+@REM End of extension
156
+
157
+@REM Provide a "standardized" way to retrieve the CLI args that will
158
+@REM work with both Windows and non-Windows executions.
159
+set MAVEN_CMD_LINE_ARGS=%*
160
+
161
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162
+if ERRORLEVEL 1 goto error
163
+goto end
164
+
165
+:error
166
+set ERROR_CODE=1
167
+
168
+:end
169
+@endlocal & set ERROR_CODE=%ERROR_CODE%
170
+
171
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
173
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175
+:skipRcPost
176
+
177
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
179
+
180
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181
+
182
+exit /B %ERROR_CODE%

+ 98
- 0
pom.xml 查看文件

@@ -0,0 +1,98 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+	<modelVersion>4.0.0</modelVersion>
5
+	<parent>
6
+		<groupId>org.springframework.boot</groupId>
7
+		<artifactId>spring-boot-starter-parent</artifactId>
8
+		<version>2.3.2.RELEASE</version>
9
+		<relativePath/> <!-- lookup parent from repository -->
10
+	</parent>
11
+	<groupId>com.xiaoniu.niucai</groupId>
12
+	<artifactId>task</artifactId>
13
+	<version>0.0.1-SNAPSHOT</version>
14
+	<name>task</name>
15
+	<description>Task of niucai</description>
16
+
17
+	<properties>
18
+		<java.version>1.8</java.version>
19
+	</properties>
20
+
21
+	<dependencies>
22
+		<dependency>
23
+			<groupId>org.springframework.boot</groupId>
24
+			<artifactId>spring-boot-starter-web</artifactId>
25
+		</dependency>
26
+
27
+		<dependency>
28
+			<groupId>mysql</groupId>
29
+			<artifactId>mysql-connector-java</artifactId>
30
+			<scope>runtime</scope>
31
+		</dependency>
32
+		<dependency>
33
+			<groupId>org.projectlombok</groupId>
34
+			<artifactId>lombok</artifactId>
35
+			<optional>true</optional>
36
+		</dependency>
37
+		<dependency>
38
+			<groupId>org.springframework.boot</groupId>
39
+			<artifactId>spring-boot-starter-test</artifactId>
40
+			<scope>test</scope>
41
+			<exclusions>
42
+				<exclusion>
43
+					<groupId>org.junit.vintage</groupId>
44
+					<artifactId>junit-vintage-engine</artifactId>
45
+				</exclusion>
46
+			</exclusions>
47
+		</dependency>
48
+
49
+		<!-- mybatis-plus -->
50
+		<dependency>
51
+			<groupId>com.baomidou</groupId>
52
+			<artifactId>mybatis-plus-boot-starter</artifactId>
53
+			<version>3.4.0</version>
54
+		</dependency>
55
+
56
+	</dependencies>
57
+
58
+	<build>
59
+		<plugins>
60
+			<plugin>
61
+				<groupId>org.springframework.boot</groupId>
62
+				<artifactId>spring-boot-maven-plugin</artifactId>
63
+			</plugin>
64
+		</plugins>
65
+	</build>
66
+
67
+	<repositories>
68
+		<repository>
69
+			<id>spring-milestones</id>
70
+			<name>Spring Milestones</name>
71
+			<url>https://repo.spring.io/milestone</url>
72
+		</repository>
73
+		<repository>
74
+			<id>spring-snapshots</id>
75
+			<name>Spring Snapshots</name>
76
+			<url>https://repo.spring.io/snapshot</url>
77
+			<snapshots>
78
+				<enabled>true</enabled>
79
+			</snapshots>
80
+		</repository>
81
+	</repositories>
82
+	<pluginRepositories>
83
+		<pluginRepository>
84
+			<id>spring-milestones</id>
85
+			<name>Spring Milestones</name>
86
+			<url>https://repo.spring.io/milestone</url>
87
+		</pluginRepository>
88
+		<pluginRepository>
89
+			<id>spring-snapshots</id>
90
+			<name>Spring Snapshots</name>
91
+			<url>https://repo.spring.io/snapshot</url>
92
+			<snapshots>
93
+				<enabled>true</enabled>
94
+			</snapshots>
95
+		</pluginRepository>
96
+	</pluginRepositories>
97
+
98
+</project>

+ 20
- 0
src/main/java/com/xiaoniu/niucai/TaskApplication.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.xiaoniu.niucai;
2
+
3
+import org.springframework.boot.SpringApplication;
4
+import org.springframework.boot.autoconfigure.SpringBootApplication;
5
+import org.springframework.scheduling.annotation.EnableAsync;
6
+import org.springframework.scheduling.annotation.EnableScheduling;
7
+import org.springframework.transaction.annotation.EnableTransactionManagement;
8
+
9
+
10
+@EnableAsync
11
+@EnableScheduling
12
+@EnableTransactionManagement
13
+@SpringBootApplication
14
+public class TaskApplication {
15
+
16
+	public static void main(String[] args) {
17
+		SpringApplication.run(TaskApplication.class, args);
18
+	}
19
+
20
+}

+ 105
- 0
src/main/java/com/xiaoniu/niucai/common/ArrayUtils.java 查看文件

@@ -0,0 +1,105 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+
4
+import java.util.Arrays;
5
+
6
+public class ArrayUtils {
7
+
8
+    /**
9
+     * 抽取 数组 中指定部分内容, 返回新数组
10
+     * @param src
11
+     * @param start
12
+     * @param end
13
+     * @param <T>
14
+     * @return
15
+     */
16
+    public static <T> T[] slice(T[] src, int start, int ... end) {
17
+        if (null == src) {
18
+            return null;
19
+        }
20
+
21
+        int from = start;
22
+        int to = -1;
23
+        if (end.length == 0) {
24
+            to = src.length;
25
+        } else {
26
+            to = end[0];
27
+        }
28
+
29
+        if (from < 0) {
30
+            from = 0;
31
+        }
32
+
33
+        if (from > src.length) {
34
+            from = src.length;
35
+        }
36
+
37
+        if (from > to) {
38
+            from = 0;
39
+            to = 0;
40
+        }
41
+
42
+        return Arrays.copyOfRange(src, from, to);
43
+    }
44
+
45
+    /**
46
+     * 合并两个数组, 返回新数组
47
+     * @param a1
48
+     * @param a2
49
+     * @param <T>
50
+     * @return
51
+     */
52
+    public static <T> T[] join(T[] a1, T[] a2) {
53
+        if (a1 == null && a2 == null) {
54
+            return null;
55
+        }
56
+
57
+        if (a1 == null) {
58
+            return slice(a2, 0);
59
+        }
60
+
61
+        if (a2 == null) {
62
+            return slice(a1, 0);
63
+        }
64
+
65
+        T[] res = Arrays.copyOf(a1, a1.length + a2.length);
66
+        System.arraycopy(a2, 0, res, a1.length, a2.length);
67
+        return res;
68
+    }
69
+
70
+    /**
71
+     * 从数组指定位置删除一个元素, 返回新数组
72
+     * @param src
73
+     * @param index
74
+     * @param <T>
75
+     * @return
76
+     */
77
+    public static <T> T[] omit(T[] src, int index) {
78
+        return join(slice(src, 0, index), slice(src,index + 1));
79
+    }
80
+
81
+    /**
82
+     * indexOf
83
+     * @param src
84
+     * @param search
85
+     * @param <T>
86
+     * @return
87
+     */
88
+    public static <T> int indexOf(T[] src, T search) {
89
+        return Arrays.asList(src).indexOf(search);
90
+    }
91
+
92
+    /**
93
+     * 数组扩容
94
+     * @param src
95
+     * @param it
96
+     * @param <T>
97
+     * @return
98
+     */
99
+    public static <T> T[] concat(T[] src, T it) {
100
+        T[] nw = Arrays.copyOf(src, src.length + 1);
101
+        nw[src.length] = it;
102
+        return nw;
103
+    }
104
+
105
+}

+ 267
- 0
src/main/java/com/xiaoniu/niucai/common/BizUtils.java 查看文件

@@ -0,0 +1,267 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+import com.xiaoniu.niucai.entity.TdSportPass;
4
+
5
+import javax.servlet.http.HttpServletRequest;
6
+import java.util.ArrayList;
7
+import java.util.Arrays;
8
+import java.util.List;
9
+
10
+/**
11
+ * 业务相关工具类
12
+ */
13
+public class BizUtils {
14
+    /**
15
+     * 计算竞彩过关总数
16
+     * 计算方式如下, 比如购买 5 场  4串5
17
+     * 那么从第一场开始与剩下的4场进行组合,求可能的组合数
18
+     * 接着第二场与剩下的3场进行组合,求可能的组合数
19
+     * 依次下去,直到剩余的场次不能组合4串1
20
+     * 示例 5场的投注注数为 [1, 2, 3, 4, 2]
21
+     * 第一场则有 4种组合可能,即 剩余的 4场挑 3场与第一场组合, C3-4 就是 4
22
+     *     [1, 2, 3, 4] = 1 * 2 * 3 * 4 = 24
23
+     *     [1, 2, 3, 2] = 1 * 2 * 3 * 2 = 12
24
+     *     [1, 2, 4, 2] = 1 * 2 * 4 * 2 = 16
25
+     *     [1, 3, 4, 2] = 1 * 3 * 4 * 2 = 24
26
+     *   第一场结果就是 24 + 12 + 16 + 24 = 76
27
+     * 第二场有 1 种可能, 即 只能把剩余的 3场全部拿来组合
28
+     *     [2, 3, 4, 2] = 2 * 3 * 4 * 2 = 48
29
+     * 剩余的都不能再组合 4串1
30
+     * 因此总过关数是  (76 + 48) * 5  这个 5 来源 4串5
31
+     * @param unitNum
32
+     * @param amount
33
+     * @param noteNumList
34
+     * @return
35
+     */
36
+    public static int computeSportNoteNum(int unitNum, int amount, List<Integer> noteNumList) {
37
+        if (null == noteNumList || noteNumList.size() == 0) {
38
+            return 0;
39
+        }
40
+
41
+        List<List<Integer>> result = new ArrayList<>();
42
+        int times = 0;
43
+        int cursor = 0;
44
+
45
+        // 比如 5 场 投注 4串5, 只可能循环2次, 因为后面的都不能组合为 4串1
46
+        int max = noteNumList.size() - (unitNum - times);
47
+
48
+        // 遍历每场的可能
49
+        for(int i = cursor; i <= max; i++) {
50
+            List<Integer> last = new ArrayList<>();
51
+            last.add(noteNumList.get(i));
52
+            recursion(noteNumList, unitNum, times + 1, cursor + 1, last, result);
53
+        }
54
+
55
+        // 遍历结果, 外循环是场次的结果,需要相加
56
+        // 内循环是每场的组合可能, 需要相乘
57
+        int sum = 0;
58
+        for(List<Integer> noteNum: result) {
59
+            int multi = 1;
60
+            for(Integer n: noteNum) {
61
+                multi *= n;
62
+            }
63
+            sum += multi;
64
+        }
65
+
66
+        return sum * amount;
67
+    }
68
+
69
+    /**
70
+     * 递归遍历每种排列组合方式
71
+     * @param noteNumList
72
+     * @param unitNum 过关场数 比如 4串1 , 4 就是场数
73
+     * @param times 当前场数 0 开始
74
+     * @param cursor noteNumList 的 当前位置
75
+     * @param last  上一轮结果
76
+     * @param out 通过 ref 方式输出结果
77
+     */
78
+    private static void recursion(List<Integer> noteNumList, int unitNum, int times, int cursor, List<Integer> last, List<List<Integer>> out) {
79
+        int max = noteNumList.size() - (unitNum - times);
80
+
81
+        for (int i = cursor; i <= max; i ++) {
82
+            List<Integer> current = ListUtils.getDeepCopy(last);
83
+            current.add(noteNumList.get(i));
84
+
85
+            if (times == unitNum - 1) {
86
+                out.add(current);
87
+            } else {
88
+                // 每一轮只能取后面的一个位置数据
89
+                recursion(noteNumList, unitNum, times + 1, i + 1, current, out);
90
+            }
91
+        }
92
+    }
93
+
94
+    /**
95
+     * 计算胆拖购买注数
96
+     * @param danSize   胆数字个数
97
+     * @param leftSize  其余数字个数
98
+     * @param target    总计要求数字个数, 比如大乐透前区是 5 个
99
+     * @return
100
+     */
101
+    public static int computeDanAmount(int danSize, int leftSize, int target) throws Exception {
102
+        if (target <= danSize) {
103
+            throw new Exception("胆号过多");
104
+        }
105
+
106
+        // 比如大乐透, 前区只能 5 个, 胆号 2 个, 其余号码 7 个
107
+        // 那么只能在剩余的 7 个号码选 5 - 2 = 3 个
108
+        int canUse = target - danSize;
109
+
110
+        if (canUse >= leftSize) {
111
+            throw new Exception("选号过少");
112
+        }
113
+
114
+        // 计算排列 7 个 选 3 个
115
+        return EncryptUtils.combination(leftSize, canUse);
116
+    }
117
+
118
+    /**
119
+     * 获取相同号码数量
120
+     * @param tar 对比目标
121
+     * @param src 数据源
122
+     * @param dan 胆拖数据
123
+     * @return
124
+     */
125
+    public static int getSameNums(String[] tar, String[] src, String[] dan) {
126
+        if (null == tar || tar.length == 0) {
127
+            return 0;
128
+        }
129
+
130
+        if (null == src && src.length == 0) {
131
+            return 0;
132
+        }
133
+
134
+        String[] tarArr = ArrayUtils.slice(tar, 0);
135
+        String[] srcArr = ArrayUtils.slice(src, 0);
136
+        String[] danArr = null == dan ? new String[0] : ArrayUtils.slice(dan, 0);
137
+
138
+        int danNum = 0;
139
+        int maxSrcNum = tarArr.length - danArr.length;
140
+        int srcNum = 0;
141
+
142
+        for (String t : tarArr) {
143
+            int danInx = ArrayUtils.indexOf(danArr, t);
144
+            if (danInx > -1) {
145
+                danNum += 1;
146
+                danArr = ArrayUtils.omit(danArr, danInx);
147
+                continue;
148
+            }
149
+
150
+            int srcInx = ArrayUtils.indexOf(srcArr, t);
151
+            if (srcInx > -1) {
152
+                srcNum += 1;
153
+                srcArr = ArrayUtils.omit(srcArr, srcInx);
154
+            }
155
+        }
156
+
157
+        if (srcNum > maxSrcNum) {
158
+            srcNum = maxSrcNum;
159
+        }
160
+
161
+        return srcNum + danNum;
162
+    }
163
+
164
+    /**
165
+     * 校验是否中奖, 目前只有 排列三直选, 排列五 用到
166
+     * @param tar
167
+     * @param src
168
+     * @return
169
+     */
170
+    public static boolean checkPrizeNumStrict(String[] tar, String[] src) {
171
+        if (null == tar || tar.length == 0 || null == src || src.length == 0) {
172
+            return false;
173
+        }
174
+
175
+        if (tar.length != src.length) {
176
+            return false;
177
+        }
178
+
179
+        for (int i = 0; i < tar.length; i++) {
180
+            String num = tar[i];
181
+            String[] srcList = src[i].split(" ");
182
+            if (!Arrays.asList(srcList).contains(num)) {
183
+                return false;
184
+            }
185
+        }
186
+
187
+        return true;
188
+    }
189
+
190
+    /**
191
+     * 模拟穷举竞彩的所有可能组合
192
+     * @param noteList
193
+     * @param passDict
194
+     * @param <T>
195
+     * @return
196
+     */
197
+    public static <T> List<List<List<T>>> mockAllCombination(List<List<T>> noteList, TdSportPass passDict) {
198
+        Integer[] passArr = {
199
+                passDict.getLevel1(),
200
+                passDict.getLevel2(),
201
+                passDict.getLevel3(),
202
+                passDict.getLevel4(),
203
+                passDict.getLevel5(),
204
+                passDict.getLevel6(),
205
+                passDict.getLevel7(),
206
+                passDict.getLevel8()
207
+        };
208
+
209
+        // 从投注场次中, 选择过关场次组合
210
+        // 比如投注4场比赛, 过关方式为3串4
211
+        // [A, B, C, D] =>
212
+        // [[A, B, C],
213
+        //  [A, B, D],
214
+        //  [A, C, D],
215
+        //  [B, C, D]]
216
+        List<List<List<T>>> combination = ListUtils.combination(noteList, passDict.getUnitNum());
217
+
218
+        // 拆分场次组合
219
+        // [A, B, C] =>
220
+        //  [a, b1, c1],
221
+        //  [a, b1, c2],
222
+        //  [a, b2, c1],
223
+        //  [a, b2, c2]
224
+        List<List<T>> allCombs = new ArrayList<>();
225
+        for (List<List<T>> it : combination) {
226
+            List<List<T>> descartes = ListUtils.descartes(it);
227
+            allCombs.addAll(descartes);
228
+        }
229
+
230
+        // 穷举所有组合可能
231
+        List<List<List<T>>> allParts = new ArrayList<>();
232
+        for (List<T> combs : allCombs) {
233
+            List<List<T>> tmp = new ArrayList<>();
234
+            for (int i = 0; i < passArr.length; i ++) {
235
+                Integer n = passArr[i];
236
+                if (null == n || n < 1) {
237
+                    continue;
238
+                }
239
+
240
+                // level1 的位置是 0, level2 的位置 1, 因此需要 i + 1
241
+                List<List<T>> comb1 = ListUtils.combination(combs, i + 1);
242
+                tmp.addAll(comb1);
243
+            }
244
+            allParts.add(tmp);
245
+        }
246
+
247
+        return allParts;
248
+    }
249
+
250
+    public static String getRealIP(HttpServletRequest request) {
251
+        String ip = request.getHeader("X-Forwarded-For");
252
+        if(!StringUtils.isEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)){
253
+            //多次反向代理后会有多个ip值,第一个ip才是真实ip
254
+            int index = ip.indexOf(",");
255
+            if(index != -1){
256
+                return ip.substring(0,index);
257
+            }else{
258
+                return ip;
259
+            }
260
+        }
261
+        ip = request.getHeader("X-Real-IP");
262
+        if(!StringUtils.isEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)){
263
+            return ip;
264
+        }
265
+        return request.getRemoteAddr();
266
+    }
267
+}

+ 191
- 0
src/main/java/com/xiaoniu/niucai/common/DateUtils.java 查看文件

@@ -0,0 +1,191 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+import java.time.Duration;
4
+import java.time.Instant;
5
+import java.time.LocalDateTime;
6
+import java.time.ZoneId;
7
+import java.time.format.DateTimeFormatter;
8
+import java.util.Date;
9
+
10
+public class DateUtils {
11
+    public static LocalDateTime date2LocalDateTime(Date date) {
12
+        Instant instant = date.toInstant();
13
+        ZoneId zone = ZoneId.systemDefault();
14
+        return LocalDateTime.ofInstant(instant, zone);
15
+    }
16
+
17
+    public static LocalDateTime str2LocalDateTime(String dt, String ... format) {
18
+        if (dt == null) {
19
+            return null;
20
+        }
21
+
22
+        String f = "yyyy-MM-dd HH:mm:ss";
23
+        if (null != format && format.length > 0 && null != format[0]) {
24
+            f = format[0];
25
+        }
26
+
27
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(f);
28
+        return LocalDateTime.parse(dt, formatter);
29
+    }
30
+
31
+    public static boolean sameDay(LocalDateTime d1, LocalDateTime d2) {
32
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
33
+        return d1.format(formatter).equals(d2.format(formatter));
34
+    }
35
+
36
+    public static String cutSecond(LocalDateTime dt) {
37
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
38
+        return dt.format(formatter);
39
+    }
40
+
41
+    public static String today() {
42
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
43
+        return LocalDateTime.now().format(formatter);
44
+    }
45
+
46
+    public static String todayCompact() {
47
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
48
+        return LocalDateTime.now().format(formatter);
49
+    }
50
+
51
+    public static String dateTimeCompact(LocalDateTime dt) {
52
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
53
+        return dt.format(formatter);
54
+    }
55
+
56
+    public static String localDateTimeToString(LocalDateTime d) {
57
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
58
+        return d.format(formatter);
59
+    }
60
+
61
+    public static LocalDateTime day2LocalDateime(String day) {
62
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
63
+        return LocalDateTime.parse(day + " 00:00:00", df);
64
+    }
65
+
66
+    public static LocalDateTime dayToLocalDateime(String day) {
67
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
68
+        return LocalDateTime.parse(day, df);
69
+    }
70
+
71
+    public static boolean checkTimeRange(LocalDateTime start, LocalDateTime end, LocalDateTime dt) {
72
+        if (dt == null) {
73
+            dt = LocalDateTime.now();
74
+        }
75
+
76
+        if (dt.isAfter(start) && dt.isBefore(end)) {
77
+            return true;
78
+        }
79
+        return false;
80
+    }
81
+
82
+    /**
83
+     * 当前时间是否早于指定时间
84
+     *
85
+     * @param target
86
+     * @return
87
+     */
88
+    public static boolean isBefore(String target) {
89
+        LocalDateTime dt = LocalDateTime.now();
90
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
91
+        LocalDateTime targetTime = LocalDateTime.parse(target, df);
92
+        if (dt.isBefore(targetTime)) {
93
+            return true;
94
+        }
95
+        return false;
96
+    }
97
+
98
+    /**
99
+     * 当前时间是否晚于指定时间
100
+     *
101
+     * @param target
102
+     * @return
103
+     */
104
+    public static boolean isAfter(String target) {
105
+        LocalDateTime dt = LocalDateTime.now();
106
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
107
+        LocalDateTime targetTime = LocalDateTime.parse(target, df);
108
+        if (dt.isAfter(targetTime)) {
109
+            return true;
110
+        }
111
+        return false;
112
+    }
113
+
114
+    /**
115
+     * 获取时间差
116
+     *
117
+     * @param dt1
118
+     * @param dt2 目标时间
119
+     * @return
120
+     */
121
+    public static String diffTime(LocalDateTime dt1, LocalDateTime dt2) {
122
+        Duration duration = Duration.between(dt1, dt2);
123
+        long minutes = duration.toMinutes();
124
+        int hours = (int) Math.floor(minutes / 60);
125
+        int minute = (int) minutes % 60;
126
+        int day = (int) Math.floor(hours / 24);
127
+        int hour = hours % 24;
128
+
129
+        return day + "天" + hour + "小时" + minute + "分钟";
130
+    }
131
+
132
+    public static LocalDateTime timeToLocalDateTime(String target){
133
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
134
+        return LocalDateTime.parse(target, df);
135
+    }
136
+
137
+    /**
138
+     * 获取指定之间是周几  周一到周日 1 -> 7
139
+     * @param dt
140
+     * @return
141
+     */
142
+    public static int getWeekDayOf(LocalDateTime dt) {
143
+        if (null == dt) {
144
+            return -1;
145
+        }
146
+
147
+        return dt.getDayOfWeek().getValue();
148
+    }
149
+
150
+    /**
151
+     * 指定时间是否在 t1 t2 的时间区间内
152
+     * @param dt
153
+     * @param t1
154
+     * @param t2
155
+     * @return
156
+     */
157
+    public static boolean isBetween(LocalDateTime dt, LocalDateTime t1, LocalDateTime t2) {
158
+        if (null == dt || null == t1 || null == t2) {
159
+            return false;
160
+        }
161
+
162
+        return dt.isAfter(t1) && dt.isBefore(t2);
163
+    }
164
+
165
+    /**
166
+     * 日期是否在 tm1, tm2 指定的时间范围内
167
+     * tm1, tm2 格式为  HH:mm
168
+     * @param dt
169
+     * @param tm1
170
+     * @param tm2
171
+     * @return
172
+     */
173
+    public static boolean isBetweenTime(LocalDateTime dt, String tm1, String tm2) {
174
+        if (null == dt || null == tm1 || null == tm2) {
175
+            return false;
176
+        }
177
+
178
+        try {
179
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
180
+            String date = dt.format(formatter);
181
+
182
+            DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
183
+            LocalDateTime t1 = LocalDateTime.parse(date + " " + tm1, f);
184
+            LocalDateTime t2 = LocalDateTime.parse(date + " " + tm2, f);
185
+
186
+            return isBetween(dt, t1, t2);
187
+        } catch (Exception e) {
188
+            return false;
189
+        }
190
+    }
191
+}

+ 76
- 0
src/main/java/com/xiaoniu/niucai/common/EncryptUtils.java 查看文件

@@ -0,0 +1,76 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+import org.springframework.util.DigestUtils;
4
+
5
+import java.util.Random;
6
+
7
+public class EncryptUtils {
8
+
9
+    /**
10
+     * md5
11
+     * @param str
12
+     * @param slats
13
+     * @return
14
+     */
15
+    public static String md5(String str, String ...slats) {
16
+        String slat = "";
17
+        if (null != slats && slats.length > 0) {
18
+            slat = slats[0];
19
+        }
20
+
21
+        String base = str + slat;
22
+        String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
23
+        return md5;
24
+    }
25
+
26
+    /**
27
+     * 随机数字串
28
+     * @param length
29
+     * @return
30
+     */
31
+    public static String randDigitStr(int length) {
32
+        Random random = new Random();
33
+        String res = "";
34
+        for (int i = 0; i < length; i ++) {
35
+            int num = random.nextInt(10);
36
+            res += String.valueOf(num);
37
+        }
38
+        return res;
39
+    }
40
+
41
+    /**
42
+     * 阶乘
43
+     * @param num
44
+     * @return
45
+     */
46
+    public static int factorial(int num) {
47
+        return num == 1 ? 1 : num * factorial(num - 1);
48
+    }
49
+
50
+    /**
51
+     * 组合
52
+     * 从 m 个数字, 选出 n 个组合
53
+     * 如果 n > m, 则反之
54
+     * @param m
55
+     * @param n
56
+     * @return
57
+     */
58
+    public static int combination(int m, int n) {
59
+        if (m <=0 || n <= 0) {
60
+            return 0;
61
+        }
62
+
63
+        int src = m;
64
+        int tar = n;
65
+        if (n > m) {
66
+            src = n;
67
+            tar = m;
68
+        }
69
+
70
+        if (src == tar) {
71
+            return 1;
72
+        }
73
+
74
+        return factorial(src) / (factorial(tar) * factorial(src - tar));
75
+    }
76
+}

+ 104
- 0
src/main/java/com/xiaoniu/niucai/common/ListUtils.java 查看文件

@@ -0,0 +1,104 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Collections;
5
+import java.util.List;
6
+
7
+public class ListUtils {
8
+    public static <T> List<T> getDeepCopy(List<T> src) {
9
+        List<T> target = new ArrayList<>();
10
+        for (int i = 0; i < src.size(); i ++) {
11
+            target.add(null);
12
+        }
13
+        Collections.copy(target, src);
14
+        return target;
15
+    }
16
+
17
+    /**
18
+     * 笛卡尔积
19
+     * @param src
20
+     * @param <T>
21
+     * @return
22
+     */
23
+    public static <T> List<List<T>> descartes(List<List<T>> src) {
24
+        if (src == null || src.size() < 2) {
25
+            return null;
26
+        }
27
+
28
+        List<List<T>> result = new ArrayList<>();
29
+        List<T> srcA = src.get(0);
30
+        if (src.size() == 2) {
31
+            List<T> srcB = src.get(1);
32
+
33
+            // 嵌套实现 cross
34
+            for (T a : srcA) {
35
+                for (T b : srcB) {
36
+                    result.add(new ArrayList<T>(){{
37
+                        add(a);
38
+                        add(b);
39
+                    }});
40
+                }
41
+            }
42
+
43
+            return result;
44
+        } else {
45
+            // 去掉第一个, 剩余的继续迭代
46
+            List<List<T>> srcCopy = getDeepCopy(src);   // 不影响原来 list
47
+            srcCopy.remove(0);
48
+            List<List<T>> rtnList = descartes(srcCopy);
49
+
50
+            for (T a : srcA) {
51
+                for (List<T> rtn : rtnList) {
52
+                    List<T> tmp = new ArrayList<>();
53
+                    tmp.add(a);
54
+                    tmp.addAll(rtn);
55
+                    result.add(tmp);
56
+                }
57
+            }
58
+        }
59
+
60
+        return result;
61
+    }
62
+
63
+
64
+    /**
65
+     * 组合
66
+     * 从 src 中抽取组合, 组成长度为 len 的集合
67
+     * @param src
68
+     * @param len
69
+     * @param <T>
70
+     * @return
71
+     */
72
+    public static <T> List<List<T>> combination(List<T> src, int len) {
73
+        if (null == src || src.size() == 0) {
74
+            return null;
75
+        }
76
+
77
+        if (src.size() < len) {
78
+            return null;
79
+        }
80
+
81
+        // 递归
82
+        return combinationRecur(src, len, new ArrayList<T>(), 0);
83
+    }
84
+
85
+    private static <T> List<List<T>> combinationRecur(List<T> src, int len, List<T> last, int index) {
86
+        // 循环次数 = list 长度 - 剩余需要组装的长度
87
+        int times = src.size() - (len - last.size()) + 1;
88
+
89
+        List<List<T>> result = new ArrayList<>();
90
+        for (int i = index; i < times; i ++) {
91
+            List<T> current = getDeepCopy(last);
92
+            current.add(src.get(i));
93
+
94
+            if (current.size() < len) {
95
+                result.addAll(combinationRecur(src, len, current, i + 1));
96
+            } else {
97
+                result.add(current);
98
+            }
99
+        }
100
+
101
+        return result;
102
+    }
103
+
104
+}

+ 134
- 0
src/main/java/com/xiaoniu/niucai/common/StringUtils.java 查看文件

@@ -0,0 +1,134 @@
1
+package com.xiaoniu.niucai.common;
2
+
3
+import java.io.UnsupportedEncodingException;
4
+import java.net.URLEncoder;
5
+import java.util.Random;
6
+import java.util.regex.Matcher;
7
+import java.util.regex.Pattern;
8
+
9
+public class StringUtils {
10
+    private static Pattern humpPattern = Pattern.compile("[A-Z]");
11
+
12
+    public static boolean isEmpty(String str) {
13
+        return null == str || "".equals(str.trim()) || "null".equals(str) || "undefined".equals(str);
14
+    }
15
+
16
+    public static String trim(String src, String...st) {
17
+        if (null == src) return src;
18
+        if (null == st || st.length == 0) return src.trim();
19
+
20
+        String start = st[0];
21
+        if (!src.startsWith(start)) {
22
+            return src;
23
+        }
24
+
25
+        return src.substring(start.length());
26
+    }
27
+
28
+    public static String trimEnd(String src, String str) {
29
+        if (null == src || null == str) {
30
+            return src;
31
+        }
32
+
33
+        if (src.endsWith(str)) {
34
+            return src.substring(0, src.length() - str.length());
35
+        }
36
+
37
+        return src;
38
+    }
39
+
40
+    public static String ifNull(String src, String defaultVal) {
41
+        return isEmpty(src) ? defaultVal : src;
42
+    }
43
+
44
+    public static String random(int length) {
45
+        String str="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
46
+        Random random = new Random();
47
+        StringBuffer sb = new StringBuffer();
48
+        for(int i=0;i<length;i++){
49
+            int number=random.nextInt(62);
50
+            sb.append(str.charAt(number));
51
+        }
52
+        return sb.toString();
53
+    }
54
+
55
+    public static String urlEncode(String str) {
56
+        try {
57
+            return URLEncoder.encode(str, "UTF-8");
58
+        } catch (UnsupportedEncodingException e) {
59
+            e.printStackTrace();
60
+            return str;
61
+        }
62
+    }
63
+
64
+    public static String humpToLine(String str) {
65
+        if (null == str || "".equals(str)) return "";
66
+
67
+        Matcher matcher = humpPattern.matcher(str);
68
+        StringBuffer sb = new StringBuffer();
69
+        while (matcher.find()) {
70
+            matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
71
+        }
72
+        matcher.appendTail(sb);
73
+        return sb.toString();
74
+    }
75
+
76
+    public static String strToUnicode(String str) {
77
+        char[] chars = str.toCharArray();
78
+        String returnStr = "";
79
+        for (int i = 0; i < chars.length; i++) {
80
+            returnStr += "\\u" + Integer.toString(chars[i], 16);
81
+        }
82
+        return returnStr;
83
+    }
84
+
85
+    public static String repeat(String src, int len) {
86
+        if (null == src) {
87
+            return null;
88
+        }
89
+
90
+        if (len <= 0) {
91
+            return src;
92
+        }
93
+
94
+        String res = "";
95
+        for (int i = 0; i < len; i ++) {
96
+            res += src;
97
+        }
98
+
99
+        return res;
100
+    }
101
+
102
+    public static String lpad(String src, String padStr, int len) {
103
+        if (null == src) {
104
+            return null;
105
+        }
106
+
107
+        if (len <= 0 || src.length() >= len) {
108
+            return src;
109
+        }
110
+
111
+        if (null == padStr) {
112
+            padStr = "";
113
+        }
114
+
115
+        int padLen = len - src.length();
116
+        String prefix = repeat(padStr, padLen);
117
+        prefix = prefix.substring(0, padLen);
118
+        return prefix + src;
119
+    }
120
+
121
+    public static boolean isNumeric(String str) {
122
+        if (isEmpty(str)) {
123
+            return false;
124
+        }
125
+
126
+        try {
127
+            Double.parseDouble(str.trim());
128
+        } catch (Exception e) {
129
+            return false;
130
+        }
131
+
132
+        return true;
133
+    }
134
+}

+ 83
- 0
src/main/java/com/xiaoniu/niucai/entity/TaBettingPlan.java 查看文件

@@ -0,0 +1,83 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 投注方案
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-09-08
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaBettingPlan implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @TableId(value = "plan_id", type = IdType.AUTO)
30
+    private Integer planId;
31
+
32
+    private Integer customerId;
33
+
34
+    private String lotteryId;
35
+
36
+    private String lotteryName;
37
+
38
+    private String summary;
39
+
40
+    private String aliaTitle;
41
+
42
+    private Integer times;
43
+
44
+    private Boolean isDigit;
45
+
46
+    private Boolean isSport;
47
+
48
+    private String passCode;
49
+
50
+    private String passName;
51
+
52
+    private LocalDateTime createDate;
53
+
54
+    private Integer status;
55
+
56
+
57
+    @TableField(exist = false)
58
+    private Integer notesNum;
59
+
60
+    @TableField(exist = false)
61
+    private Boolean isAdd;
62
+
63
+    @TableField(exist = false)
64
+    private Integer totalPrice;
65
+
66
+    @TableField(exist = false)
67
+    private String expectedEarning;
68
+
69
+    @TableField(exist = false)
70
+    private Integer shopId;
71
+
72
+    @TableField(exist = false)
73
+    private String shopName;
74
+
75
+    @TableField(exist = false)
76
+    private String issueNo;
77
+
78
+    @TableField(exist = false)
79
+    private String customerName;
80
+
81
+    @TableField(exist = false)
82
+    private List<TaBettingPlanItem> itemList;
83
+}

+ 79
- 0
src/main/java/com/xiaoniu/niucai/entity/TaBettingPlanItem.java 查看文件

@@ -0,0 +1,79 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 方案条目
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-09-08
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaBettingPlanItem implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @TableId(value = "item_no", type = IdType.AUTO)
30
+    private Integer itemNo;
31
+
32
+    private Integer planId;
33
+
34
+    private String summary;
35
+
36
+    private Integer leagueId;
37
+
38
+    private String leagueName;
39
+
40
+    private Integer matchId;
41
+
42
+    private String matchWeek;
43
+
44
+    private String matchDate;
45
+
46
+    private Integer homeTeamId;
47
+
48
+    private String homeTeamName;
49
+
50
+    private Integer awayTeamId;
51
+
52
+    private String awayTeamName;
53
+
54
+    private Integer amount;
55
+
56
+    private String playWay;
57
+
58
+    private Boolean isDan;
59
+
60
+    private Boolean isMulti;
61
+
62
+    private String firstNums;
63
+
64
+    private String firstDan;
65
+
66
+    private String secondNums;
67
+
68
+    private String secondDan;
69
+
70
+    private LocalDateTime createDate;
71
+
72
+    private Integer status;
73
+
74
+    @TableField(exist = false)
75
+    private Integer charges;
76
+
77
+    @TableField(exist = false)
78
+    private List<TaBettingPlanSportDetail> detailList;
79
+}

+ 47
- 0
src/main/java/com/xiaoniu/niucai/entity/TaBettingPlanSportDetail.java 查看文件

@@ -0,0 +1,47 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 体彩方案玩法明细 
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-09
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaBettingPlanSportDetail implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    @TableId(value = "serial_no", type = IdType.AUTO)
28
+    private Integer serialNo;
29
+
30
+    private Integer itemNo;
31
+
32
+    private Integer matchId;
33
+
34
+    private String wayCode;
35
+
36
+    private String wayName;
37
+
38
+    private String odds;
39
+
40
+    private String ruleCode;
41
+
42
+    private String ruleName;
43
+
44
+    private LocalDateTime createDate;
45
+
46
+    private Integer status;
47
+}

+ 90
- 0
src/main/java/com/xiaoniu/niucai/entity/TaCustomerBetting.java 查看文件

@@ -0,0 +1,90 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 客户投注 
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-09-09
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaCustomerBetting implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @TableId(value = "betting_id", type = IdType.AUTO)
30
+    private Integer bettingId;
31
+
32
+    private Integer customerId;
33
+
34
+    private String customerName;
35
+
36
+    private Integer shopId;
37
+
38
+    private String shopName;
39
+
40
+    private Integer planId;
41
+
42
+    private String planName;
43
+
44
+    private String lotteryId;
45
+
46
+    private String lotteryName;
47
+
48
+    private String issueNo;
49
+
50
+    private String openingDate;
51
+
52
+    private Integer bettingTimes;
53
+
54
+    private Boolean isAdd;
55
+
56
+    private Integer notesNum;
57
+
58
+    private Integer totalPrice;
59
+
60
+    private String expectedEarning;
61
+
62
+    private Boolean isDrawn;
63
+
64
+    private LocalDateTime drawnDate;
65
+
66
+    private String lotteryPicture;
67
+
68
+    private Boolean isOpen;
69
+
70
+    private Boolean isWinning;
71
+
72
+    private String winLevel;
73
+
74
+    private Integer winAmount;
75
+
76
+    private Boolean isCashed;
77
+
78
+    private LocalDateTime createDate;
79
+
80
+    private Integer status;
81
+
82
+    @TableField(exist = false)
83
+    List<TaCustomerBettingItem> itemList;
84
+
85
+    @TableField(exist = false)
86
+    List<TaCustomerBettingSport> bettingSports;
87
+
88
+    @TableField(exist = false)
89
+    TaBettingPlan bettingPlan;
90
+}

+ 54
- 0
src/main/java/com/xiaoniu/niucai/entity/TaCustomerBettingItem.java 查看文件

@@ -0,0 +1,54 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 客户投注明细 
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-09-14
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaCustomerBettingItem implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    @TableId(value = "item_no", type = IdType.AUTO)
30
+    private Integer itemNo;
31
+
32
+    private Integer bettingId;
33
+
34
+    private Integer planItemNo;
35
+
36
+    private Boolean isOpen;
37
+
38
+    private String openingDate;
39
+
40
+    private Boolean isWinning;
41
+
42
+    private String winLevel;
43
+
44
+    private Integer winAmount;
45
+
46
+    private Integer openingStatus;
47
+
48
+    private LocalDateTime createDate;
49
+
50
+    private Integer status;
51
+
52
+    @TableField(exist = false)
53
+    private List<TaCustomerBettingSport> sportList;
54
+}

+ 49
- 0
src/main/java/com/xiaoniu/niucai/entity/TaCustomerBettingSport.java 查看文件

@@ -0,0 +1,49 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 客户投注竞彩明细 
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-09
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaCustomerBettingSport implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    @TableId(value = "serial_no", type = IdType.AUTO)
28
+    private Integer serialNo;
29
+
30
+    private Integer bettingId;
31
+
32
+    private Integer itemNo;
33
+
34
+    private Integer detailNo;
35
+
36
+    private Integer matchId;
37
+
38
+    private String ruleCode;
39
+
40
+    private String oddsOrdered;
41
+
42
+    private String oddsDrawn;
43
+
44
+    private Boolean isWinning;
45
+
46
+    private LocalDateTime createDate;
47
+
48
+    private Integer status;
49
+}

+ 82
- 0
src/main/java/com/xiaoniu/niucai/entity/TaLotteryResult.java 查看文件

@@ -0,0 +1,82 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 数字彩开奖结果 
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-08-27
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TaLotteryResult implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * 序号
31
+     */
32
+    @TableId(value = "serial_no", type = IdType.AUTO)
33
+    private Integer serialNo;
34
+
35
+    /**
36
+     * 彩种ID
37
+     */
38
+    private String lotteryId;
39
+
40
+    /**
41
+     * 彩种名称
42
+     */
43
+    private String lotteryName;
44
+
45
+    /**
46
+     * 期数
47
+     */
48
+    private String issueNo;
49
+
50
+    /**
51
+     * 开奖日期
52
+     */
53
+    private String openingDate;
54
+
55
+    /**
56
+     * 结果 半角逗号连接
57
+     */
58
+    private String result;
59
+
60
+    /**
61
+     * 前区结果
62
+     */
63
+    private String firstResult;
64
+
65
+    /**
66
+     * 后区结果
67
+     */
68
+    private String secondResult;
69
+
70
+    /**
71
+     * 创建时间
72
+     */
73
+    private LocalDateTime createDate;
74
+
75
+    /**
76
+     * 状态
77
+     */
78
+    private Integer status;
79
+
80
+    @TableField(exist = false)
81
+    List<TaLotteryResultDetail> detailList;
82
+}

+ 45
- 0
src/main/java/com/xiaoniu/niucai/entity/TaLotteryResultDetail.java 查看文件

@@ -0,0 +1,45 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 数字彩开奖明细 
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-14
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaLotteryResultDetail implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    @TableId(value = "serial_no", type = IdType.AUTO)
28
+    private Integer serialNo;
29
+
30
+    private Integer resultNo;
31
+
32
+    private String level;
33
+
34
+    private String piece;
35
+
36
+    private String money;
37
+
38
+    private String xPiece;
39
+
40
+    private String xMoney;
41
+
42
+    private LocalDateTime createDate;
43
+
44
+    private Boolean status;
45
+}

+ 120
- 0
src/main/java/com/xiaoniu/niucai/entity/TaMatch.java 查看文件

@@ -0,0 +1,120 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 比赛 
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-02
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaMatch implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 比赛ID
29
+     */
30
+    @TableId(value = "match_id", type = IdType.AUTO)
31
+    private Integer matchId;
32
+
33
+    /**
34
+     * 联赛
35
+     */
36
+    private Integer leagueId;
37
+
38
+    /**
39
+     * 联赛名称
40
+     */
41
+    private String leagueName;
42
+
43
+    /**
44
+     * 场次
45
+     */
46
+    private String matchWeek;
47
+
48
+    /**
49
+     * 比赛日期
50
+     */
51
+    private String matchDate;
52
+
53
+    /**
54
+     * 比赛时间
55
+     */
56
+    private String matchTime;
57
+
58
+    /**
59
+     * 主队
60
+     */
61
+    private Integer homeTeamId;
62
+
63
+    /**
64
+     * 主队名称
65
+     */
66
+    private String homeTeamName;
67
+
68
+    /**
69
+     * 客队
70
+     */
71
+    private Integer awayTeamId;
72
+
73
+    /**
74
+     * 客队名称
75
+     */
76
+    private String awayTeamName;
77
+
78
+    /**
79
+     * 半场比分
80
+     */
81
+    private String halfScore;
82
+
83
+    /**
84
+     * 全场比分
85
+     */
86
+    private String wholeScore;
87
+
88
+    /**
89
+     * 胜分
90
+     */
91
+    private Integer diffScore;
92
+
93
+    /**
94
+     * 让分
95
+     */
96
+    private String spreadPoints;
97
+
98
+    /**
99
+     * 预设分
100
+     */
101
+    private String presetPoints;
102
+
103
+    /**
104
+     * 创建时间
105
+     */
106
+    private LocalDateTime createDate;
107
+
108
+    /**
109
+     * 状态
110
+     */
111
+    private Integer status;
112
+
113
+    /**
114
+     * 彩种
115
+     */
116
+    private String lotteryId;
117
+
118
+    private Integer openingStatus;
119
+
120
+}

+ 69
- 0
src/main/java/com/xiaoniu/niucai/entity/TaMatchOdds.java 查看文件

@@ -0,0 +1,69 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+
13
+/**
14
+ * <p>
15
+ * 赔率
16
+ * </p>
17
+ *
18
+ * @author admin
19
+ * @since 2020-09-02
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+public class TaMatchOdds implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    /**
29
+     * 序号
30
+     */
31
+    @TableId(value = "serial_no", type = IdType.AUTO)
32
+    private Integer serialNo;
33
+
34
+    /**
35
+     * 比赛ID
36
+     */
37
+    private Integer matchId;
38
+
39
+    /**
40
+     * 赛制编码
41
+     */
42
+    private String ruleCode;
43
+
44
+    @TableField(exist = false)
45
+    private String ruleName;
46
+
47
+    @TableField(exist = false)
48
+    private String wayCode;
49
+
50
+    @TableField(exist = false)
51
+    private String wayName;
52
+
53
+    /**
54
+     * 赔率
55
+     */
56
+    private String odds;
57
+
58
+    /**
59
+     * 创建时间
60
+     */
61
+    private LocalDateTime createDate;
62
+
63
+    /**
64
+     * 彩种
65
+     */
66
+    private String lotteryId;
67
+
68
+    private Boolean isWinning;
69
+}

+ 56
- 0
src/main/java/com/xiaoniu/niucai/entity/TaOrder.java 查看文件

@@ -0,0 +1,56 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+
13
+/**
14
+ * <p>
15
+ * 订单主表 
16
+ * </p>
17
+ *
18
+ * @author admin
19
+ * @since 2020-09-09
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+public class TaOrder implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @TableId(value = "order_id", type = IdType.INPUT)
29
+    private String orderId;
30
+
31
+    private String orderType;
32
+
33
+    private Integer amount;
34
+
35
+    private Integer charge;
36
+
37
+    private Integer shopId;
38
+
39
+    private Integer customerId;
40
+
41
+    private Integer bettingId;
42
+
43
+    private LocalDateTime createDate;
44
+
45
+    private Integer status;
46
+
47
+    private Integer payStatus;
48
+
49
+    private String outTradeNo;
50
+
51
+    private String tradeNo;
52
+
53
+    private LocalDateTime updateDate;
54
+
55
+    private String srcOrder;
56
+}

+ 59
- 0
src/main/java/com/xiaoniu/niucai/entity/TaOrderPay.java 查看文件

@@ -0,0 +1,59 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 订单支付 
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-10-08
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaOrderPay implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    @TableId(value = "serial_no", type = IdType.AUTO)
28
+    private Integer serialNo;
29
+
30
+    private String orderId;
31
+
32
+    private String payClient;
33
+
34
+    private String tradeNo;
35
+
36
+    private String payee;
37
+
38
+    private String payeeName;
39
+
40
+    private String remitter;
41
+
42
+    private String remitterName;
43
+
44
+    private String tradeType;
45
+
46
+    private Integer payFee;
47
+
48
+    private String payReason;
49
+
50
+    private LocalDateTime createDate;
51
+
52
+    private LocalDateTime payTime;
53
+
54
+    private Integer status;
55
+
56
+    private String payResult;
57
+
58
+    private String failReason;
59
+}

+ 182
- 0
src/main/java/com/xiaoniu/niucai/entity/TdLottery.java 查看文件

@@ -0,0 +1,182 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 彩种
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-08-27
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+public class TdLottery implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * 彩种ID
31
+     */
32
+    @TableId(value = "lottery_id", type = IdType.INPUT)
33
+    private String lotteryId;
34
+
35
+    /**
36
+     * 名称
37
+     */
38
+    private String name;
39
+
40
+    /**
41
+     * 别名
42
+     */
43
+    private String aliaName;
44
+
45
+    /**
46
+     * 简介
47
+     */
48
+    private String description;
49
+
50
+    /**
51
+     * 图标
52
+     */
53
+    private String icon;
54
+
55
+    /**
56
+     * 类型
57
+     */
58
+    private String lotteryType;
59
+
60
+    /**
61
+     * 所属地
62
+     */
63
+    private String areaId;
64
+
65
+    /**
66
+     * 前区数字范围 0,32代表最小值等于0,最大值等于32
67
+     */
68
+    private String firstRange;
69
+
70
+    /**
71
+     * 后区数字范围 0,16代表最小值等于0,最大值等于16
72
+     */
73
+    private String secondRange;
74
+
75
+    /**
76
+     * 数字区是否重复
77
+     */
78
+    private Boolean isRepeat;
79
+
80
+    /**
81
+     * 前区数字个数
82
+     */
83
+    private Integer firstNums;
84
+
85
+    /**
86
+     * 后区数字个数
87
+     */
88
+    private Integer secondNums;
89
+
90
+    /**
91
+     * 是否地方彩
92
+     */
93
+    private Boolean isLocal;
94
+
95
+    /**
96
+     * 是否高频彩
97
+     */
98
+    private Boolean isHigh;
99
+
100
+    /**
101
+     * 是否足彩
102
+     */
103
+    private Boolean isFootball;
104
+
105
+    /**
106
+     * 是否篮彩
107
+     */
108
+    private Boolean isBasketball;
109
+
110
+    /**
111
+     * 是否竞彩
112
+     */
113
+    private Boolean isSport;
114
+
115
+    /**
116
+     * 是否数字彩
117
+     */
118
+    private Boolean isDigit;
119
+
120
+    /**
121
+     * 创建时间
122
+     */
123
+    private LocalDateTime createDate;
124
+
125
+    /**
126
+     * 状态
127
+     */
128
+    private Integer status;
129
+
130
+    /**
131
+     * 排序
132
+     */
133
+    private Integer sortNo;
134
+
135
+    /**
136
+     * 单注金额:单位分
137
+     */
138
+    private Integer unitPrice;
139
+
140
+    /**
141
+     * 允许追加
142
+     */
143
+    private Boolean isAdd;
144
+
145
+    /**
146
+     * 单注追加金额
147
+     */
148
+    private Integer unitAddPrice;
149
+
150
+    /**
151
+     * 单票倍数限制
152
+     */
153
+    private Integer maxTimes;
154
+
155
+    /**
156
+     * 单票金额限制
157
+     */
158
+    private Integer maxPrice;
159
+
160
+    /**
161
+     * 单票基本及追加限制
162
+     */
163
+    private Integer maxAddPrice;
164
+
165
+    /**
166
+     * 是否开通
167
+     */
168
+    @TableField(exist = false)
169
+    private Boolean isOpen;
170
+
171
+    /**
172
+     * 中奖设置
173
+     */
174
+    @TableField(exist = false)
175
+    private List<TdLotteryPrize> prizeSettingList;
176
+
177
+    /**
178
+     * 开奖, 售奖设置
179
+     */
180
+    @TableField(exist = false)
181
+    private List<TdLotteryOnSale> onSaleSettings;
182
+}

+ 47
- 0
src/main/java/com/xiaoniu/niucai/entity/TdLotteryOnSale.java 查看文件

@@ -0,0 +1,47 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+
12
+/**
13
+ * <p>
14
+ * 彩种销售时间
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-11
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TdLotteryOnSale implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    @TableId(value = "serial_no", type = IdType.AUTO)
28
+    private Integer serialNo;
29
+
30
+    private String lotteryId;
31
+
32
+    private Integer weekDay;
33
+
34
+    private String lotteryTime;
35
+
36
+    private String openingTime;
37
+
38
+    private String closingTime;
39
+
40
+    private Integer scheduleFreq;
41
+
42
+    private Integer nextWeekDay;
43
+
44
+    private LocalDateTime createDate;
45
+
46
+    private Boolean status;
47
+}

+ 54
- 0
src/main/java/com/xiaoniu/niucai/entity/TdLotteryPrize.java 查看文件

@@ -0,0 +1,54 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+import lombok.EqualsAndHashCode;
7
+import lombok.experimental.Accessors;
8
+
9
+import java.io.Serializable;
10
+
11
+/**
12
+ * <p>
13
+ * 彩种中奖设置 
14
+ * </p>
15
+ *
16
+ * @author admin
17
+ * @since 2020-09-07
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+public class TdLotteryPrize implements Serializable {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    @TableId(value = "serial_no", type = IdType.AUTO)
27
+    private Integer serialNo;
28
+
29
+    private String lotteryId;
30
+
31
+    private String level;
32
+
33
+    private String playWay;
34
+
35
+    private String bingoRule;
36
+
37
+    private Boolean round;
38
+
39
+    private Integer moneyAward;
40
+
41
+    private Boolean isDynamic;
42
+
43
+    private String calcFormula;
44
+
45
+    private Boolean isByWay;
46
+
47
+    private Boolean isByRound;
48
+
49
+    private Integer maxPrice;
50
+
51
+    private Integer maxAddPrice;
52
+
53
+    private Integer status;
54
+}

+ 111
- 0
src/main/java/com/xiaoniu/niucai/entity/TdSportPass.java 查看文件

@@ -0,0 +1,111 @@
1
+package com.xiaoniu.niucai.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+
13
+/**
14
+ * <p>
15
+ * 闯关字典
16
+ * </p>
17
+ *
18
+ * @author admin
19
+ * @since 2020-09-02
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+public class TdSportPass implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    /**
29
+     * 过关 m*n格式
30
+     */
31
+    @TableId(value = "pass_code", type = IdType.INPUT)
32
+    private String passCode;
33
+
34
+    /**
35
+     * 名称
36
+     */
37
+    private String name;
38
+
39
+    /**
40
+     * 场次
41
+     */
42
+    private Integer unitNum;
43
+
44
+    /**
45
+     * 关数
46
+     */
47
+    private Integer amount;
48
+
49
+    /**
50
+     * 单场
51
+     */
52
+    @TableField("`level_1`")
53
+    private Integer level1;
54
+
55
+    /**
56
+     * 两关
57
+     */
58
+    @TableField("`level_2`")
59
+    private Integer level2;
60
+
61
+    /**
62
+     * 三关
63
+     */
64
+    @TableField("`level_3`")
65
+    private Integer level3;
66
+
67
+    /**
68
+     * 四关
69
+     */
70
+    @TableField("`level_4`")
71
+    private Integer level4;
72
+
73
+    /**
74
+     * 五关
75
+     */
76
+    @TableField("`level_5`")
77
+    private Integer level5;
78
+
79
+    /**
80
+     * 六关
81
+     */
82
+    @TableField("`level_6`")
83
+    private Integer level6;
84
+
85
+    /**
86
+     * 七关
87
+     */
88
+    @TableField("`level_7`")
89
+    private Integer level7;
90
+
91
+    /**
92
+     * 八关
93
+     */
94
+    @TableField("`level_8`")
95
+    private Integer level8;
96
+
97
+    /**
98
+     * 创建时间
99
+     */
100
+    private LocalDateTime createDate;
101
+
102
+    /**
103
+     * 状态
104
+     */
105
+    private Integer status;
106
+
107
+    /**
108
+     * 排序
109
+     */
110
+    private Integer sortNo;
111
+}

+ 42
- 0
src/main/java/com/xiaoniu/niucai/enums/BaseEnum.java 查看文件

@@ -0,0 +1,42 @@
1
+package com.xiaoniu.niucai.enums;
2
+
3
+public interface BaseEnum {
4
+
5
+    /**
6
+     * 获取枚举标识
7
+     *
8
+     * @return
9
+     */
10
+    Integer getCode();
11
+
12
+    /**
13
+     * 获取枚举描述
14
+     *
15
+     * @return
16
+     */
17
+    String getDesc();
18
+
19
+    /**
20
+     * 通过枚举类型和code值获取对应的枚举类型
21
+     * @param enumType
22
+     * @param code
23
+     * @param <T>
24
+     * @return
25
+     */
26
+    static <T extends BaseEnum> T valueOf(Class<? extends BaseEnum> enumType, Integer code) {
27
+        if (enumType == null || code == null) {
28
+            return null;
29
+        }
30
+        T[] enumConstants = (T[]) enumType.getEnumConstants();
31
+        if (enumConstants == null) {
32
+            return null;
33
+        }
34
+        for (T enumConstant : enumConstants) {
35
+            int enumCode = enumConstant.getCode();
36
+            if (code.equals(enumCode)) {
37
+                return enumConstant;
38
+            }
39
+        }
40
+        return null;
41
+    }
42
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/enums/SportOpeningStatusEnum.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.enums;
2
+
3
+
4
+import lombok.AllArgsConstructor;
5
+import lombok.Getter;
6
+
7
+@Getter
8
+@AllArgsConstructor
9
+public enum SportOpeningStatusEnum implements BaseEnum {
10
+    READY(0, "未处理"),
11
+    DOING(1, "处理中"),
12
+    FINISHED(2, "已完成");
13
+
14
+    private Integer code;
15
+    private String desc;
16
+}

+ 19
- 0
src/main/java/com/xiaoniu/niucai/enums/SportStatusEnum.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.xiaoniu.niucai.enums;
2
+
3
+
4
+import lombok.AllArgsConstructor;
5
+import lombok.Getter;
6
+
7
+@Getter
8
+@AllArgsConstructor
9
+public enum SportStatusEnum implements BaseEnum {
10
+    READY(0, "未开售"),
11
+    SALE(1, "在售"),
12
+    NORMAL(2, "进行中"),
13
+    FINISHED(3, "已完成"),
14
+    INVALID(4, "无效场次"),
15
+    CANCEL(5, "取消");
16
+
17
+    private Integer code;
18
+    private String desc;
19
+}

+ 15
- 0
src/main/java/com/xiaoniu/niucai/enums/StatusEnum.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.xiaoniu.niucai.enums;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Getter;
5
+
6
+@Getter
7
+@AllArgsConstructor
8
+public enum StatusEnum implements BaseEnum {
9
+    READY(0, "待处理"),
10
+    NORMAL(1, "正常"),
11
+    DELETED(-1, "删除");
12
+
13
+    private Integer code;
14
+    private String desc;
15
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanItemMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaBettingPlanItem;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 方案条目 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-08
14
+ */
15
+@Mapper
16
+public interface TaBettingPlanItemMapper extends BaseMapper<TaBettingPlanItem> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaBettingPlan;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 投注方案 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-08
14
+ */
15
+@Mapper
16
+public interface TaBettingPlanMapper extends BaseMapper<TaBettingPlan> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaBettingPlanSportDetailMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaBettingPlanSportDetail;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 体彩方案玩法明细  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-09
14
+ */
15
+@Mapper
16
+public interface TaBettingPlanSportDetailMapper extends BaseMapper<TaBettingPlanSportDetail> {
17
+
18
+}

+ 23
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingItemMapper.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.xiaoniu.niucai.entity.TaCustomerBettingItem;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * <p>
13
+ * 客户投注明细  Mapper 接口
14
+ * </p>
15
+ *
16
+ * @author admin
17
+ * @since 2020-09-14
18
+ */
19
+@Mapper
20
+public interface TaCustomerBettingItemMapper extends BaseMapper<TaCustomerBettingItem> {
21
+
22
+    List<TaCustomerBettingItem> getByMatch(@Param("matchId") Integer matchId, @Param("openingStatus") Integer openingStatus);
23
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaCustomerBetting;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 客户投注  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-09
14
+ */
15
+@Mapper
16
+public interface TaCustomerBettingMapper extends BaseMapper<TaCustomerBetting> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaCustomerBettingSportMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaCustomerBettingSport;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 客户投注竞彩明细  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-09
14
+ */
15
+@Mapper
16
+public interface TaCustomerBettingSportMapper extends BaseMapper<TaCustomerBettingSport> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaLotteryResultDetailMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaLotteryResultDetail;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 数字彩开奖明细  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-14
14
+ */
15
+@Mapper
16
+public interface TaLotteryResultDetailMapper extends BaseMapper<TaLotteryResultDetail> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaLotteryResultMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaLotteryResult;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+
8
+/**
9
+ * <p>
10
+ * 数字彩开奖结果  Mapper 接口
11
+ * </p>
12
+ *
13
+ * @author admin
14
+ * @since 2020-08-27
15
+ */
16
+@Mapper
17
+public interface TaLotteryResultMapper extends BaseMapper<TaLotteryResult> {
18
+}

+ 21
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaMatchMapper.java 查看文件

@@ -0,0 +1,21 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaMatch;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 比赛  Mapper 接口
13
+ * </p>
14
+ *
15
+ * @author admin
16
+ * @since 2020-09-02
17
+ */
18
+@Mapper
19
+public interface TaMatchMapper extends BaseMapper<TaMatch> {
20
+    List<TaMatch> getLastOpenAndUndoMatch(@Param("days") int days) throws Exception;
21
+}

+ 17
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaMatchOddsMapper.java 查看文件

@@ -0,0 +1,17 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaMatchOdds;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 赔率 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-02
14
+ */
15
+@Mapper
16
+public interface TaMatchOddsMapper extends BaseMapper<TaMatchOdds> {
17
+}

+ 17
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaOrderMapper.java 查看文件

@@ -0,0 +1,17 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaOrder;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 订单主表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-09
14
+ */
15
+@Mapper
16
+public interface TaOrderMapper extends BaseMapper<TaOrder> {
17
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TaOrderPayMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TaOrderPay;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 订单支付  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-10-08
14
+ */
15
+@Mapper
16
+public interface TaOrderPayMapper extends BaseMapper<TaOrderPay> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TdLotteryMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TdLottery;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 彩种 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-08-27
14
+ */
15
+@Mapper
16
+public interface TdLotteryMapper extends BaseMapper<TdLottery> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TdLotteryOnSaleMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TdLotteryOnSale;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 彩种销售时间 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-11
14
+ */
15
+@Mapper
16
+public interface TdLotteryOnSaleMapper extends BaseMapper<TdLotteryOnSale> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TdLotteryPrizeMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TdLotteryPrize;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 彩种中奖设置  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-07
14
+ */
15
+@Mapper
16
+public interface TdLotteryPrizeMapper extends BaseMapper<TdLotteryPrize> {
17
+
18
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/mapper/TdSportPassMapper.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.xiaoniu.niucai.entity.TdSportPass;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 闯关字典 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-09-02
14
+ */
15
+@Mapper
16
+public interface TdSportPassMapper extends BaseMapper<TdSportPass> {
17
+
18
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanItemService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaBettingPlanItem;
5
+
6
+/**
7
+ * <p>
8
+ * 方案条目 服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-08
13
+ */
14
+public interface ITaBettingPlanItemService extends IService<TaBettingPlanItem> {
15
+
16
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaBettingPlan;
5
+
6
+/**
7
+ * <p>
8
+ * 投注方案 服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-08
13
+ */
14
+public interface ITaBettingPlanService extends IService<TaBettingPlan> {
15
+    TaBettingPlan getDetailOfPlanById(Integer planId);
16
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaBettingPlanSportDetailService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaBettingPlanSportDetail;
5
+
6
+/**
7
+ * <p>
8
+ * 体彩方案玩法明细  服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-09
13
+ */
14
+public interface ITaBettingPlanSportDetailService extends IService<TaBettingPlanSportDetail> {
15
+
16
+}

+ 23
- 0
src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingItemService.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaCustomerBetting;
5
+import com.xiaoniu.niucai.entity.TaCustomerBettingItem;
6
+import com.xiaoniu.niucai.entity.TaMatch;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 客户投注明细  服务类
13
+ * </p>
14
+ *
15
+ * @author admin
16
+ * @since 2020-09-14
17
+ */
18
+public interface ITaCustomerBettingItemService extends IService<TaCustomerBettingItem> {
19
+    List<TaCustomerBettingItem> getByMatch(TaMatch taMatch);
20
+
21
+
22
+    List<TaCustomerBettingItem> getByBetting(TaCustomerBetting betting);
23
+}

+ 20
- 0
src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingService.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaCustomerBetting;
5
+import com.xiaoniu.niucai.entity.TaLotteryResult;
6
+import com.xiaoniu.niucai.entity.TdLottery;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 客户投注  服务类
13
+ * </p>
14
+ *
15
+ * @author admin
16
+ * @since 2020-09-09
17
+ */
18
+public interface ITaCustomerBettingService extends IService<TaCustomerBetting> {
19
+    List<TaCustomerBetting> getAllUnOpenBettingsBy(TdLottery lottery, TaLotteryResult lotteryResult);
20
+}

+ 19
- 0
src/main/java/com/xiaoniu/niucai/service/ITaCustomerBettingSportService.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaCustomerBettingSport;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * <p>
10
+ * 客户投注竞彩明细  服务类
11
+ * </p>
12
+ *
13
+ * @author admin
14
+ * @since 2020-09-09
15
+ */
16
+public interface ITaCustomerBettingSportService extends IService<TaCustomerBettingSport> {
17
+
18
+    List<TaCustomerBettingSport> getListByBetting(Integer bettingId, Integer itemNo) throws Exception;
19
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaLotteryResultService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaLotteryResult;
5
+
6
+/**
7
+ * <p>
8
+ * 数字彩开奖结果  服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-08-27
13
+ */
14
+public interface ITaLotteryResultService extends IService<TaLotteryResult> {
15
+    void checkAndSetLotteryPrize() throws Exception;
16
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaMatchOddsService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaMatchOdds;
5
+
6
+/**
7
+ * <p>
8
+ * 赔率 服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-02
13
+ */
14
+public interface ITaMatchOddsService extends IService<TaMatchOdds> {
15
+    TaMatchOdds getByRule(Integer matchId, String ruleCode);
16
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITaMatchService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaMatch;
5
+
6
+/**
7
+ * <p>
8
+ * 比赛  服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-02
13
+ */
14
+public interface ITaMatchService extends IService<TaMatch> {
15
+    void checkAndSetSportPrize() throws Exception;
16
+}

+ 15
- 0
src/main/java/com/xiaoniu/niucai/service/ITaOrderService.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TaOrder;
5
+
6
+/**
7
+ * <p>
8
+ * 订单主表  服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-09
13
+ */
14
+public interface ITaOrderService extends IService<TaOrder> {
15
+}

+ 18
- 0
src/main/java/com/xiaoniu/niucai/service/ITdLotteryOnSaleService.java 查看文件

@@ -0,0 +1,18 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TdLotteryOnSale;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * <p>
10
+ * 彩种销售时间 服务类
11
+ * </p>
12
+ *
13
+ * @author admin
14
+ * @since 2020-09-11
15
+ */
16
+public interface ITdLotteryOnSaleService extends IService<TdLotteryOnSale> {
17
+    List<TdLotteryOnSale> getByWeekDay(int weekDay);
18
+}

+ 19
- 0
src/main/java/com/xiaoniu/niucai/service/ITdLotteryPrizeService.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TdLottery;
5
+import com.xiaoniu.niucai.entity.TdLotteryPrize;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * <p>
11
+ * 彩种中奖设置  服务类
12
+ * </p>
13
+ *
14
+ * @author admin
15
+ * @since 2020-09-07
16
+ */
17
+public interface ITdLotteryPrizeService extends IService<TdLotteryPrize> {
18
+    List<TdLotteryPrize> getByLottery(TdLottery lottery);
19
+}

+ 16
- 0
src/main/java/com/xiaoniu/niucai/service/ITdLotteryService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TdLottery;
5
+
6
+
7
+/**
8
+ * <p>
9
+ * 彩种 服务类
10
+ * </p>
11
+ *
12
+ * @author admin
13
+ * @since 2020-08-27
14
+ */
15
+public interface ITdLotteryService extends IService<TdLottery> {
16
+}

+ 15
- 0
src/main/java/com/xiaoniu/niucai/service/ITdSportPassService.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.xiaoniu.niucai.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.xiaoniu.niucai.entity.TdSportPass;
5
+
6
+/**
7
+ * <p>
8
+ * 闯关字典 服务类
9
+ * </p>
10
+ *
11
+ * @author admin
12
+ * @since 2020-09-02
13
+ */
14
+public interface ITdSportPassService extends IService<TdSportPass> {
15
+}

+ 20
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanItemServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.xiaoniu.niucai.entity.TaBettingPlanItem;
5
+import com.xiaoniu.niucai.mapper.TaBettingPlanItemMapper;
6
+import com.xiaoniu.niucai.service.ITaBettingPlanItemService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 方案条目 服务实现类
12
+ * </p>
13
+ *
14
+ * @author admin
15
+ * @since 2020-09-08
16
+ */
17
+@Service
18
+public class TaBettingPlanItemServiceImpl extends ServiceImpl<TaBettingPlanItemMapper, TaBettingPlanItem> implements ITaBettingPlanItemService {
19
+
20
+}

+ 88
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanServiceImpl.java 查看文件

@@ -0,0 +1,88 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.entity.TaBettingPlan;
6
+import com.xiaoniu.niucai.entity.TaBettingPlanItem;
7
+import com.xiaoniu.niucai.entity.TaBettingPlanSportDetail;
8
+import com.xiaoniu.niucai.enums.StatusEnum;
9
+import com.xiaoniu.niucai.service.ITaBettingPlanService;
10
+import com.xiaoniu.niucai.mapper.TaBettingPlanItemMapper;
11
+import com.xiaoniu.niucai.mapper.TaBettingPlanMapper;
12
+import com.xiaoniu.niucai.mapper.TaBettingPlanSportDetailMapper;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * <p>
20
+ * 投注方案 服务实现类
21
+ * </p>
22
+ *
23
+ * @author admin
24
+ * @since 2020-09-08
25
+ */
26
+@Service
27
+public class TaBettingPlanServiceImpl extends ServiceImpl<TaBettingPlanMapper, TaBettingPlan> implements ITaBettingPlanService {
28
+
29
+    @Autowired
30
+    TaBettingPlanSportDetailMapper taBettingPlanSportDetailMapper;
31
+
32
+    @Autowired
33
+    TaBettingPlanItemMapper taBettingPlanItemMapper;
34
+
35
+    @Override
36
+    public TaBettingPlan getDetailOfPlanById(Integer planId) {
37
+        TaBettingPlan taBettingPlan = getById(planId);
38
+        if (null == taBettingPlan || StatusEnum.DELETED.getCode().equals(taBettingPlan.getStatus())) {
39
+            return null;
40
+        }
41
+
42
+        List<TaBettingPlanItem> itemList = getBettingPlanItemsByPlan(taBettingPlan);
43
+        taBettingPlan.setItemList(itemList);
44
+
45
+        if (null != itemList && taBettingPlan.getIsSport()) {
46
+            for (TaBettingPlanItem item: itemList) {
47
+                List<TaBettingPlanSportDetail> detailList = getBettingPlanSprotsByItem(item);
48
+                item.setDetailList(detailList);
49
+            }
50
+        }
51
+
52
+        return taBettingPlan;
53
+    }
54
+
55
+    private List<TaBettingPlanSportDetail> getBettingPlanSprotsByItem(TaBettingPlanItem item) {
56
+        QueryWrapper<TaBettingPlanSportDetail> queryWrapper = new QueryWrapper<>();
57
+        queryWrapper.eq("item_no", item.getItemNo());
58
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
59
+        queryWrapper.orderByAsc("item_no");
60
+        queryWrapper.orderByAsc("serial_no");
61
+
62
+        return taBettingPlanSportDetailMapper.selectList(queryWrapper);
63
+    }
64
+
65
+    private List<TaBettingPlanItem> getBettingPlanItemsByPlan(TaBettingPlan taBettingPlan) {
66
+        QueryWrapper<TaBettingPlanItem> queryWrapper = new QueryWrapper<>();
67
+        queryWrapper.eq("plan_id", taBettingPlan.getPlanId());
68
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
69
+        queryWrapper.orderByAsc("item_no");
70
+
71
+        return taBettingPlanItemMapper.selectList(queryWrapper);
72
+    }
73
+
74
+    /**
75
+     * p3, p5 直选
76
+     * 支持每一位多选情况
77
+     * @param item
78
+     * @return
79
+     */
80
+    private int computeDirectlyAmount(TaBettingPlanItem item) {
81
+        int res = 1; // 最差是 1 注
82
+        for (String num: item.getFirstNums().split(",")) {
83
+            res *= num.split(" ").length;
84
+        }
85
+        return res;
86
+    }
87
+
88
+}

+ 20
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaBettingPlanSportDetailServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.xiaoniu.niucai.service.ITaBettingPlanSportDetailService;
5
+import com.xiaoniu.niucai.entity.TaBettingPlanSportDetail;
6
+import com.xiaoniu.niucai.mapper.TaBettingPlanSportDetailMapper;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 体彩方案玩法明细  服务实现类
12
+ * </p>
13
+ *
14
+ * @author admin
15
+ * @since 2020-09-09
16
+ */
17
+@Service
18
+public class TaBettingPlanSportDetailServiceImpl extends ServiceImpl<TaBettingPlanSportDetailMapper, TaBettingPlanSportDetail> implements ITaBettingPlanSportDetailService {
19
+
20
+}

+ 44
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingItemServiceImpl.java 查看文件

@@ -0,0 +1,44 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.enums.StatusEnum;
6
+import com.xiaoniu.niucai.service.ITaCustomerBettingItemService;
7
+import com.xiaoniu.niucai.entity.TaCustomerBetting;
8
+import com.xiaoniu.niucai.entity.TaCustomerBettingItem;
9
+import com.xiaoniu.niucai.entity.TaMatch;
10
+import com.xiaoniu.niucai.mapper.TaCustomerBettingItemMapper;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Service;
13
+
14
+import java.util.List;
15
+
16
+/**
17
+ * <p>
18
+ * 客户投注明细  服务实现类
19
+ * </p>
20
+ *
21
+ * @author admin
22
+ * @since 2020-09-14
23
+ */
24
+@Service
25
+public class TaCustomerBettingItemServiceImpl extends ServiceImpl<TaCustomerBettingItemMapper, TaCustomerBettingItem> implements ITaCustomerBettingItemService {
26
+
27
+    @Autowired
28
+    TaCustomerBettingItemMapper taCustomerBettingItemMapper;
29
+
30
+    @Override
31
+    public List<TaCustomerBettingItem> getByMatch(TaMatch taMatch) {
32
+        return taCustomerBettingItemMapper.getByMatch(taMatch.getMatchId(), null);
33
+    }
34
+
35
+    @Override
36
+    public List<TaCustomerBettingItem> getByBetting(TaCustomerBetting betting) {
37
+        QueryWrapper<TaCustomerBettingItem> queryWrapper = new QueryWrapper<>();
38
+        queryWrapper.eq("betting_id", betting.getBettingId());
39
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
40
+        queryWrapper.orderByAsc("create_date");
41
+
42
+        return list(queryWrapper);
43
+    }
44
+}

+ 76
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingServiceImpl.java 查看文件

@@ -0,0 +1,76 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.entity.*;
6
+import com.xiaoniu.niucai.enums.StatusEnum;
7
+import com.xiaoniu.niucai.service.ITaBettingPlanService;
8
+import com.xiaoniu.niucai.service.ITaCustomerBettingService;
9
+import com.xiaoniu.niucai.mapper.TaCustomerBettingItemMapper;
10
+import com.xiaoniu.niucai.mapper.TaCustomerBettingMapper;
11
+import com.xiaoniu.niucai.mapper.TaCustomerBettingSportMapper;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Service;
14
+
15
+import java.util.List;
16
+
17
+/**
18
+ * <p>
19
+ * 客户投注  服务实现类
20
+ * </p>
21
+ *
22
+ * @author admin
23
+ * @since 2020-09-09
24
+ */
25
+@Service
26
+public class TaCustomerBettingServiceImpl extends ServiceImpl<TaCustomerBettingMapper, TaCustomerBetting> implements ITaCustomerBettingService {
27
+
28
+    @Autowired
29
+    ITaBettingPlanService iTaBettingPlanService;
30
+
31
+    @Autowired
32
+    TaCustomerBettingSportMapper taCustomerBettingSportMapper;
33
+
34
+    @Autowired
35
+    TaCustomerBettingItemMapper taCustomerBettingItemMapper;
36
+
37
+    @Override
38
+    public List<TaCustomerBetting> getAllUnOpenBettingsBy(TdLottery lottery, TaLotteryResult lotteryResult) {
39
+        QueryWrapper<TaCustomerBetting> queryWrapper = new QueryWrapper<>();
40
+        queryWrapper.eq("lottery_id", lottery.getLotteryId());
41
+        queryWrapper.eq("issue_no", lotteryResult.getIssueNo());
42
+        queryWrapper.eq("is_open", false);
43
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
44
+
45
+        List<TaCustomerBetting> list = list(queryWrapper);
46
+        if (null != list && list.size() > 0) {
47
+            for (TaCustomerBetting betting : list) {
48
+                if (lottery.getIsSport()) {
49
+                    betting.setBettingSports(getBettingSportByBetting(betting));
50
+                }
51
+                betting.setItemList(getBettingItemByBetting(betting));
52
+                betting.setBettingPlan(iTaBettingPlanService.getDetailOfPlanById(betting.getPlanId()));
53
+            }
54
+        }
55
+
56
+        return list;
57
+    }
58
+
59
+    private List<TaCustomerBettingSport> getBettingSportByBetting(TaCustomerBetting betting) {
60
+        QueryWrapper<TaCustomerBettingSport> queryWrapper = new QueryWrapper<>();
61
+        queryWrapper.eq("betting_id", betting.getBettingId());
62
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
63
+        queryWrapper.orderByAsc("serial_no");
64
+
65
+        return taCustomerBettingSportMapper.selectList(queryWrapper);
66
+    }
67
+
68
+    private List<TaCustomerBettingItem> getBettingItemByBetting(TaCustomerBetting betting) {
69
+        QueryWrapper<TaCustomerBettingItem> queryWrapper = new QueryWrapper<>();
70
+        queryWrapper.eq("betting_id", betting.getBettingId());
71
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
72
+        queryWrapper.orderByAsc("item_no");
73
+
74
+        return taCustomerBettingItemMapper.selectList(queryWrapper);
75
+    }
76
+}

+ 32
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaCustomerBettingSportServiceImpl.java 查看文件

@@ -0,0 +1,32 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.service.ITaCustomerBettingSportService;
6
+import com.xiaoniu.niucai.entity.TaCustomerBettingSport;
7
+import com.xiaoniu.niucai.mapper.TaCustomerBettingSportMapper;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 客户投注竞彩明细  服务实现类
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-09-09
19
+ */
20
+@Service
21
+public class TaCustomerBettingSportServiceImpl extends ServiceImpl<TaCustomerBettingSportMapper, TaCustomerBettingSport> implements ITaCustomerBettingSportService {
22
+
23
+    @Override
24
+    public List<TaCustomerBettingSport> getListByBetting(Integer bettingId, Integer itemNo) throws Exception {
25
+        QueryWrapper<TaCustomerBettingSport> queryWrapper = new QueryWrapper<>();
26
+        queryWrapper.eq("betting_id", bettingId);
27
+        queryWrapper.eq("item_no", itemNo);
28
+        queryWrapper.orderByAsc("create_date");
29
+
30
+        return list(queryWrapper);
31
+    }
32
+}

+ 354
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaLotteryResultServiceImpl.java 查看文件

@@ -0,0 +1,354 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.common.BizUtils;
6
+import com.xiaoniu.niucai.common.DateUtils;
7
+import com.xiaoniu.niucai.common.StringUtils;
8
+import com.xiaoniu.niucai.entity.*;
9
+import com.xiaoniu.niucai.enums.StatusEnum;
10
+import com.xiaoniu.niucai.mapper.TaLotteryResultMapper;
11
+import com.xiaoniu.niucai.service.*;
12
+import com.xiaoniu.niucai.mapper.TaLotteryResultDetailMapper;
13
+import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.stereotype.Service;
16
+import org.springframework.transaction.annotation.Transactional;
17
+
18
+import java.time.LocalDateTime;
19
+import java.time.format.DateTimeFormatter;
20
+import java.util.Arrays;
21
+import java.util.List;
22
+
23
+/**
24
+ * <p>
25
+ * 数字彩开奖结果  服务实现类
26
+ * </p>
27
+ *
28
+ * @author admin
29
+ * @since 2020-08-27
30
+ */
31
+@Slf4j
32
+@Service
33
+public class TaLotteryResultServiceImpl extends ServiceImpl<TaLotteryResultMapper, TaLotteryResult> implements ITaLotteryResultService {
34
+
35
+    @Autowired
36
+    ITdLotteryOnSaleService iTdLotteryOnSaleService;
37
+
38
+    @Autowired
39
+    ITdLotteryService iTdLotteryService;
40
+
41
+    @Autowired
42
+    ITdLotteryPrizeService iTdLotteryPrizeService;
43
+
44
+    @Autowired
45
+    ITaCustomerBettingService iTaCustomerBettingService;
46
+
47
+    @Autowired
48
+    ITaCustomerBettingItemService iTaCustomerBettingItemService;
49
+
50
+    @Autowired
51
+    TaLotteryResultDetailMapper taLotteryResultDetailMapper;
52
+
53
+    @Override
54
+    @Transactional(rollbackFor = Exception.class)
55
+    public void checkAndSetLotteryPrize() throws Exception {
56
+        LocalDateTime now = LocalDateTime.now();
57
+        String today = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
58
+        int weekDay = now.getDayOfWeek().getValue();
59
+        List<TdLotteryOnSale> onSaleList = iTdLotteryOnSaleService.getByWeekDay(weekDay);
60
+        if (null == onSaleList || onSaleList.size() == 0) {
61
+            log.info(today + "未找到有开售设置");
62
+            return;
63
+        }
64
+
65
+        for (TdLotteryOnSale onSale : onSaleList) {
66
+            String lotteryId = onSale.getLotteryId();
67
+            log.info(String.format("彩种 %s %s 开奖, 开始检测中奖人员", lotteryId, today));
68
+
69
+            // 彩种字典
70
+            TdLottery lottery = iTdLotteryService.getById(lotteryId);
71
+
72
+            // 中奖设置
73
+            List<TdLotteryPrize> prizeSettings = iTdLotteryPrizeService.getByLottery(lottery);
74
+            if (null == prizeSettings || prizeSettings.size() == 0) {
75
+                log.error(String.format("彩种 %s 没有开奖相关设置", lotteryId));
76
+                continue;
77
+            }
78
+
79
+            // 当前彩种的开奖结果
80
+            TaLotteryResult lotteryResult = getLotteryResultBy(onSale.getLotteryId(), today);
81
+            if (null == lotteryResult) {
82
+                log.error(String.format("彩种 %s 未抓取到开奖结果", lotteryId));
83
+                continue;
84
+            }
85
+
86
+            if (null == lotteryResult.getDetailList() || lotteryResult.getDetailList().size() == 0) {
87
+                log.error(String.format("彩种 %s 未抓取到开奖明细结果", lotteryId));
88
+                continue;
89
+            }
90
+
91
+            // 当前彩种的投注列表
92
+            List<TaCustomerBetting> customerBettingList = iTaCustomerBettingService.getAllUnOpenBettingsBy(lottery, lotteryResult);
93
+            if (null == customerBettingList || customerBettingList.size() == 0) {
94
+                log.info(String.format("彩种 %s 本期无人投注", lotteryId));
95
+                continue;
96
+            }
97
+
98
+            // 遍历校验中奖情况
99
+            for (TaCustomerBetting customerBetting : customerBettingList) {
100
+                try {
101
+                    if (lottery.getIsDigit()) {
102
+                        validLotteryCustomer(lottery, prizeSettings, lotteryResult, customerBetting);
103
+                    }
104
+                } catch (Exception e) {
105
+                    e.printStackTrace();
106
+                    // continue;
107
+                }
108
+            }
109
+        }
110
+    }
111
+
112
+    public TaLotteryResult getLotteryResultBy(String lotteryId, String openingDate) {
113
+        QueryWrapper<TaLotteryResult> queryWrapper = new QueryWrapper<>();
114
+        queryWrapper.eq("lottery_id", lotteryId);
115
+        queryWrapper.eq("opening_date", openingDate);
116
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
117
+
118
+        TaLotteryResult result = getOne(queryWrapper);
119
+        if (null != result) {
120
+            QueryWrapper<TaLotteryResultDetail> query2 = new QueryWrapper<>();
121
+            query2.eq("result_no", result.getSerialNo());
122
+            query2.eq("status", StatusEnum.NORMAL.getCode());
123
+            query2.orderByAsc("serial_no");
124
+            result.setDetailList(taLotteryResultDetailMapper.selectList(query2));
125
+        }
126
+
127
+        return result;
128
+    }
129
+
130
+    private void validLotteryCustomer(TdLottery lottery, List<TdLotteryPrize> prizeSettings, TaLotteryResult lotteryResult, TaCustomerBetting customerBetting) throws Exception {
131
+        TaBettingPlan taBettingPlan = customerBetting.getBettingPlan();
132
+        if (null == taBettingPlan) {
133
+            log.error(String.format("ID %s 的投注没有投注方案", customerBetting.getBettingId()));
134
+            return;
135
+        }
136
+
137
+        if (null == taBettingPlan.getItemList() || taBettingPlan.getItemList().size() == 0
138
+                || null == customerBetting.getItemList() || customerBetting.getItemList().size() == 0) {
139
+            log.error(String.format("ID %s 的投注没有投注明细", customerBetting.getBettingId()));
140
+            return;
141
+        }
142
+
143
+        int winTotalCharges = 0;
144
+        for (TaBettingPlanItem item : taBettingPlan.getItemList()) {
145
+            // 是否中奖
146
+            boolean isWinning = false;
147
+            // 中奖金额
148
+            int winAmount = 0;
149
+
150
+            try {
151
+                TaCustomerBettingItem bettingItem = getBettingItemMap(customerBetting.getItemList(), item);
152
+                if (bettingItem == null) {
153
+                    log.error(String.format("ID %s 的投注查询映射投注明细失败", customerBetting.getBettingId()));
154
+                    continue;
155
+                }
156
+
157
+                // 排列三直选, 排列五 都是依靠比对数字位是否一致来决定是否中奖的
158
+                if (lottery.getLotteryId().equals("p5")) {
159
+                    isWinning = BizUtils.checkPrizeNumStrict(lotteryResult.getFirstResult().split(","), item.getFirstNums().split(","));
160
+                    if (isWinning) {
161
+                        TaLotteryResultDetail resultDetail = lotteryResult.getDetailList().get(0);
162
+                        if (null == resultDetail) {
163
+                            log.error(String.format("第 %s 期排列五结果明细未抓取", lotteryResult.getIssueNo()));
164
+                            continue;
165
+                        }
166
+
167
+                        winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
168
+                    }
169
+                } else if (lottery.getLotteryId().equals("p3")) {
170
+                    String[] bingoNums = lotteryResult.getFirstResult().split(",");
171
+                    if (bingoNums.length != 3) {
172
+                        log.error(String.format("第 %s 期排列三抓取结果不正确", lotteryResult.getIssueNo()));
173
+                        continue;
174
+                    }
175
+
176
+                    String level = "直选";
177
+                    if ("组选3".equals(item.getPlayWay())) {
178
+                        level = "组三";
179
+                    } else if ("组选6".equals(item.getPlayWay())) {
180
+                        level = "组六";
181
+                    }
182
+
183
+                    TaLotteryResultDetail resultDetail = filterResultDetail(lotteryResult.getDetailList(), level);
184
+                    if (null == resultDetail) {
185
+                        log.error(String.format("第 %s 期排列三结果明细未抓取", lotteryResult.getIssueNo()));
186
+                        continue;
187
+                    }
188
+
189
+                    // 直选是通过比对数字来校验中奖
190
+                    if ("直选".equals(level)) {
191
+                        isWinning = BizUtils.checkPrizeNumStrict(bingoNums, item.getFirstNums().split(","));
192
+                        if (isWinning) {
193
+                            winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
194
+                        }
195
+                    } else {
196
+                        // 出现2次的号码
197
+                        boolean hasTwiceNum = bingoNums[0].equals(bingoNums[1])
198
+                                || bingoNums[0].equals(bingoNums[2])
199
+                                || bingoNums[1].equals(bingoNums[2]);
200
+
201
+                        // 如果存在出现2次的号码, 只有可能中组选三, 否则只有可能中组选6
202
+                        if (!hasTwiceNum) {
203
+                            if ("组六".equals(level)) {
204
+                                isWinning = item.getFirstNums().contains(bingoNums[0])
205
+                                        && item.getFirstNums().contains(bingoNums[1])
206
+                                        && item.getFirstNums().contains(bingoNums[2]);
207
+                                if (isWinning) {
208
+                                    winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
209
+                                }
210
+                            }
211
+                        } else {
212
+                            if ("组三".equals(level)) {
213
+                                // 如果是复式
214
+                                if (item.getIsMulti()) {
215
+                                    isWinning = item.getFirstNums().contains(bingoNums[0])
216
+                                            && item.getFirstNums().contains(bingoNums[1])
217
+                                            && item.getFirstNums().contains(bingoNums[2]);
218
+                                    if (isWinning) {
219
+                                        winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
220
+                                    }
221
+                                } else {
222
+                                    // 投注号
223
+                                    String[] buyNums = item.getFirstNums().split(",");
224
+                                    // 由小到大排序
225
+                                    Arrays.sort(bingoNums);
226
+                                    Arrays.sort(buyNums);
227
+
228
+                                    isWinning = BizUtils.checkPrizeNumStrict(bingoNums, buyNums);
229
+                                    if (isWinning) {
230
+                                        winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
231
+                                    }
232
+                                }
233
+                            }
234
+                        }
235
+                    }
236
+
237
+                } else {
238
+                    // 大乐透  双色球
239
+                    String firstNums = item.getFirstNums();
240
+                    if (StringUtils.isEmpty(firstNums)) {
241
+                        log.error(String.format("ID %s 的投注明细无前区内容", customerBetting.getBettingId()));
242
+                        continue;
243
+                    }
244
+
245
+                    String firstDanNums = item.getFirstDan();
246
+                    if (StringUtils.isEmpty(firstDanNums)) {
247
+                        firstDanNums = "";
248
+                    }
249
+
250
+                    // 前区中奖数
251
+                    int firstSameNums = BizUtils.getSameNums(
252
+                            lotteryResult.getFirstResult().split(","),
253
+                            firstNums.split(","),
254
+                            firstDanNums.split(",")
255
+                    );
256
+
257
+                    String secondNums = item.getFirstNums();
258
+                    if (StringUtils.isEmpty(secondNums)) {
259
+                        log.error(String.format("ID %s 的投注明细无后区内容", customerBetting.getBettingId()));
260
+                        continue;
261
+                    }
262
+
263
+                    String secondDanNums = item.getFirstDan();
264
+                    if (StringUtils.isEmpty(secondDanNums)) {
265
+                        secondDanNums = "";
266
+                    }
267
+
268
+                    // 后区中奖数
269
+                    int secondSameNums = BizUtils.getSameNums(
270
+                            lotteryResult.getSecondResult().split(","),
271
+                            secondNums.split(","),
272
+                            secondDanNums.split(","));
273
+
274
+                    // 选择结果
275
+                    String curNums = String.format("%d-%d", firstSameNums, secondSameNums);
276
+
277
+                    boolean needContinue = false;
278
+                    TdLotteryPrize bingo = null;
279
+                    for(TdLotteryPrize prize : prizeSettings) {
280
+                        if (StringUtils.isEmpty(prize.getBingoRule())) {
281
+                            log.error(String.format("彩种 %s 的中奖结果规则未维护", lottery.getLotteryId()));
282
+                            needContinue = true;
283
+                            break;
284
+                        }
285
+
286
+                        if (prize.getBingoRule().contains(curNums)) {
287
+                            bingo = prize;
288
+                            break;
289
+                        }
290
+                    }
291
+
292
+                    if (needContinue) {
293
+                        continue;
294
+                    }
295
+
296
+                    if (null != bingo) {
297
+                        log.info(String.format("恭喜 %s 购买 %s 中了 %s", customerBetting.getCustomerId(), lottery.getLotteryId(), bingo.getLevel()));
298
+                        isWinning = true;
299
+                        bettingItem.setWinLevel(bingo.getLevel());
300
+                        TaLotteryResultDetail resultDetail = filterResultDetail(lotteryResult.getDetailList(), bingo.getLevel());
301
+                        if (null == resultDetail) {
302
+                            log.error(String.format("彩种 %s 的中奖结果明细未成功抓取", lottery.getLotteryId()));
303
+                            continue;
304
+                        }
305
+
306
+                        winAmount = Math.round(Float.parseFloat(resultDetail.getMoney()) * 100);
307
+                        // 是否追加
308
+                        boolean isAdd = customerBetting.getIsAdd();
309
+                        if (isAdd && !StringUtils.isEmpty(resultDetail.getXMoney())) {
310
+                            winAmount += Math.round(Float.parseFloat(resultDetail.getXMoney()) * 100);
311
+                        }
312
+                    }
313
+                }
314
+
315
+                winTotalCharges += winAmount;
316
+                bettingItem.setIsOpen(true);
317
+                bettingItem.setOpeningDate(DateUtils.today());
318
+                bettingItem.setIsWinning(isWinning);
319
+                bettingItem.setWinAmount(winAmount);
320
+                iTaCustomerBettingItemService.updateById(bettingItem);
321
+            } catch (Exception e) {
322
+                e.printStackTrace();
323
+                continue;
324
+            }
325
+        }
326
+
327
+        if (winTotalCharges > 0) {
328
+            customerBetting.setIsWinning(true);
329
+            customerBetting.setWinAmount(winTotalCharges * customerBetting.getBettingTimes());
330
+        }
331
+        customerBetting.setIsOpen(true);
332
+        customerBetting.setOpeningDate(DateUtils.today());
333
+        iTaCustomerBettingService.updateById(customerBetting);
334
+    }
335
+
336
+    private TaLotteryResultDetail filterResultDetail(List<TaLotteryResultDetail> detailList, String level) {
337
+        for (TaLotteryResultDetail d: detailList) {
338
+            if (d.getLevel().equals(level)) {
339
+                return d;
340
+            }
341
+        }
342
+
343
+        return null;
344
+    }
345
+
346
+    private TaCustomerBettingItem getBettingItemMap(List<TaCustomerBettingItem> bettingItemList, TaBettingPlanItem item) {
347
+        for (TaCustomerBettingItem it : bettingItemList) {
348
+            if (item.getItemNo().equals(it.getPlanItemNo())) {
349
+                return it;
350
+            }
351
+        }
352
+        return null;
353
+    }
354
+}

+ 33
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaMatchOddsServiceImpl.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.service.ITaMatchOddsService;
6
+import com.xiaoniu.niucai.entity.TaMatchOdds;
7
+import com.xiaoniu.niucai.mapper.TaMatchOddsMapper;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+/**
12
+ * <p>
13
+ * 赔率 服务实现类
14
+ * </p>
15
+ *
16
+ * @author admin
17
+ * @since 2020-09-02
18
+ */
19
+@Service
20
+public class TaMatchOddsServiceImpl extends ServiceImpl<TaMatchOddsMapper, TaMatchOdds> implements ITaMatchOddsService {
21
+
22
+    @Autowired
23
+    TaMatchOddsMapper taMatchOddsMapper;
24
+
25
+    @Override
26
+    public TaMatchOdds getByRule(Integer matchId, String ruleCode) {
27
+        QueryWrapper<TaMatchOdds> queryWrapper = new QueryWrapper<>();
28
+        queryWrapper.eq("match_id", matchId);
29
+        queryWrapper.eq("rule_code", ruleCode);
30
+
31
+        return getOne(queryWrapper);
32
+    }
33
+}

+ 287
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaMatchServiceImpl.java 查看文件

@@ -0,0 +1,287 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.common.BizUtils;
6
+import com.xiaoniu.niucai.common.DateUtils;
7
+import com.xiaoniu.niucai.entity.*;
8
+import com.xiaoniu.niucai.enums.SportOpeningStatusEnum;
9
+import com.xiaoniu.niucai.mapper.TaCustomerBettingMapper;
10
+import com.xiaoniu.niucai.service.*;
11
+import com.xiaoniu.niucai.mapper.TaMatchMapper;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Propagation;
15
+import org.springframework.transaction.annotation.Transactional;
16
+
17
+import java.util.ArrayList;
18
+import java.util.List;
19
+
20
+/**
21
+ * <p>
22
+ * 比赛  服务实现类
23
+ * </p>
24
+ *
25
+ * @author admin
26
+ * @since 2020-09-02
27
+ */
28
+@Service
29
+public class TaMatchServiceImpl extends ServiceImpl<TaMatchMapper, TaMatch> implements ITaMatchService {
30
+    @Autowired
31
+    ITaCustomerBettingItemService iTaCustomerBettingItemService;
32
+
33
+    @Autowired
34
+    ITaCustomerBettingSportService iTaCustomerBettingSportService;
35
+
36
+    @Autowired
37
+    ITdSportPassService iTdSportPassService;
38
+
39
+    @Autowired
40
+    ITaBettingPlanService iTaBettingPlanService;
41
+
42
+    @Autowired
43
+    ITaMatchOddsService iTaMatchOddsService;
44
+
45
+    @Autowired
46
+    ITaCustomerBettingService iTaCustomerBettingService;
47
+
48
+    @Autowired
49
+    TaMatchMapper taMatchMapper;
50
+
51
+    @Autowired
52
+    TaCustomerBettingMapper taCustomerBettingMapper;
53
+
54
+    @Override
55
+    public void checkAndSetSportPrize() throws Exception {
56
+        List<TaMatch> matchList = taMatchMapper.getLastOpenAndUndoMatch(3);
57
+        if (null == matchList || matchList.size() == 0) {
58
+            return;
59
+        }
60
+
61
+        for (TaMatch taMatch : matchList) {
62
+            try {
63
+                taMatch.setOpeningStatus(SportOpeningStatusEnum.DOING.getCode());
64
+                updateById(taMatch);
65
+                validateMatch(taMatch);
66
+            } catch (Exception e) {
67
+                // TODO 比如错误日志记录
68
+                taMatch.setOpeningStatus(SportOpeningStatusEnum.READY.getCode());
69
+                updateById(taMatch);
70
+            }
71
+        }
72
+    }
73
+
74
+    /**
75
+     * 校验比赛
76
+     * @param taMatch
77
+     * @throws Exception
78
+     */
79
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
80
+    private void validateMatch (TaMatch taMatch) throws Exception {
81
+        // 获取当前比赛的投注列表
82
+        List<TaCustomerBettingItem> bettingItemList = iTaCustomerBettingItemService.getByMatch(taMatch);
83
+        if (null == bettingItemList || bettingItemList.size() == 0) {
84
+            return;
85
+        }
86
+
87
+        for (TaCustomerBettingItem item: bettingItemList) {
88
+            if (!SportOpeningStatusEnum.READY.getCode().equals(item.getOpeningStatus())) {
89
+                continue;
90
+            }
91
+
92
+            // 通过明细反向查询主记录
93
+            // 但是主记录包含的明细不止当前这条
94
+            TaCustomerBetting betting = iTaCustomerBettingService.getById(item.getBettingId());
95
+            // 投注列表
96
+            List<TaCustomerBettingSport> bettingSportList = iTaCustomerBettingSportService.getListByBetting(item.getBettingId(), item.getItemNo());
97
+            // 判断是否中奖
98
+            for (TaCustomerBettingSport bettingSport : bettingSportList) {
99
+                boolean wining = isWining(taMatch, bettingSport);
100
+                if (wining) {
101
+                    bettingSport.setIsWinning(wining);
102
+                    iTaCustomerBettingSportService.updateById(bettingSport);
103
+                }
104
+            }
105
+
106
+            item.setOpeningStatus(SportOpeningStatusEnum.FINISHED.getCode());
107
+            item.setSportList(bettingSportList);
108
+
109
+            // 验证当前明细对应的主记录的所有明细是否都已经处理了
110
+            checkAndSetBetting(betting, item);
111
+        }
112
+    }
113
+
114
+    /**
115
+     * 校验投注
116
+     * @param betting
117
+     * @param item
118
+     * @throws Exception
119
+     */
120
+    private void checkAndSetBetting(TaCustomerBetting betting, TaCustomerBettingItem item) throws Exception {
121
+        List<TaCustomerBettingItem> itemList = iTaCustomerBettingItemService.getByBetting(betting);
122
+        if (null == itemList || itemList.size() == 0) {
123
+            throw new Exception(String.format("投注[%s]没有找到任何投注明细", betting.getBettingId()));
124
+        }
125
+
126
+        boolean done = true;
127
+        boolean existWinningRec = false;
128
+        for (int i = 0; i < itemList.size(); i++) {
129
+            TaCustomerBettingItem bettingItem = itemList.get(0);
130
+            if (bettingItem.getItemNo().equals(item.getItemNo())) {
131
+                itemList.set(i, item);
132
+
133
+                if (item.getIsWinning()) {
134
+                    existWinningRec = true;
135
+                }
136
+
137
+                continue;
138
+            }
139
+
140
+            if (bettingItem.getIsWinning()) {
141
+                existWinningRec = true;
142
+            }
143
+
144
+            // 如果还有未处理完成的, 跳出循环
145
+            if (!SportOpeningStatusEnum.FINISHED.getCode().equals(bettingItem.getOpeningStatus())) {
146
+                done = false;
147
+                break;
148
+            }
149
+        }
150
+
151
+        // 如果还有场次没有结束, 那么不去算最终奖金
152
+        if (!done) {
153
+            return;
154
+        }
155
+
156
+        // 所有奖都开了
157
+        betting.setIsOpen(true);
158
+        betting.setOpeningDate(DateUtils.today());
159
+        UpdateWrapper<TaCustomerBetting> updateWrapper = new UpdateWrapper<>();
160
+        updateWrapper.set("is_open", betting.getIsOpen());
161
+        updateWrapper.set("opening_date", betting.getOpeningDate());
162
+        updateWrapper.eq("betting_id", betting.getBettingId());
163
+        taCustomerBettingMapper.update(betting, updateWrapper);
164
+
165
+        // 如果一场都没中, 直接 pass
166
+        if (!existWinningRec) {
167
+            return;
168
+        }
169
+
170
+        // 投注方案
171
+        TaBettingPlan bettingPlan = iTaBettingPlanService.getById(betting.getPlanId());
172
+        if (null == bettingPlan) {
173
+            throw new Exception("校验投注方案失败");
174
+        }
175
+        betting.setBettingPlan(bettingPlan);
176
+
177
+        // 结算最终奖金
178
+        computePirzeAmount(betting, itemList);
179
+    }
180
+
181
+    /**
182
+     * 结算最终奖金
183
+     * 主要思路:
184
+     * 1、先把所有场次组合一个数组, 其实就是 itemList
185
+     * 2、依据所选的玩法, 把所有的玩法都组合出来, 比如4串5, 那么用场次把所有组合都穷举出来
186
+     * 3、遍历所有组合, 计算每种组合的中奖金额
187
+     * @param betting
188
+     * @param itemList
189
+     * @throws Exception
190
+     */
191
+    private void computePirzeAmount(TaCustomerBetting betting, List<TaCustomerBettingItem> itemList) throws Exception {
192
+        // 参与算法的数据结构是一个两层List
193
+        // List<                场次, 也就是最外层的 size == 场次数
194
+        //      List<           投注名称, 内层的 size == 每场投注数
195
+        //          String>>    当前投注的打单赔率, 不是投注赔率
196
+        List<List<String>> noteList = new ArrayList<>();
197
+
198
+        // 获取每个场次的玩法投注列表
199
+        for (TaCustomerBettingItem item : itemList) {
200
+            List<TaCustomerBettingSport> sportList = item.getSportList();
201
+
202
+            if (null == sportList || sportList.size() == 0) {
203
+                sportList = iTaCustomerBettingSportService.getListByBetting(betting.getBettingId(), item.getItemNo());
204
+                if (null == sportList || sportList.size() == 0) {
205
+                    continue;
206
+                }
207
+            }
208
+
209
+            // 只有中奖的投注才会参与计算
210
+            List<String> oddsOfNote = new ArrayList<>();
211
+            for (TaCustomerBettingSport sportItem : sportList) {
212
+                if (sportItem.getIsWinning()) {
213
+                    oddsOfNote.add(sportItem.getOddsDrawn());
214
+                } else {
215
+                    // 未中奖的赔率是 0
216
+                    oddsOfNote.add("0");
217
+                }
218
+            }
219
+
220
+            noteList.add(oddsOfNote);
221
+        }
222
+
223
+        // 玩法字典
224
+        if (null == betting.getBettingPlan().getPassCode()) {
225
+            throw new Exception("校验过关模式失败");
226
+        }
227
+        TdSportPass tdSportPass = iTdSportPassService.getById(betting.getBettingPlan().getPassCode());
228
+        if (null == tdSportPass) {
229
+            throw new Exception("校验过关模式失败");
230
+        }
231
+
232
+        List<List<List<String>>> mockCombList = BizUtils.mockAllCombination(noteList, tdSportPass);
233
+
234
+        // 计算方法:  https://www.lottery.gov.cn/bzzx/yxgz/20191119/1273604.html
235
+        float totalCharge = 0.0f;
236
+        for (List<List<String>> notes : mockCombList) {
237
+
238
+            // 多种可能的结果会直接相加
239
+            float perCombCharge = 0.0f;
240
+            for (List<String> oddsList : notes) {
241
+
242
+                // 比如购买的 3串4
243
+                // 3串4的金额是 2串1 + 2串1 + 2串1 + 3串1
244
+                float perNoteCharge = 0.0f;
245
+                for (String oddsStr : oddsList) {
246
+
247
+                    // 比如2串1
248
+                    // 2串1的金额是  第一场比赛赔率*第二次比赛赔率
249
+                    // 依次类推, 如果是 3串1 则是3场相乘
250
+                    float odds = Float.parseFloat(oddsStr);
251
+
252
+                    // 此处判断是否第一次循环, float 不能用 == 判断
253
+                    if (perNoteCharge < 0.01f) {
254
+                        perNoteCharge = odds;
255
+                    } else {
256
+                        perNoteCharge += odds;
257
+                    }
258
+                }
259
+
260
+                perCombCharge += perNoteCharge;
261
+            }
262
+
263
+            // 金额 = 2块(200分) * 赔率 * 投注倍数
264
+            totalCharge += 200 * perCombCharge * betting.getBettingTimes();
265
+        }
266
+
267
+        // 如果没有中奖
268
+        if (totalCharge < 0.01f) {
269
+            return;
270
+        }
271
+
272
+        betting.setIsWinning(true);
273
+        betting.setWinAmount((int) totalCharge);
274
+        UpdateWrapper<TaCustomerBetting> updateWrapper = new UpdateWrapper<>();
275
+        updateWrapper.set("is_winning", betting.getIsWinning());
276
+        updateWrapper.set("win_amount", betting.getWinAmount());
277
+        updateWrapper.eq("betting_id", betting.getBettingId());
278
+        taCustomerBettingMapper.update(betting, updateWrapper);
279
+
280
+        // TODO 发送通知
281
+    }
282
+
283
+    private boolean isWining(TaMatch taMatch, TaCustomerBettingSport bettingSport) {
284
+        TaMatchOdds taMatchOdds = iTaMatchOddsService.getByRule(taMatch.getMatchId(), bettingSport.getRuleCode());
285
+        return null != taMatchOdds && taMatchOdds.getIsWinning();
286
+    }
287
+}

+ 19
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TaOrderServiceImpl.java 查看文件

@@ -0,0 +1,19 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.xiaoniu.niucai.entity.TaOrder;
5
+import com.xiaoniu.niucai.mapper.TaOrderMapper;
6
+import com.xiaoniu.niucai.service.ITaOrderService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 订单主表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author admin
15
+ * @since 2020-09-09
16
+ */
17
+@Service
18
+public class TaOrderServiceImpl extends ServiceImpl<TaOrderMapper, TaOrder> implements ITaOrderService {
19
+}

+ 33
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryOnSaleServiceImpl.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.entity.TdLotteryOnSale;
6
+import com.xiaoniu.niucai.enums.StatusEnum;
7
+import com.xiaoniu.niucai.mapper.TdLotteryOnSaleMapper;
8
+import com.xiaoniu.niucai.service.ITdLotteryOnSaleService;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * <p>
15
+ * 彩种销售时间 服务实现类
16
+ * </p>
17
+ *
18
+ * @author admin
19
+ * @since 2020-09-11
20
+ */
21
+@Service
22
+public class TdLotteryOnSaleServiceImpl extends ServiceImpl<TdLotteryOnSaleMapper, TdLotteryOnSale> implements ITdLotteryOnSaleService {
23
+
24
+    @Override
25
+    public List<TdLotteryOnSale> getByWeekDay(int weekDay) {
26
+        QueryWrapper<TdLotteryOnSale> queryWrapper = new QueryWrapper<>();
27
+        queryWrapper.eq("week_day", weekDay);
28
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
29
+        queryWrapper.orderByAsc("serial_no");
30
+
31
+        return list(queryWrapper);
32
+    }
33
+}

+ 33
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryPrizeServiceImpl.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.xiaoniu.niucai.entity.TdLottery;
6
+import com.xiaoniu.niucai.entity.TdLotteryPrize;
7
+import com.xiaoniu.niucai.enums.StatusEnum;
8
+import com.xiaoniu.niucai.mapper.TdLotteryPrizeMapper;
9
+import com.xiaoniu.niucai.service.ITdLotteryPrizeService;
10
+import org.springframework.stereotype.Service;
11
+
12
+import java.util.List;
13
+
14
+/**
15
+ * <p>
16
+ * 彩种中奖设置  服务实现类
17
+ * </p>
18
+ *
19
+ * @author admin
20
+ * @since 2020-09-07
21
+ */
22
+@Service
23
+public class TdLotteryPrizeServiceImpl extends ServiceImpl<TdLotteryPrizeMapper, TdLotteryPrize> implements ITdLotteryPrizeService {
24
+    @Override
25
+    public List<TdLotteryPrize> getByLottery(TdLottery lottery) {
26
+        QueryWrapper<TdLotteryPrize> queryWrapper = new QueryWrapper<>();
27
+        queryWrapper.eq("lottery_id", lottery.getLotteryId());
28
+        queryWrapper.eq("status", StatusEnum.NORMAL.getCode());
29
+        queryWrapper.orderByAsc("serial_no");
30
+
31
+        return list(queryWrapper);
32
+    }
33
+}

+ 29
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TdLotteryServiceImpl.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.xiaoniu.niucai.entity.TdLottery;
5
+import com.xiaoniu.niucai.mapper.TdLotteryMapper;
6
+import com.xiaoniu.niucai.service.ITdLotteryOnSaleService;
7
+import com.xiaoniu.niucai.service.ITdLotteryService;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+
12
+/**
13
+ * <p>
14
+ * 彩种 服务实现类
15
+ * </p>
16
+ *
17
+ * @author admin
18
+ * @since 2020-08-27
19
+ */
20
+@Service
21
+public class TdLotteryServiceImpl extends ServiceImpl<TdLotteryMapper, TdLottery> implements ITdLotteryService {
22
+
23
+    @Autowired
24
+    ITdLotteryOnSaleService iTdLotteryOnSaleService;
25
+
26
+    @Autowired
27
+    TdLotteryMapper tdLotteryMapper;
28
+
29
+}

+ 25
- 0
src/main/java/com/xiaoniu/niucai/service/impl/TdSportPassServiceImpl.java 查看文件

@@ -0,0 +1,25 @@
1
+package com.xiaoniu.niucai.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.xiaoniu.niucai.entity.TdSportPass;
5
+import com.xiaoniu.niucai.mapper.TdSportPassMapper;
6
+import com.xiaoniu.niucai.service.ITdSportPassService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 闯关字典 服务实现类
12
+ * </p>
13
+ *
14
+ * @author admin
15
+ * @since 2020-09-02
16
+ */
17
+@Service
18
+public class TdSportPassServiceImpl extends ServiceImpl<TdSportPassMapper, TdSportPass> implements ITdSportPassService {
19
+
20
+    /**
21
+     * 单关编码
22
+     */
23
+    public final static String SINGLE_PASS_CODE = "1*1";
24
+
25
+}

+ 41
- 0
src/main/java/com/xiaoniu/niucai/task/Lottery.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.xiaoniu.niucai.task;
2
+
3
+import com.xiaoniu.niucai.service.ITaMatchService;
4
+import com.xiaoniu.niucai.service.ITaLotteryResultService;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.scheduling.annotation.Scheduled;
8
+import org.springframework.stereotype.Component;
9
+
10
+@Slf4j
11
+@Component
12
+public class Lottery {
13
+
14
+    @Autowired
15
+    ITaLotteryResultService iTaLotteryResultService;
16
+
17
+    @Autowired
18
+    ITaMatchService iTaMatchService;
19
+
20
+    /**
21
+     * 开奖轮询
22
+     */
23
+    @Scheduled(cron = "* 0/3 * * * ? ")
24
+    public void lotteryOpenCheck() {
25
+        // 数字彩
26
+        try {
27
+            iTaLotteryResultService.checkAndSetLotteryPrize();
28
+        } catch (Exception e) {
29
+            e.printStackTrace();
30
+            log.error("校验数字彩开奖结果错误: {}", e.getMessage());
31
+        }
32
+
33
+        // 体彩
34
+        try {
35
+            iTaMatchService.checkAndSetSportPrize();
36
+        } catch (Exception e) {
37
+            e.printStackTrace();
38
+            log.error("校验体彩开奖结果错误: {}", e.getMessage());
39
+        }
40
+    }
41
+}

+ 36
- 0
src/main/java/com/xiaoniu/niucai/task/Order.java 查看文件

@@ -0,0 +1,36 @@
1
+package com.xiaoniu.niucai.task;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.xiaoniu.niucai.entity.TaOrder;
5
+import com.xiaoniu.niucai.service.ITaOrderService;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.scheduling.annotation.Scheduled;
8
+import org.springframework.stereotype.Component;
9
+
10
+import java.time.LocalDateTime;
11
+import java.util.List;
12
+
13
+@Component
14
+public class Order {
15
+
16
+    private final static Integer ORDER_PAYING = 2;
17
+    private final static Integer ORDER_UNPAY = 0;
18
+
19
+    @Autowired
20
+    private ITaOrderService taOrderService;
21
+
22
+    /**
23
+     * 改变支付中的状态为有效状态
24
+     */
25
+    @Scheduled(cron = "* 0/30 * * * ? ")
26
+    public void changeOrderStatus(){
27
+        QueryWrapper<TaOrder> taOrderQueryWrapper = new QueryWrapper<>();
28
+        taOrderQueryWrapper.eq("pay_status", ORDER_PAYING);
29
+        taOrderQueryWrapper.gt("update_date", LocalDateTime.now().plusMinutes(30));
30
+        List<TaOrder> list = taOrderService.list(taOrderQueryWrapper);
31
+        if (list.size() > 0){
32
+            list.forEach(e -> e.setPayStatus(ORDER_UNPAY));
33
+            taOrderService.updateBatchById(list);
34
+        }
35
+    }
36
+}

+ 15
- 0
src/main/resources/application.yml 查看文件

@@ -0,0 +1,15 @@
1
+server:
2
+  port: 8099
3
+  servlet:
4
+    context-path: /api
5
+
6
+spring:
7
+  datasource:
8
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/niucai?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
9
+    username: niucai
10
+    password: 1qaz#EDC
11
+
12
+###
13
+logging:
14
+  level:
15
+    root: info

+ 5
- 0
src/main/resources/mapper/TaBettingPlanItemMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaBettingPlanItemMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaBettingPlanMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaBettingPlanMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaBettingPlanSportDetailMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaBettingPlanSportDetailMapper">
4
+
5
+</mapper>

+ 17
- 0
src/main/resources/mapper/TaCustomerBettingItemMapper.xml 查看文件

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaCustomerBettingItemMapper">
4
+
5
+    <select id="getByMatch" resultType="com.xiaoniu.niucai.entity.TaCustomerBettingItem">
6
+        SELECT
7
+            t.*
8
+        FROM
9
+            ta_customer_betting_item t
10
+        INNER JOIN ta_betting_plan_item s ON t.plan_item_no = s.item_no
11
+        WHERE
12
+            s.match_id = #{matchId}
13
+        <if test="null != openingStatus">
14
+            AND t.opening_status = #{openingStatus}
15
+        </if>
16
+    </select>
17
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaCustomerBettingMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaCustomerBettingMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaCustomerBettingSportMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaCustomerBettingSportMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaLotteryResultDetailMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaLotteryResultDetailMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaLotteryResultMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaLotteryResultMapper">
4
+
5
+</mapper>

+ 17
- 0
src/main/resources/mapper/TaMatchMapper.xml 查看文件

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaMatchMapper">
4
+
5
+    <select id="getLastOpenAndUndoMatch" resultType="com.xiaoniu.niucai.entity.TaMatch">
6
+        SELECT
7
+            *
8
+        FROM
9
+            ta_match t
10
+        WHERE
11
+            t.`status` &gt; 1
12
+            AND t.opening_status = 0
13
+            AND t.match_date >= DATE_FORMAT( CURRENT_DATE - #{days}, '%Y-%m-%d' )
14
+        ORDER BY
15
+            t.match_id ASC
16
+    </select>
17
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaMatchOddsMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaMatchOddsMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaOrderMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaOrderMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaOrderPayMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TaOrderPayMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TdLotteryMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TdLotteryMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TdLotteryOnSaleMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TdLotteryOnSaleMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TdLotteryPrizeMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TdLotteryPrizeMapper">
4
+
5
+</mapper>

+ 5
- 0
src/main/resources/mapper/TdSportPassMapper.xml 查看文件

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xiaoniu.niucai.mapper.TdSportPassMapper">
4
+
5
+</mapper>

+ 13
- 0
src/test/java/com/xiaoniu/niucai/TaskApplicationTests.java 查看文件

@@ -0,0 +1,13 @@
1
+package com.xiaoniu.niucai;
2
+
3
+import org.junit.jupiter.api.Test;
4
+import org.springframework.boot.test.context.SpringBootTest;
5
+
6
+@SpringBootTest
7
+class TaskApplicationTests {
8
+
9
+	@Test
10
+	void contextLoads() {
11
+	}
12
+
13
+}