main
parent
9543d0b5f6
commit
f3ab815ce2
@ -0,0 +1,285 @@
|
|||||||
|
<?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">
|
||||||
|
<!-- <parent>-->
|
||||||
|
<!-- <artifactId>demay</artifactId>-->
|
||||||
|
<!-- <groupId>com.ssm</groupId>-->
|
||||||
|
<!-- <version>1.0-SNAPSHOT</version>-->
|
||||||
|
<!-- </parent>-->
|
||||||
|
<!-- <modelVersion>4.0.0</modelVersion>-->
|
||||||
|
|
||||||
|
<!-- <artifactId>dm_web</artifactId>-->
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>demay</artifactId>
|
||||||
|
<groupId>com.ssm</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>dm_web</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>dm_web</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.redisson</groupId>-->
|
||||||
|
<!-- <artifactId>redisson</artifactId>-->
|
||||||
|
<!-- <version>3.17.1</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjweaver</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
<version>2.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Swagger end -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.session</groupId>
|
||||||
|
<artifactId>spring-session-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.oschina.zcx7878</groupId>
|
||||||
|
<artifactId>fastdfs-client-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId>
|
||||||
|
<version>3.6</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
<version>2.6.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ssm</groupId>
|
||||||
|
<artifactId>redis</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ssm</groupId>
|
||||||
|
<artifactId>dm_api</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>tk.mybatis</groupId>
|
||||||
|
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ssm</groupId>
|
||||||
|
<artifactId>dm_service</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>tk.mybatis</groupId>
|
||||||
|
<artifactId>mapper-spring</artifactId>
|
||||||
|
<version>1.1.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.apache.shardingsphere</groupId>-->
|
||||||
|
<!-- <artifactId>sharding-jdbc-spring-boot-starter</artifactId>-->
|
||||||
|
<!-- <version>4.0.0-RC1</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
|
<artifactId>quartz</artifactId>
|
||||||
|
<version>2.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>2.2.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
<!-- <artifactId>spring-boot-starter-amqp</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!--加密账号密码-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ulisesbocchio</groupId>
|
||||||
|
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--测试请求没问题-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--非严格模式下 规避一些html编译错误 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.nekohtml</groupId>
|
||||||
|
<artifactId>nekohtml</artifactId>
|
||||||
|
<version>1.9.22</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>24.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解决 Could not find org.springframework.cloud:spring-cloud-dependencies:pom:Finchley.M8 -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||||
|
<!-- <artifactId>spring-cloud-dependencies</artifactId>-->
|
||||||
|
<!-- <version>Finchley.M8</version>-->
|
||||||
|
<!-- <type>pom</type>-->
|
||||||
|
<!-- <scope>import</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>dm_web</finalName>
|
||||||
|
<!--spring boot打包的话需要指定一个唯一的入门-->
|
||||||
|
<defaultGoal>compile</defaultGoal>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>com.ssm.DmWebApp</mainClass>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>./</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
<excludes>
|
||||||
|
<exclude>config/**</exclude>
|
||||||
|
</excludes>
|
||||||
|
<outputDirectory>F:/workPlace/target/dm_web</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>F:/workPlace/target/dm_web/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<overwrite>true</overwrite>
|
||||||
|
<outputDirectory>F:/workPlace/target/dm_web/config</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources/config</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!--Maven通过Maven Surefire Plugin插件执行单元测试-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import com.ssm.manage.utils.StringUtils;
|
||||||
|
//import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
//import org.aspectj.lang.annotation.Around;
|
||||||
|
//import org.aspectj.lang.annotation.Aspect;
|
||||||
|
//import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.boot.SpringApplication;
|
||||||
|
//import org.springframework.boot.context.event.SpringApplicationEvent;
|
||||||
|
//import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
//import org.springframework.core.annotation.Order;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import java.lang.reflect.Method;
|
||||||
|
//import java.util.Optional;
|
||||||
|
//
|
||||||
|
//@Component
|
||||||
|
//@Aspect
|
||||||
|
//@Order(0)
|
||||||
|
//public class RedissonAspect {
|
||||||
|
// @Autowired
|
||||||
|
// private RedissonLockService redissonLockService;
|
||||||
|
// @Autowired
|
||||||
|
// private ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Around("@annotation(redissonLock)")
|
||||||
|
// public Object around(ProceedingJoinPoint joinPoint,RedissonLock redissonLock) throws Throwable {
|
||||||
|
// Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
|
||||||
|
// //获取前缀
|
||||||
|
// applicationEventPublisher.publishEvent(new SmsSendEvent(this,"15913619401"));
|
||||||
|
// String prefix = StringUtils.isBlank(redissonLock.prefix())?SpELUtils.getMethodKey(method):redissonLock.prefix();
|
||||||
|
// String key = SpELUtils.parseSpEl(method,joinPoint.getArgs(),redissonLock.key());
|
||||||
|
// Object lock = redissonLockService.lock(prefix + key, redissonLock.timeout(), redissonLock.timeUnit(), joinPoint::proceed);
|
||||||
|
// return lock;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import java.lang.annotation.ElementType;
|
||||||
|
//import java.lang.annotation.Retention;
|
||||||
|
//import java.lang.annotation.RetentionPolicy;
|
||||||
|
//import java.lang.annotation.Target;
|
||||||
|
//import java.util.concurrent.TimeUnit;
|
||||||
|
//
|
||||||
|
//@Target(ElementType.METHOD)
|
||||||
|
//@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
//public @interface RedissonLock {
|
||||||
|
// String prefix() default "";
|
||||||
|
// String key();
|
||||||
|
// int timeout() default -1;
|
||||||
|
// TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
|
||||||
|
//}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import com.ssm.manage.entity.SmsException;
|
||||||
|
//import com.ssm.manage.response.ResponseCode;
|
||||||
|
//import lombok.SneakyThrows;
|
||||||
|
//import org.apache.poi.ss.formula.functions.T;
|
||||||
|
//import org.redisson.api.RLock;
|
||||||
|
//import org.redisson.api.RedissonClient;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
|
//import java.util.concurrent.TimeUnit;
|
||||||
|
//
|
||||||
|
//@Component
|
||||||
|
//public class RedissonLockService {
|
||||||
|
// @Autowired
|
||||||
|
// private RedissonClient redissonClient;
|
||||||
|
//
|
||||||
|
// @SneakyThrows
|
||||||
|
// public <T> T lock(String key, int timeout, TimeUnit timeUnit, Supplier<T> supplier) throws SmsException {
|
||||||
|
// RLock lock = redissonClient.getLock(key);
|
||||||
|
// boolean tryLock = lock.tryLock(timeout,timeUnit);
|
||||||
|
// if (!tryLock) {
|
||||||
|
// throw new SmsException(ResponseCode.MSG,"请求太频繁了");
|
||||||
|
// }
|
||||||
|
// try {
|
||||||
|
// return supplier.get();
|
||||||
|
// }finally {
|
||||||
|
// lock.unlock();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @FunctionalInterface
|
||||||
|
// public interface Supplier<T> {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Gets a result.
|
||||||
|
// *
|
||||||
|
// * @return a result
|
||||||
|
// */
|
||||||
|
// T get() throws Throwable;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import lombok.Getter;
|
||||||
|
//import org.springframework.context.ApplicationEvent;
|
||||||
|
//
|
||||||
|
//@Getter
|
||||||
|
//public class SmsSendEvent extends ApplicationEvent {
|
||||||
|
// private String phone;
|
||||||
|
// /**
|
||||||
|
// * Create a new ApplicationEvent.
|
||||||
|
// *
|
||||||
|
// * @param source the object on which the event initially occurred (never {@code null})
|
||||||
|
// */
|
||||||
|
// public SmsSendEvent(Object source,String phone) {
|
||||||
|
// super(source);
|
||||||
|
// this.phone = phone;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import org.springframework.context.event.EventListener;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//import org.springframework.transaction.event.TransactionPhase;
|
||||||
|
//import org.springframework.transaction.event.TransactionalEventListener;
|
||||||
|
//
|
||||||
|
//@Component
|
||||||
|
//public class SmsSendLister {
|
||||||
|
//
|
||||||
|
// @EventListener(SmsSendEvent.class)
|
||||||
|
// @TransactionalEventListener(value = SmsSendEvent.class,phase = TransactionPhase.AFTER_COMMIT)
|
||||||
|
// public void SmsSendLister() {
|
||||||
|
// System.out.println("SmsSendLister");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
//package com.ssm.annotation;
|
||||||
|
//
|
||||||
|
//import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||||
|
//import org.springframework.expression.EvaluationContext;
|
||||||
|
//import org.springframework.expression.Expression;
|
||||||
|
//import org.springframework.expression.ExpressionParser;
|
||||||
|
//import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
//import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
//
|
||||||
|
//import java.lang.reflect.Method;
|
||||||
|
//import java.util.Optional;
|
||||||
|
//
|
||||||
|
//public class SpELUtils {
|
||||||
|
// private static final ExpressionParser PARSER = new SpelExpressionParser();
|
||||||
|
// private static final DefaultParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
|
||||||
|
// public static String getMethodKey(Method method){
|
||||||
|
// return method.getDeclaringClass() + "#" + method.getName();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static String parseSpEl(Method method,Object[] args,String spEL){
|
||||||
|
// //获取方法的参数名,可能为空
|
||||||
|
// String[] parameterNames = Optional.ofNullable(PARAMETER_NAME_DISCOVERER.getParameterNames(method)).orElse(new String[]{});
|
||||||
|
// EvaluationContext context = new StandardEvaluationContext();
|
||||||
|
// for (int i = 0; i < parameterNames.length; i++) {
|
||||||
|
// context.setVariable(parameterNames[i], args[i]);
|
||||||
|
// }
|
||||||
|
// Expression expression = PARSER.parseExpression(spEL);
|
||||||
|
// return expression.getValue(context,String.class);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
${AnsiColor.BRIGHT_YELLOW}
|
||||||
|
鸡你太美
|
||||||
|
鸡你实在太美
|
||||||
|
鸡你是太美
|
||||||
|
鸡你太美
|
||||||
|
实在是太美鸡你
|
||||||
|
鸡你 实在是太美鸡你 美
|
||||||
|
鸡你 实在是太美鸡美 太美
|
||||||
|
鸡你 实在是太美鸡美 太美
|
||||||
|
鸡你 实在是太美鸡美 太美
|
||||||
|
鸡你 鸡你实在是美太美 美蓝球球
|
||||||
|
鸡 鸡 鸡你实在是太美 篮球篮球球
|
||||||
|
鸡 鸡你太美裆鸡太啊 蓝篮球
|
||||||
|
鸡你太美裆裆鸡美
|
||||||
|
鸡你美裆 裆鸡美
|
||||||
|
鸡太美 鸡太美
|
||||||
|
鸡美 鸡美
|
||||||
|
鸡美 鸡美
|
||||||
|
鸡美 鸡美
|
||||||
|
鸡太 鸡太
|
||||||
|
金 猴 金猴
|
||||||
|
皮 鞋 皮鞋金猴
|
||||||
|
金光 金光 大道
|
||||||
|
大道
|
||||||
|
坤坤保佑 永不宕机 永无BUG
|
||||||
|
${AnsiColor.BRIGHT_BLUE}
|
||||||
|
${AnsiColor.BRIGHT_WHITE}
|
||||||
@ -0,0 +1,279 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||||
|
<title>测试项目线上发布成功与否</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" th:src="@{js/three.min.js}"></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/OrbitControls.js}" ></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/Stats.js}" ></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/dat.gui.min.js}" ></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/Fire.js}" ></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/tween.min.js}" ></script>
|
||||||
|
<script type="text/javascript" th:src="@{js/physi.js}" ></script>
|
||||||
|
<style>
|
||||||
|
body{
|
||||||
|
background: url(img/bg.jpg) no-repeat top center fixed; overflow: hidden;
|
||||||
|
background-size: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
// 实际代码
|
||||||
|
var scene, renderer, camera; // 三大件
|
||||||
|
var controls, stats, clock; // 辅助组件
|
||||||
|
var arrowBodyMesh, smokeParticles = []; // 箭体网格对象和烟雾数组
|
||||||
|
// 箭体图片路径
|
||||||
|
var arrowPath = "img/arrow.png";
|
||||||
|
// 烟雾图片路径
|
||||||
|
var smokePath = "img/cloud.png";
|
||||||
|
function init() {
|
||||||
|
// 创建clock
|
||||||
|
clock = new THREE.Clock();
|
||||||
|
// 创建场景
|
||||||
|
scene=new THREE.Scene();
|
||||||
|
// 创建渲染器
|
||||||
|
renderer=new THREE.WebGLRenderer({
|
||||||
|
antialias:true,
|
||||||
|
alpha:true
|
||||||
|
});
|
||||||
|
renderer.setClearColor(0x000000, 0.0);
|
||||||
|
renderer.setSize(window.innerWidth,window.innerHeight);
|
||||||
|
renderer.setPixelRatio(window.devicePixelRatio);
|
||||||
|
document.body.appendChild(renderer.domElement);
|
||||||
|
// 创建透视相机
|
||||||
|
camera=new THREE.PerspectiveCamera(60,window.innerWidth/window.innerHeight,1,1000);
|
||||||
|
camera.position.set(0,0,30);
|
||||||
|
|
||||||
|
// 辅助移动视角
|
||||||
|
// controls=new THREE.OrbitControls(camera,renderer.domElement);
|
||||||
|
// controls.enableDamping=true;
|
||||||
|
// controls.minDistance=1;
|
||||||
|
// controls.maxDistance=500;
|
||||||
|
|
||||||
|
scene.add(new THREE.AmbientLight(0XCCCCCC, 0.5));
|
||||||
|
|
||||||
|
var pointLight=new THREE.PointLight(0xffffff, 0.8);
|
||||||
|
pointLight.position.set(0, 10, 40);
|
||||||
|
scene.add(pointLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fire, fire1;
|
||||||
|
function initModel(){
|
||||||
|
// var helper = new THREE.GridHelper(1000, 50);
|
||||||
|
// scene.add(helper);
|
||||||
|
|
||||||
|
// 尾焰
|
||||||
|
var plane=new THREE.PlaneBufferGeometry(15,30,1);
|
||||||
|
fire = new THREE.Fire(plane,{
|
||||||
|
textureWidth:1024,
|
||||||
|
textureHeight:1024,
|
||||||
|
debug:false,
|
||||||
|
color1: new THREE.Color(0xffffff),
|
||||||
|
color2: new THREE.Color(0xffc159),
|
||||||
|
color3: new THREE.Color(0xe69bb1),
|
||||||
|
windVector: new THREE.Vector2(0, -1.2),
|
||||||
|
colorBias: 0.92,
|
||||||
|
burnRate: 1.19,
|
||||||
|
diffuse: 5,
|
||||||
|
viscosity: 0.2,
|
||||||
|
expansion: -3,
|
||||||
|
swirl: 8,
|
||||||
|
drag: 0.17,
|
||||||
|
airSpeed: 23,
|
||||||
|
speed: 390,
|
||||||
|
massConservation: false
|
||||||
|
});
|
||||||
|
// fire = new THREE.Fire(plane,{
|
||||||
|
// textureWidth:512,
|
||||||
|
// textureHeight:512,
|
||||||
|
// debug:false,
|
||||||
|
// color1: new THREE.Color(0xffffff),
|
||||||
|
// color2: new THREE.Color(0xffc159),
|
||||||
|
// color3: new THREE.Color(0xe69bb1),
|
||||||
|
// windVector: new THREE.Vector2(0, -2),
|
||||||
|
// colorBias: 0.61,
|
||||||
|
// burnRate: 1.73,
|
||||||
|
// diffuse: 1.3,
|
||||||
|
// viscosity: 0.25,
|
||||||
|
// expansion: 0,
|
||||||
|
// swirl: 50,
|
||||||
|
// drag: 0.35,
|
||||||
|
// airSpeed: 11,
|
||||||
|
// speed: 531,
|
||||||
|
// massConservation: false
|
||||||
|
// });
|
||||||
|
fire.addSource(0.5, 0.6, 0.1, 1.0, 0.0, -2.0);
|
||||||
|
fire.addSource(0.62, 0.6, 0.1, 1.0, 0.0, -2.0);
|
||||||
|
fire.addSource(0.38, 0.6, 0.1, 1.0, 0.0, -2.0);
|
||||||
|
fire.position.y = firePosition;
|
||||||
|
fire.position.z = -10;
|
||||||
|
// fire.rotateX(Math.PI);//绕x轴旋转π/4
|
||||||
|
scene.add(fire);
|
||||||
|
|
||||||
|
// 烟雾
|
||||||
|
var smokeTexture = THREE.ImageUtils.loadTexture(smokePath);
|
||||||
|
var smokeMaterial = new THREE.MeshLambertMaterial({
|
||||||
|
map: smokeTexture,
|
||||||
|
transparent: true
|
||||||
|
});
|
||||||
|
var smokeGeo = new THREE.PlaneGeometry(30, 30);
|
||||||
|
for (p = 0; p < smokeCount; p++) {
|
||||||
|
var particle = new THREE.Mesh(smokeGeo, smokeMaterial);
|
||||||
|
// particle.position.set((p-10)*5, -28+Math.abs(p-10)*2, -5);
|
||||||
|
particle.position.set(0, firePosition-8, -5);
|
||||||
|
// particle.position.set((p-10)*5, -28+Math.abs(p-10)*3, -5);
|
||||||
|
particle.rotation.z = Math.random() * 360;
|
||||||
|
// particle.rotateX(Math.PI);//绕x轴旋转π/4
|
||||||
|
scene.add(particle);
|
||||||
|
smokeParticles.push(particle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 箭体
|
||||||
|
var arrowPlane=new THREE.PlaneBufferGeometry(10,25,1);
|
||||||
|
// var geometry = new THREE.CubeGeometry( 10, 10, 10);
|
||||||
|
var material = new THREE.MeshPhongMaterial({
|
||||||
|
map: THREE.ImageUtils.loadTexture(arrowPath),
|
||||||
|
transparent: true
|
||||||
|
});
|
||||||
|
arrowBodyMesh = new THREE.Mesh(arrowPlane, material);
|
||||||
|
arrowBodyMesh.position.y = (firePosition + 18.7);
|
||||||
|
arrowBodyMesh.position.z = -10;
|
||||||
|
scene.add(arrowBodyMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
var smokeCount = 20; // 组成烟雾的对象数量
|
||||||
|
var firePosition = -30; // 尾焰y轴位置
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞行动画
|
||||||
|
*/
|
||||||
|
var tweenFireFlySlow, tweenArrowFlySlow, tweenFireFlyFast, tweenArrowFlyFast;
|
||||||
|
function initTween(distance) {
|
||||||
|
// // 尾焰起飞-慢
|
||||||
|
// tweenFireFlySlow = new TWEEN.Tween(fire.position)
|
||||||
|
// .to( { y: (firePosition + 28.7) }, 2500 ).repeat(0).start();
|
||||||
|
// tweenFireFlySlow.easing(TWEEN.Easing.Quadratic.In);
|
||||||
|
|
||||||
|
// // 箭体起飞-慢
|
||||||
|
// tweenArrowFlySlow = new TWEEN.Tween(arrowBodyMesh.position)
|
||||||
|
// .to( { y: (47.4 + firePosition) }, 2500 ).repeat(0).start();
|
||||||
|
// tweenArrowFlySlow.easing(TWEEN.Easing.Quadratic.In);
|
||||||
|
|
||||||
|
// // 尾焰起飞-快
|
||||||
|
// tweenFireFlyFast = new TWEEN.Tween(fire.position)
|
||||||
|
// .to( { y: (firePosition + 68.7) }, 1000 ).repeat(0);
|
||||||
|
// tweenFireFlyFast.easing(TWEEN.Easing.Elastic.In);
|
||||||
|
|
||||||
|
// // 箭体起飞-快
|
||||||
|
// tweenArrowFlyFast = new TWEEN.Tween(arrowBodyMesh.position)
|
||||||
|
// .to( { y: (87.4 + firePosition) }, 1000 ).repeat(0);
|
||||||
|
// tweenArrowFlyFast.easing(TWEEN.Easing.Elastic.In);
|
||||||
|
|
||||||
|
// 尾焰起飞-慢
|
||||||
|
tweenFireFlySlow = new TWEEN.Tween(fire.position)
|
||||||
|
.to( { y: (firePosition + 68.7) }, 5500 ).repeat(0).start();
|
||||||
|
tweenFireFlySlow.easing(TWEEN.Easing.Quadratic.In);
|
||||||
|
|
||||||
|
// 箭体起飞-慢
|
||||||
|
tweenArrowFlySlow = new TWEEN.Tween(arrowBodyMesh.position)
|
||||||
|
.to( { y: (87.4 + firePosition) }, 5500 ).repeat(0).start();
|
||||||
|
tweenArrowFlySlow.easing(TWEEN.Easing.Quadratic.In);
|
||||||
|
|
||||||
|
// 烟雾运动
|
||||||
|
for (var p = 0; p < smokeCount; p++) {
|
||||||
|
new TWEEN.Tween(smokeParticles[p].position)
|
||||||
|
.to( { x: (p-10)*5 }, 3000 ).repeat(0).start()
|
||||||
|
.easing(TWEEN.Easing.Quadratic.Out);
|
||||||
|
new TWEEN.Tween(smokeParticles[p].position)
|
||||||
|
.to( { y: -26+Math.abs(p-10)*3 }, 2000 ).repeat(0).start()
|
||||||
|
.easing(TWEEN.Easing.Quadratic.Out);
|
||||||
|
|
||||||
|
new TWEEN.Tween(smokeParticles[p].position)
|
||||||
|
.to( { z: Math.abs(p-10)*3 }, 2000 ).repeat(0).start()
|
||||||
|
.easing(TWEEN.Easing.Quadratic.Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
// tweenFireFlySlow.chain(tweenFireFlyFast);
|
||||||
|
// tweenArrowFlySlow.chain(tweenArrowFlyFast);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onresize = function (){
|
||||||
|
camera.aspect=window.innerWidth/window.innerHeight;
|
||||||
|
camera.updateProjectionMatrix();
|
||||||
|
renderer.setSize(window.innerWidth,window.innerHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
function render(){
|
||||||
|
renderer.render(scene,camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
function animate(){
|
||||||
|
if (!isStop) {
|
||||||
|
// controls.update();
|
||||||
|
TWEEN.update();
|
||||||
|
delta = clock.getDelta();
|
||||||
|
evolveSmoke();
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 烟雾旋转
|
||||||
|
function evolveSmoke() {
|
||||||
|
var sp = smokeParticles.length;
|
||||||
|
while (sp--) {
|
||||||
|
if (sp%2==0) { // 偶数逆时针旋转
|
||||||
|
smokeParticles[sp].rotation.z += (delta * 0.1);
|
||||||
|
} else { // 奇数顺时针旋转
|
||||||
|
smokeParticles[sp].rotation.z += -(delta * 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* three.js动画准备
|
||||||
|
*/
|
||||||
|
function threeReady(){
|
||||||
|
init();
|
||||||
|
initModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* three.js动画开始
|
||||||
|
*/
|
||||||
|
function threeStart() {
|
||||||
|
// 允许动画循环
|
||||||
|
isStop = false;
|
||||||
|
initTween();
|
||||||
|
animate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 元素归位,动画循环停止
|
||||||
|
*/
|
||||||
|
var isStop = false; // 是否停止动画nd
|
||||||
|
function threeEnd() {
|
||||||
|
// 尾焰归位
|
||||||
|
fire.position.set(0, firePosition, -10);
|
||||||
|
// 烟雾归位
|
||||||
|
for (var p = 0; p < smokeCount; p++) {
|
||||||
|
smokeParticles[p].position.set(0, firePosition-8, -5);
|
||||||
|
}
|
||||||
|
// 箭体归位
|
||||||
|
arrowBodyMesh.position.set(0, firePosition + 18.7, -10);
|
||||||
|
// 动画循环停止
|
||||||
|
isStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
threeReady();
|
||||||
|
threeStart();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue