项目代码

master
xiaolei 6 years ago
parent 2f11430685
commit 2318c0dd14

@ -0,0 +1,25 @@
/target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

Binary file not shown.

@ -0,0 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

286
后端/ball/mvnw vendored

@ -0,0 +1,286 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
wget "$jarUrl" -O "$wrapperJarPath"
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
curl -o "$wrapperJarPath" "$jarUrl"
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

161
后端/ball/mvnw.cmd vendored

@ -0,0 +1,161 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
echo Found %WRAPPER_JAR%
) else (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
echo Finished downloading %WRAPPER_JAR%
)
@REM End of extension
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>ball</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ball</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.ibeetl/beetl-framework-starter -->
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl-framework-starter</artifactId>
<version>1.1.71.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.example.ball.BallApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<!-- 打包本地jar包 -->
<extdirs>${project.basedir}/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
<!--<resources>-->
<!--<resource>-->
<!--<directory>lib</directory>-->
<!--<targetPath>BOOT-INF/lib/</targetPath>-->
<!--<includes>-->
<!--<include>**/*.jar</include>-->
<!--</includes>-->
<!--</resource>-->
<!--&lt;!&ndash; 某些情况下,打包后运行不起来需要打开注释 &ndash;&gt;-->
<!--<resource>-->
<!--<directory>src/main/resources</directory>-->
<!--<targetPath>BOOT-INF/classes/</targetPath>-->
<!--</resource>-->
<!--</resources>-->
</build>
</project>

@ -0,0 +1,13 @@
package com.example.ball;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BallApplication{
public static void main(String[] args) {
SpringApplication.run(BallApplication.class, args);
}
}

@ -0,0 +1,21 @@
package com.example.ball.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import javax.sql.DataSource;
//数据库连接
@Configuration
public class DataSourceConfig {
@Bean(name = "datasource")
public DataSource datasource(Environment env) {
DruidDataSource ds = new DruidDataSource();
ds.setUrl(env.getProperty("spring.datasource.url"));
ds.setUsername(env.getProperty("spring.datasource.username"));
ds.setPassword(env.getProperty("spring.datasource.password"));
ds.setDriverClassName(env.getProperty("spring.datasource.driver-class-name"));
return ds;
}
}

@ -0,0 +1,20 @@
package com.example.ball.config;
import com.example.ball.config.intercepor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//登录拦截器
@Configuration
public class WebConfigurer implements WebMvcConfigurer {
//这些不会被拦截
private final String[] notLoginInterceptPaths = {"/", "/login/**", "/doLogin/**","/register/**", "/doRegister/**","/image/**"};
@Autowired
private LoginInterceptor loginInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns(notLoginInterceptPaths);
}
}

@ -0,0 +1,28 @@
package com.example.ball.config.intercepor;
import com.example.ball.pojo.User;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@Component
public class LoginInterceptor implements HandlerInterceptor {
//预处理拦截
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
if (user == null){
response.sendRedirect("/login");
return false;
}else {
return true;
}
}
}

@ -0,0 +1,63 @@
package com.example.ball.controller;
import com.example.ball.pojo.Order;
import com.example.ball.pojo.User;
import com.example.ball.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
public class AppointmentController {
@Autowired
private OrderService orderService;
@PostMapping("makeAppointment")
public String makeAppointment(Order order, Model model, HttpSession session){
Map<String,Object> msg = new HashMap<>();
User user = (User) session.getAttribute("user");
model.addAttribute("msg", msg);
try {
order.setUserId(user.getId());
if(orderService.duplicateCheck(order)){
orderService.insert(order);
order.setUserId(null);
long count = orderService.templateCount(order);
msg.put("name","订单提交成功,已预约人数:" + count);
model.addAttribute("redirectPath", "/");
}else {
msg.put("name","订单重复!");
model.addAttribute("redirectPath", "/appointment");
}
} catch (Exception e) {
e.printStackTrace();
msg.put("name","订单提交失败!");
model.addAttribute("redirectPath", "/appointment");
}
return "appointment.html";
}
//问题
@GetMapping("appointment")
public String appointmentView(){
return "appointment.html";
}
//表单日期字符串与Javabean中的data进行转换手动配置
@InitBinder
protected void initBinder(ServletRequestDataBinder binder) {
binder.registerCustomEditor(Date.class,
new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"), true));
}
}

@ -0,0 +1,12 @@
package com.example.ball.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
//问题
@Controller
public class IndexController {
@GetMapping("")
public String index(){
return "index.html";
}
}

@ -0,0 +1,47 @@
package com.example.ball.controller;
import com.example.ball.pojo.Order;
import com.example.ball.pojo.User;
import com.example.ball.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
public class OrderController {
@Autowired
private OrderService orderService;
@GetMapping("currOrder")
public String currOrder(Model model){
Order order = orderService.currOrder();
if(null != order) {
model.addAttribute("order", order);
Order query = new Order();
query.setAppointmentTime(order.getAppointmentTime());
query.setBallType(order.getBallType());
query.setPlace(order.getPlace());
long count = orderService.templateCount(query);
model.addAttribute("count",count);
}
return "currOrder.html";
}
@GetMapping("cancelOrder")
public String cancelOrder(Long id){
orderService.deleteById(id);
return "redirect:/currOrder";
}
//从数据库中取出所有这个用户的历史订单
@GetMapping("orderList")
public String list(HttpSession session,Model model){
User user = (User) session.getAttribute("user");
List<Order> list = orderService.findByUserId(user.getId());
model.addAttribute("orders", list);
return "orderList.html";
}
}

@ -0,0 +1,100 @@
package com.example.ball.controller;
import com.example.ball.pojo.User;
import com.example.ball.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
public class UserController {
@Autowired
private UserService userService;
private Map<String, Object> checkRegisterForm(User user, String repassword){
Map<String, Object> error = new HashMap<>();
if(!repassword.equals(user.getPassword())){
error.put("name", "密码不一致");
}
return error;
}
@PostMapping("doRegister")
public String register(User user, HttpSession session, String repassword, Model model){
Map<String, Object> error = checkRegisterForm(user, repassword);
if(!error.isEmpty()){
model.addAttribute("error",error);
return "register.html";
}
error = userService.registerCheck(user);
if(!error.isEmpty()){
model.addAttribute("error",error);
return "register.html";
}
user = userService.register(user);
session.setAttribute("user", user);
return "redirect:/";
}
@GetMapping("register")
public String registerView(){
return "register.html";
}
@GetMapping("login")
public String loginView(){
return "login.html";
}
@PostMapping("/doLogin")
public String doLogin(String username, String password, Model model, HttpSession session){
Map<String,Object> error = new HashMap<>();
model.addAttribute("error", error);
User user = userService.login(username, password);
if(null == user){
error.put("name", "用户名或密码错误!");
return "login.html";
}
session.setAttribute("user", user);
return "redirect:/";
}
//问题
@PostMapping("doUpdateProfile")
public String doUpdateProfile(HttpSession session, User user,Integer year,Integer month,Integer day){
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR,year);
c.set(Calendar.MONTH,month-1);
c.set(Calendar.DATE, day);
user.setBirthday(c.getTime());
user.setId(((User) session.getAttribute("user")).getId());
session.setAttribute("user", userService.updateTemplate(user));
return "redirect:/profile";
}
//注销
@GetMapping("logout")
public String logout(HttpSession session){
session.removeAttribute("user");
return "redirect:/";
}
@GetMapping("profile")
public String profileView(){
return "profile.html";
}
@GetMapping("updateProfile")
public String updateProfileView(){
return "updateprofile.html";
}
}

@ -0,0 +1,74 @@
package com.example.ball.pojo;
import org.beetl.sql.core.annotatoin.DateTemplate;
import org.beetl.sql.core.annotatoin.TableTemplate;
import java.util.Date;
@TableTemplate("order by created desc ")
public class Order {
private Long id;
private String ballType;
private String place;
private Date appointmentTime;
private Date created;
private Long userId;
private User user;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getBallType() {
return ballType;
}
public void setBallType(String ballType) {
this.ballType = ballType;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
@DateTemplate(accept="appointmentTime,appointmentTime",compare=">=,<=")
public Date getAppointmentTime() {
return appointmentTime;
}
public void setAppointmentTime(Date appointmentTime) {
this.appointmentTime = appointmentTime;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}

@ -0,0 +1,114 @@
package com.example.ball.pojo;
import java.util.Date;
public class User {
private Long id;
private String name;
private String gender;
private String password;
private String phone;
private String email;
private Date birthday;
private String bloodType;
private String fullName;
private String career;
private String graduateInstitution;
private String brief;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getBrief() {
return brief;
}
public void setBrief(String brief) {
this.brief = brief;
}
public String getCareer() {
return career;
}
public void setCareer(String career) {
this.career = career;
}
public String getBloodType() {
return bloodType;
}
public void setBloodType(String bloodType) {
this.bloodType = bloodType;
}
public String getGraduateInstitution() {
return graduateInstitution;
}
public void setGraduateInstitution(String graduateInstitution) {
this.graduateInstitution = graduateInstitution;
}
}

@ -0,0 +1,43 @@
package com.example.ball.service;
import com.example.ball.pojo.Order;
import org.beetl.sql.core.SQLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class OrderService {
@Autowired
private SQLManager sqlManager;
public void insert(Order order){
order.setCreated(new Date());
sqlManager.insert(order);
}
public boolean duplicateCheck(Order order){
List<Order> template = sqlManager.template(order);
return template.isEmpty();
}
public long templateCount(Order order) {
return sqlManager.templateCount(order);
}
public Order currOrder() {
return sqlManager.templateOne(new Order());
}
public void deleteById(Long id) {
sqlManager.deleteById(Order.class, id);
}
public List<Order> findByUserId(Long userId) {
Order query = new Order();
query.setUserId(userId);
return sqlManager.template(query);
}
}

@ -0,0 +1,68 @@
package com.example.ball.service;
import com.example.ball.pojo.User;
import org.beetl.sql.core.SQLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class UserService {
@Autowired
private SQLManager sqlManager;//获得SQLmanager
public Map<String,Object> registerCheck(User user){
Map<String,Object> error = new HashMap<>();
User query;
query = new User();
query.setName(user.getName());
if(sqlManager.templateOne(query) != null){//逐步验证
error.put("name", "用户名已存在!");
}
query = new User();
query.setEmail(user.getEmail());
if(sqlManager.templateOne(query) != null){
error.put("email", "邮箱已存在!");
}
query = new User();
query.setPhone(user.getPhone());
if(sqlManager.templateOne(query) != null){
error.put("name", "手机号已存在!");
}
return error;
}
public User register(User user){
sqlManager.insert(user);
return user;
}
public User login(String username, String password) {
User query = new User();
query.setName(username);
query.setPassword(password);
User user = sqlManager.templateOne(query);//用户名登录
if(user == null){
query.setEmail(null);
query.setName(null);
query.setPhone(username);//手机号登录
}
user = sqlManager.templateOne(query);
if(user == null){
query.setPhone(null);
query.setName(null);
query.setEmail(username);//邮箱登录
}
user = sqlManager.templateOne(query);//查询返回一个user
return user;
}
public User updateTemplate(User user) {//根据主键id更新
sqlManager.updateTemplateById(user);
return sqlManager.single(User.class, user.getId());
}
}

@ -0,0 +1,8 @@
beetl.suffix=html
spring.datasource.url=jdbc:mysql:///ball?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8080
server.servlet.session.tracking-modes=cookie
server.servlet.session.cookie.http-only=true

@ -0,0 +1,21 @@
<!doctype html>
<html lang="zh-cn">
<head>
<style>
#header {
background-color:#87CEFA;
color:white;
text-align:left;
padding:5px;
}
</style>
<title></title>
</head>
<body>
<div id="header">
<h1>个人中心</h1>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
</head>
<body>
<p> <a href="/profile" target="show" style="text-decoration: none">基本资料</a> </p>
<p> <a href="/orderList" target="show" style="text-decoration: none">历史订单</a> </p>
<div style=" background-color:#DCDCDC; position:relative;left: -5px;top: -45px; height:2px; width:223px;"></div>
<div style=" background-color:#DCDCDC; position:relative;left: -5px;top: -10px; height:2px; width:223px;"></div>
</body>
</html>

@ -0,0 +1,14 @@
<!doctype html>
<html lang="zh-cn">
<frameset rows="14%,86%">
<frame src= "head.html">
<frameset cols="120,*">
<frame src="navframe.html">
<frame src= "/profile" name="show">
</frameset>
</frameset><noframes></noframes>
<head>
</head>
<body>
</body>
</html>

@ -0,0 +1,119 @@
<!doctype html>
<html lang="zh-cn">
<head>
<style>
#main {
width: 1550px;
height: 800px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
#city {
margin: 5px;
padding: 15px;
width: 1550px;
height: 750px;
border: 1px solid black;
}
#button {
width: 100px;
height: 45px;
background: #DC143C;
display: inline-block;
transform: translateY(350px);
position: relative;
left: 252px;
bottom: 40px;
}
#section {
width: 450px;
height: 500px;
padding: 10px;
float: left;
transform: translateY(50px);
position: relative;
left: 540px;
background: white;
}
#section1 {
width: 240px;
height: 60px;
padding: 10px;
float: right
}
</style>
<title></title>
</head>
<body style="overflow: hidden;">
<div id="main">
<div id="city"
style="background-image: url(image/timg.jpg);background-repeat:no-repeat;position: relative;left: -15px;top: -10px;">
<div id="section">
</div>
<div id="section1"
style="background: url(image/20190110153310.png);position: relative;left:-638px;bottom: -80px">
<div style=" background-color:#DC143C; position:relative;left: -32px;bottom: -80px; height:2px; width:300px;">
</div>
<div style=" background-color:#DC143C; position:relative;left: -32px;bottom: -83px; height:1px; width:300px;"></div>
</div>
<form action="/makeAppointment" method="post">
<table>
<tr style="transform: translateX(205px)translateY(200px);">
<td style="color: black; font-size:20px;">球类:</td>
<td>
<select style="width: 80px;height: 30px;" name="ballType">
<option value="篮球">篮球</option>
<option value="足球">足球</option>
<option value="羽毛球">羽毛球</option>
<option value="乒乓球">乒乓球</option>
</select>
</td>
</tr>
<tr style="transform: translateX(195px)translateY(230px);">
<td style="color: black;font-size:20px;">约球场地:</td>
<td>
<select style="width: 100px;height: 30px;" name="place">
<option value="师大体院馆">师大体育馆</option>
<option value="江边篮球场">江边篮球场</option>
<option value="师大操场">师大操场</option>
<option value="五舍广场">五舍广场</option>
</select>
</td>
</tr>
<tr style="transform: translateX(206px)translateY(268px);">
<td style="color: black;font-size:20px;">约球时间:</td>
<td>
<input type="datetime-local" style="width: 160px;height: 30px;" name="appointmentTime">
</td>
</tr>
</table>
<input id="button" type="submit" value="提交">
</form>
<div style="background-color:#DC143C; position:relative;left: 620px;bottom: -350px; height:1px; width:300px;"></div>
<div style="background-color:#D3D3D3; position:relative;left: 620px;bottom: -100px; height:1px; width:300px;"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 620px;bottom: -165px; height:1px; width:300px;"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 620px;bottom: -230px; height:1px; width:300px;"></div>
<div style=" background-color:#DC143C; position:relative;left: 620px;bottom: -350px; height:2px; width:300px;"></div>
</div>
</div>
<script>
<%
if(has(msg) && isNotEmpty(msg)){
for(entry in msg){
var value = entry.value;
print("alert(" + "'"+value +"'" + ");\n");
print("location.href =" + "'" + redirectPath + "'");
}
}
%>
</script>
</body>
</html>

@ -0,0 +1,77 @@
<!doctype html>
<html>
<head>
<style>
#main{
width:1550px;
height:600px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
</style>
</head>
<body>
<div id="main">
<h1 style="position: relative;left: 280px;">订单ing</h1>
<div style=" background-color:#eeeeee; position:relative;left: 230px; height:1px; width:1000px;"></div>
<div style="background-color:#F0F8FF;position: relative;left:230px;transform: translateY(-10px);height: 30px;width: 1000px;">
<p style="transform: translateX(50px);">当前订单</p>
</div>
<div style="background-color:#b0c4de;position: relative;left:230px;transform: translateY(-10px);height: 30px;width: 1000px;">
<p style="transform: translateX(50px);">订单时间:</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:231px;transform: translateY(-25px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">球类</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:432px;transform: translateY(-71px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">约球时间</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:633px;transform: translateY(-117px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">约球地点</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:834px;transform: translateY(-163px);height: 30px;width: 397px;">
<p style="transform: translateX(145px);">当前人数</p>
</div>
<div style="background-color:white;position: relative;left:231px;transform: translateY(-163px);height: 150px;width: 200px;">
</div>
<div style="background-color:#white;position: relative;left:432px;transform: translateY(-312px);height: 150px;width: 200px;">
</div>
<div style="background-color:white;position: relative;left:632px;transform: translateY(-462px);height: 150px;width: 200px;">
</div>
<div style="background-color:white;position: relative;left:833px;transform: translateY(-612px);height: 150px;width: 397px;">
</div>
<div style="background-color:#b0c4de;position: relative;left:230px;transform: translateY(-612px);height: 30px;width: 1000px;">
</div>
<div style=" background-color:#D3D3D3; position:relative;left: 230px; height:1px; width:1000px;transform: translateY(-792px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 230px; height:1px; width:1000px;transform: translateY(-645px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 230px; height:150px; width:1px;transform: translateY(-795px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 430px; height:150px; width:1px;transform: translateY(-945px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 630px; height:150px; width:1px;transform: translateY(-1093px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 830px; height:150px; width:1px;transform: translateY(-1243px);"></div>
<div style=" background-color:#D3D3D3; position:relative;left: 1230px; height:150px; width:1px;transform: translateY(-1395px);"></div>
<%
if(has(order) && isNotEmpty(order)){
%>
<p style="transform: translateY(-1620px);position: relative;left:400px;">${trim(order.created,'yyyy-MM-dd')}</p>
<p style="transform: translateY(-1540px);position: relative;left:300px;">${order.ballType!}</p>
<p style="transform: translateY(-1580px);position: relative;left:500px;">${trim(order.appointmentTime,'yyyy-MM-dd')}</p>
<p style="transform: translateY(-1620px);position: relative;left:700px;">${order.place}</p>
<p style="transform: translateY(-1660px);position: relative;left:1000px;">${count}</p>
<%
}else{
%>
<p style="transform: translateY(-1620px);position: relative;left:400px;">待添加</p>
<p style="transform: translateY(-1540px);position: relative;left:300px;">待添加</p>
<p style="transform: translateY(-1580px);position: relative;left:500px;">待添加</p>
<p style="transform: translateY(-1620px);position: relative;left:700px;">待添加</p>
<p style="transform: translateY(-1660px);position: relative;left:1000px;">待添加</p>
<%
}
%>
<button type="button" onClick="location.href='/cancelOrder?id=${order.id}'" style="position: relative;left:670px;transform: translateY(-1500px);">取消订单</button>
</div>
</body>
</html>

@ -0,0 +1,210 @@
<!DOCTYPE html>
<html>
<head>
<style>
a:link {
color: white;
}
/* 未被访问的链接 */
a:visited {
color: #F0FFFF;
}
/* 已被访问的链接 */
a:hover {
color: #6495ED;
}
/* 鼠标指针移动到链接上 */
a:active {
color: #E6E6FA;
}
/* 正在被点击的链接 */
#main {
width: 1500px;
height: 1300px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
.city {
float: left;
margin: 5px;
padding: 15px;
width: 330px;
height: 680px;
border: 1px solid black;
transform: translateX(260px)
}
#header {
background-color: black;
color: white;
text-align: center;
padding: 5px;
}
#nav {
line-height: 30px;
background-color: #A9A9A9;
height: 330px;
width: 100px;
float: left;
padding: 5px;
}
#section {
width: 350px;
float: left;
padding: 10px;
transform: translateY(-21px)
}
#section1 {
width: 350px;
float: left;
padding: 10px;
transform: translateY(-100px);
}
#section2 {
width: 350px;
float: right;
padding: 10px;
transform: translateY(-5px);
}
#section3 {
width: 350px;
float: left;
padding: 10px;
transform: translateY(-50px);
position: relative;
left: 110px;
}
#section4 {
width: 400px;
float: right;
padding: 10px;
transform: translateY(-52px);
position: relative;
right: 570px
}
#section5 {
width: 500px;
float: right;
padding: 10px;
transform: translateY(-52px);
position: relative;
left: 360px
}
</style>
</head>
<body>
<div id="main">
<div id="header">
<h1>约球吧</h1>
</div>
<div id="nav">
<%
if(isNotEmpty(session.user)){
%>
<a href="#" style="text-decoration: none">${session.user.name!}</a><br>
<a href="personalcenter.html" style="text-decoration: none" target="_blank">个人中心</a><br>
<a href="/currOrder" style="text-decoration: none" target="_blank">当前订单</a><br>
<a href="/logout" style="text-decoration: none">注销</a><br>
<%
}else{
%>
<a href="/login" style="text-decoration: none">登录</a><br>
<a href="/register" style="text-decoration: none">注册</a><br>
<%
}
%>
</div>
<div id="section">
<p>
<a href="/appointment">
<img border="0" src="image/IMG_3792.JPG" width="600" height="710" alt="新闻图片">
</a>
</p>
</div>
<div class="city" style="background: url( image/20190104103744.png)">
<h1><a href="https://china.nba.com/news/" style="text-decoration: none" target="_blank">今日资讯</a></h1>
<p><a href="http://china.nba.com/a/20190103/008406.htm" style="text-decoration: none" target="_blank">漫天嘘声无碍乔治暴走
单骑飙37分攻陷洛城</a>
</p>
<br>
<p><a href="http://china.nba.com/a/20190103/000235.htm" style="text-decoration: none" target="_blank">离复出更近一步
考辛斯参加完整的球队训练</a></p>
<br>
<p><a href="http://china.nba.com/a/20190103/000230.htm" style="text-decoration: none" target="_blank">12月东、西部最佳教练麦克米兰&德安东尼</a>
</p>
<br>
<p><a href="http://china.nba.com/a/20190103/000228.htm" style="text-decoration: none" target="_blank">合同即将转正
麦金尼:不去想无法控制的事</a></p>
<br>
<p><a href="https://nbachina.qq.com/a/20190103/010036.htm" style="text-decoration: none" target="_blank">浓眉谈空砍:我们防守如空气
对手为所欲为</a></p>
<br>
<p><a href="https://nbachina.qq.com/a/20190103/009875.htm" style="text-decoration: none" target="_blank">比尔:我们想念沃尔
并非球队因没他而更好</a></p>
</div>
<div class="city" style="background: url(image/20190103185554.png) ">
<h2 style="color:black"></h2>
</div>
<div id="section1">
<p>
<a href="https://nbachina.qq.com/a/20190104/000190.htm" target="_blank">
<img border="0" src="image/20190104085328.png" width="650" height="400" alt="新闻图片">
</a>
</p>
</div>
<div id="section2">
<p>
<a href="https://nbachina.qq.com/a/20190104/000183.htm" target="_blank">
<img border="0" src="image/20190104085341.png" width="650" height="400" alt="新闻图片">
</a>
</p>
</div>
<div id="section3">
<p>
<a href="https://nbachina.qq.com/a/20190104/000140.htm" target="_blank">
<img border="0" src="image/20190104085415.png" width="400" height="350" alt="新闻图片">
</a>
</p>
</div>
<div id="section4">
<p>
<a href="https://nbachina.qq.com/a/20190104/000138.htm" target="_blank">
<img border="0" src="image/20190104085426.png" width="400" height="350" alt="新闻图片">
</a>
</p>
</div>
<div id="section5">
<p>
<a href="https://nbachina.qq.com/a/20190104/000110.htm" target="_blank">
<img border="0" src="image/20190104085445.png" width="500" height="350" alt="新闻图片">
</a>
</p>
</div>
</div>
</body>
</html>

@ -0,0 +1,91 @@
<!doctype html>
<html>
<head>
<style>
a:link {color:#87CEFA;}
#main{
width:1550px;
height:800px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
#city{
margin: 5px;
padding: 15px;
width: 1550px;
height: 750px;
border: 1px solid black;
}
#section{
width: 450px;
height: 500px;
padding: 10px;
float: left;
background-color: white;
transform: translateY(-730px);
position: relative;
left:540px;
}
#section1{
width:240px;
height: 60px;
padding: 10px;
float:right
}
#name{
display: inline-block;
margin-left: 20px;
}
#name1{
display: inline-block;
margin-left: 20px;
}
#button{
width:350px;
height: 50px;
background: #DC143C;
display: inline-block;
transform: translateY(-450px);
position: relative;
left:130px;
}
</style>
</head>
<body style="overflow: hidden;">
<div id="main">
<div id="city" style="background-image: url(image/20190110093949.png);background-repeat:no-repeat;position: relative;left: -15px;top: -10px;"></div>
<div id="section">
</div>
<div id="section1" style="background:url(image/20190110095831.png);transform: translateY(-700px);position: relative;right:640px;"></div>
<form action="/doLogin" method="post">
<div id="name">
<input style="transform: translateY(-600px);position: relative;left: 115px; width: 350px;height:40px;" type="text" id="username" name="username" placeholder=" 用户名/手机号/邮箱" />
</div>
<div id="name1">
<input style="transform: translateY(-520px);position: relative;left: -265px; width: 350px;height:40px;" type="text" id="password" name="password" placeholder=" 密码" />
</div>
<div>
<a href="/register" style="text-decoration: none;position: relative;left:330px;bottom: 500px;">没有账号,立即注册</a>
</div>
<input id="button" type="submit" value="登录">
</form>
</div>
<script>
<%
if(has(error) && isNotEmpty(error)){
for(entry in error){
var value = entry.value;
print("alert(" + "'"+value +"'" + ");\n");
print("location.href = '/login'");
}
}
%>
</script>
</body>
</html>

@ -0,0 +1,63 @@
<!doctype html>
<html>
<head>
<style>
#main {
width: 1550px;
height: 160px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
.row {
position: absolute;
top: 120px;
left: 237px;
}
</style>
</head>
<body>
<div style=" background-color:#eeeeee; position:relative;left: 230px; height:1px; width:1000px;"></div>
<div style="background-color:#F0F8FF;position: relative;left:230px;transform: translateY(-10px);height: 30px;width: 1000px;">
<p style="transform: translateX(50px);">历史订单</p>
</div>
<div style="background-color:#b0c4de;position: relative;left:230px;transform: translateY(-10px);height: 30px;width: 1000px;">
<p style="transform: translateX(50px);"></p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:231px;transform: translateY(-25px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">球类</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:432px;transform: translateY(-71px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">约球时间</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:633px;transform: translateY(-117px);height: 30px;width: 200px;">
<p style="transform: translateX(70px);">约球地点</p>
</div>
<div style="background-color:#F0F8FF;position: relative;left:834px;transform: translateY(-163px);height: 30px;width: 397px;">
<p style="transform: translateX(145px);">订单时间</p>
</div>
<table border="1">
<%
var top = 120;
for(order in orders){
%>
<tr class="row" style="top: ${top}px;">
<td style="width: 196px;height: 30px;">${order.ballType!}</td>
<td style="width: 196px;height: 30px;">${trim(order.appointmentTime,'yyyy-MM-dd')}</td>
<td style="width: 196px;height: 30px;">${order.place!}</td>
<td style="width: 392px;height: 30px;">${trim(order.created,'yyyy-MM-dd')}</td>
</tr>
<%
top = top + 30;
}
%>
</table>
<div style="background-color:#b0c4de;position: relative;left:230px;transform: translateY(-13px);height: 30px;width: 1000px;">
</div>
</body>
</html>

@ -0,0 +1,89 @@
<!doctype html>
<html>
<head>
<style>
#section {
background-color: white;
color: black;
text-align: center;
margin: 5px;
padding: 15px;
width: 400px;
height: 600px;
}
</style>
</head>
<body>
<div id="section">
<h1 style="position: relative;left: 200px;">个人资料</h1>
<div style=" background-color:#DCDCDC; position:relative;left: 230px; height:1px; width:1000px;"></div>
<p style="position: relative;left: 200px;">用户名:${session.user.name!}</p>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;">
<p>基本资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p></p>
</div>
<div style="background-color: #eeeeee;float: left;width:200px;height:600px;position:relative;left:240px;transform: translateY(-45px);"></div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(-12px);">性别:${session.user.gender!}
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-80px);height: 30px;width: 700px;">
<p style="position: relative;right: 403px;transform: translateY(2px);">手机号:${session.user.phone!}
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(-47px);">电子邮箱:${session.user.email!}
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-115px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(2px);">生日:${trim(session.user.birthday,'yyyy-MM-dd')}
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-132px);height: 30px;width: 700px;">
<p style="position: relative;left:-400px;transform: translateY(2px);">血型:${session.user.bloodType!}
</p>
</div>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;transform: translateY(-150px);">
<p style="transform: translateY(-350px);">详细资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-195px);height: 30px;width: 700px;">
<p style="position: relative;left:-100px;"></p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 390px;transform: translateY(-157px);">真实姓名:${session.user.fullName!}
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-220px);height: 30px;width: 700px;">
<p style="position: relative;right: 395px;transform: translateY(2px);">职业:${session.user.career!}
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-240px);height: 30px;width: 700px;">
<p style="position: relative;right: 395px;transform: translateY(2px);">毕业院校:${session.user.graduateInstitution!}
</p>
</div>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;transform: translateY(-256px);">
<p style="transform: translateY(-120px);">丰富资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-302px);height: 30px;width: 700px;">
<p style="position: relative;left:-100px;">个人简介</p>
<textarea name="个人介绍" rows="20" cols="106"
style="position: relative;left:0; transform:translateY(-45px);">${session.user.brief!}</textarea>
</div>
<p style="position: relative;top:-720px;left:780px;"><a href="/updateProfile" style="text-decoration: none">修改个人资料</a>
</p>
</div>
</body>
</html>

@ -0,0 +1,92 @@
<!doctype html>
<html>
<head>
<style>
a:link {color:#87CEFA;}
#main{
width:1550px;
height:800px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
#city{
margin: 5px;
padding: 15px;
width: 1550px;
height: 750px;
border: 1px solid black;
}
#section{
width: 450px;
height: 600px;
padding: 10px;
float: left;
background-color: white;
transform: translateY(-730px);
position: relative;
left:540px;
}
#section1{
width:240px;
height: 60px;
padding: 10px;
float:right
}
#name{
display: inline-block;
margin-left: 20px;
}
#name1{
display: inline-block;
margin-left: 20px;
}
#button{
width:350px;
height: 50px;
background: #DC143C;
display: inline-block;
transform: translateY(-370px);
position: relative;
left:-223px;
}
</style>
</head>
<body style="overflow: hidden;">
<div id="main">
<div id="city" style="background-image:url(image/20190110093949.png);background-repeat: no-repeat;position: relative;left: -15px;top: -10px;"></div>
<div id="section">
</div>
<div id="section1" style="background:url(image/20190110095831.png);transform: translateY(-710px);position: relative;right:640px;"></div>
<form action="/doRegister" method="post">
<div id="name">
<input style="transform: translateY(-600px);position: relative;left: 115px; width: 350px;height:40px;" type="text" id="username" name="name" placeholder=" 请输入用户名" />
</div>
<div id="name1">
<input style="transform: translateY(-540px);position: relative;left: -265px; width: 350px;height:40px;" type="text" id="password" name="password" placeholder=" 请输入密码" />
</div>
<input style="transform: translateY(-520px);position: relative;left: 134px; width: 350px;height:40px;" type="text" id="repassword" name="repassword" placeholder=" 确认密码" />
<input style="transform: translateY(-460px);position: relative;left: -225px; width: 350px;height:40px;" type="text" id="phonenum" name="phone" placeholder=" 请输入手机号" />
<input style="transform: translateY(-440px);position: relative;left: 134px; width: 350px;height:40px;" type="text" id="email" name="email" placeholder=" 请输入邮箱" />
<input id="button" type="submit" value="注册">
</form>
<a href="login.html" style="text-decoration: none;position: relative;left:-350px;bottom: 260px">已有账号,立即登录</a>
</div>
<script>
<%
if(has(error)&&isNotEmpty(error)){
for(entry in error){
var value = entry.value;
print("alert("+"'"+value+"'"+");\n");
print("location.href = '/register'");
}
}
%>
</script>
</body>
</html>

@ -0,0 +1,177 @@
<!doctype html>
<html>
<head>
<style>
#main {
width: 1550px;
height: 950px;
MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
}
#header {
background-color: black;
color: white;
text-align: left;
padding: 5px;
}
#section {
background-color: white;
color: black;
text-align: center;
margin: 5px;
padding: 15px;
width: 400px;
height: 600px;
}
</style>
</head>
<body>
<div id="main">
<div id="header">
<h1>约球吧</h1>
</div>
<form action="/doUpdateProfile" method="post">
<div id="section">
<h1 style="position: relative;left: 200px;">基本资料</h1>
<div style=" background-color:#DCDCDC; position:relative;left: 230px; height:1px; width:1000px;"></div>
<p style="position: relative;left: 200px;">用户名:</p>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;">
<p>基本资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p>编辑资料</p>
</div>
<div style="background-color: #eeeeee;float: left;width:200px;height:600px;position:relative;left:240px;transform: translateY(-45px);"></div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(-12px);">性别:
<div style="position: relative;left:-330px;transform: translateY(-50px);">
<input type="radio" name="gender" value="男" <% if(session.user.gender == ''){print('checked');} %>>男
<input type="radio" name="gender" value="女" <% if(session.user.gender == ''){print('checked');} %>>女
</div>
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-80px);height: 30px;width: 700px;">
<p style="position: relative;right: 403px;transform: translateY(2px);">手机号:
<div style="position: relative;left:-280px;transform: translateY(-35px);">
<input type="text" value="${session.user.phone!}" name="phone">
</div>
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(-47px);">电子邮箱:
<div style="position: relative;left:-280px;transform: translateY(-85px);">
<input type="email" name="email" value="${session.user.email!}">
</div>
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-115px);height: 30px;width: 700px;">
<p style="position: relative;right: 290px;transform: translateY(2px);">生日:
<select name="year">
<%
for(var i=1970;i<=2019;i++){
if(i+'' == trim(session.user.birthday,'yyyy')){
%>
<option value="${i}" selected>${i}</option>
<%
}else{
%>
<option value="${i}">${i}</option>
<%
}
}
%>
</select>
<select name="month">
<%
for(var i=1;i<=12;i++){
if(i+'' == trim(session.user.birthday,'MM')){
%>
<option value="${i}" selected>${i}</option>
<%
}else{
%>
<option value="${i}">${i}</option>
<%
}
}
%>
</select>
<select name="day">
<%
for(var i=1;i<=31;i++){
if(i+'' == trim(session.user.birthday,'dd')){
%>
<option value="${i}" selected>${i}</option>
<%
}else{
%>
<option value="${i}">${i}</option>
<%
}
}
%>
</select>
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-132px);height: 30px;width: 700px;">
<p style="position: relative;left:-365px;transform: translateY(2px);">血型:
<select name="bloodType">
<option value=""></option>
<option value="A型" <% if(session.user.bloodType == 'A'){print('selected');} %>>A型</option>
<option value="B型" <% if(session.user.bloodType == 'B'){print('selected');} %>>B型</option>
<option value="AB型" <% if(session.user.bloodType == 'AB'){print('selected');} %>>AB型</option>
<option value="0型" <% if(session.user.bloodType == 'O'){print('selected');} %>>0型</option>
<option value="其他" <% if(session.user.bloodType == ''){print('selected');} %>>其他</option>
</select>
</p>
</div>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;transform: translateY(-150px);">
<p style="transform: translateY(-350px);">详细资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-195px);height: 30px;width: 700px;">
<p style="position: relative;left:-100px;">编辑资料</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<p style="position: relative;right: 400px;transform: translateY(-157px);">真实姓名:
<div style="position: relative;left:-280px;transform: translateY(-194px);">
<input type="text" name="fullName" value="${session.user.fullName!}">
</div>
</p>
</div>
<div style="background-color:#eeeeee;position: relative;left:441px;transform: translateY(-220px);height: 30px;width: 700px;">
<p style="position: relative;right: 403px;transform: translateY(2px);">职业:
<div style="position: relative;left:-280px;transform: translateY(-35px);">
<input type="text" name="career" value="${session.user.career!}">
</div>
</p>
</div>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-240px);height: 30px;width: 700px;">
<p style="position: relative;right: 403px;transform: translateY(2px);">毕业院校:
<div style="position: relative;left:-280px;transform: translateY(-35px);">
<input type="text" name="graduateInstitution" value="${session.user.graduateInstitution!}">
</div>
</div>
<div style="background-color:#87CEFA;position: relative;left:240px; height: 30px;width: 200px;transform: translateY(-256px);">
<p style="transform: translateY(-120px);">丰富资料</p>
</div>
<div style="background-color:#87CEEB;position: relative;left:441px;transform: translateY(-302px);height: 30px;width: 700px;">
<p style="position: relative;left:-100px;">编辑资料</p>
</div>
<p style="transform: translateY(-310px);position: relative;left:190px;">个人介绍</p>
<div style="background-color:white;position: relative;left:441px;transform: translateY(-46px);height: 30px;width: 700px;">
<textarea name="brief" rows="18" cols="106"
style="position: relative;left:0; transform:translateY(-270px);">${session.user.brief!}</textarea>
</div>
<input type="submit"
style="position: relative;left:500px;transform: translateY(-60px);" value="提交">
</div>
</form>
</div>
</body>
</html>

@ -0,0 +1,17 @@
package com.example.ball;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BallApplicationTests {
@Test
public void contextLoads() {
}
}
Loading…
Cancel
Save