[fix]部署上线
This commit is contained in:
parent
9f8de780fd
commit
7d88987660
31
pom.xml
31
pom.xml
@ -16,6 +16,37 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>local</id>
|
||||||
|
<properties>
|
||||||
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
|
<profiles.active>local</profiles.active>
|
||||||
|
<logging.level>debug</logging.level>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>dev</id>
|
||||||
|
<properties>
|
||||||
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
|
<profiles.active>dev</profiles.active>
|
||||||
|
<logging.level>debug</logging.level>
|
||||||
|
</properties>
|
||||||
|
<activation>
|
||||||
|
<!-- 默认环境 -->
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>prod</profiles.active>
|
||||||
|
<logging.level>warn</logging.level>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@ -1,14 +1,23 @@
|
|||||||
package top.peng.answerbi.controller;
|
package top.peng.answerbi.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -69,6 +78,8 @@ public class ChartController {
|
|||||||
@Resource
|
@Resource
|
||||||
private BiMessageProducer biMessageProducer;
|
private BiMessageProducer biMessageProducer;
|
||||||
|
|
||||||
|
@Value("${upload.dir}")
|
||||||
|
private String uploadDir;
|
||||||
// region 增删改查
|
// region 增删改查
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -362,6 +373,19 @@ public class ChartController {
|
|||||||
return ResultUtils.success(biResponse);
|
return ResultUtils.success(biResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "上传文件到服务器指定路径")
|
||||||
|
@PostMapping("/uploadtest")
|
||||||
|
public String handleFileUpload(@RequestPart("file") MultipartFile file) throws IOException {
|
||||||
|
if (!file.isEmpty()){
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
File targetFile = new File(uploadDir, fileName);
|
||||||
|
FileCopyUtils.copy(file.getBytes(),targetFile);
|
||||||
|
return "redirect:/success";
|
||||||
|
}
|
||||||
|
return "redirect:/error";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预处理请求 根据用户输入构建 要存入数据库的 Chart 对象
|
* 预处理请求 根据用户输入构建 要存入数据库的 Chart 对象
|
||||||
*
|
*
|
||||||
|
|||||||
@ -70,6 +70,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
User user = new User();
|
User user = new User();
|
||||||
user.setUserAccount(userAccount);
|
user.setUserAccount(userAccount);
|
||||||
user.setUserPassword(encryptPassword);
|
user.setUserPassword(encryptPassword);
|
||||||
|
user.setUserName(userAccount);
|
||||||
|
user.setUserAvatar("https://pengspace.top/img/avatar.png");
|
||||||
boolean saveResult = this.save(user);
|
boolean saveResult = this.save(user);
|
||||||
if (!saveResult) {
|
if (!saveResult) {
|
||||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "注册失败,数据库错误");
|
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "注册失败,数据库错误");
|
||||||
|
|||||||
@ -21,4 +21,7 @@ spring:
|
|||||||
host: localhost
|
host: localhost
|
||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
|
||||||
|
upload:
|
||||||
|
dir: D:/CodesSpaces/myProject/AnsBi/upload
|
||||||
@ -4,23 +4,25 @@ spring:
|
|||||||
# 数据库配置
|
# 数据库配置
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/answer_bi
|
url: jdbc:mysql://localhost:13306/answer_bi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||||
username: root
|
username: root
|
||||||
password: ENC(W22KZePz8XkyZFkevBe50CCkRC+72Ql+5JJlrJJs/WKLe6FaZHG/hCL84pgH7Xre)
|
password: 123456
|
||||||
# Redis 配置
|
# Redis 配置
|
||||||
redis:
|
redis:
|
||||||
database: 1
|
database: 1
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 6379
|
port: 6379
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
password: ENC(fSQ1SjW1aMVBfbTIO/+FCKgywMK+MfCqJbGxGz6sDpnZaVi1l73H0kpPazxV5Tb7)
|
password: 123456
|
||||||
# rabbitMq 配置
|
# rabbitMq 配置
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
mybatis-plus:
|
#mybatis-plus:
|
||||||
configuration:
|
# configuration:
|
||||||
# 生产环境关闭日志
|
# # 生产环境关闭日志
|
||||||
log-impl: ''
|
# log-impl: ''
|
||||||
|
upload:
|
||||||
|
dir: /dev-ops/my-app/answerBi/upload/
|
||||||
@ -3,7 +3,7 @@ spring:
|
|||||||
name: answerBi-backend
|
name: answerBi-backend
|
||||||
# 默认 dev 环境
|
# 默认 dev 环境
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: @profiles.active@
|
||||||
# 支持 swagger3
|
# 支持 swagger3
|
||||||
mvc:
|
mvc:
|
||||||
pathmatch:
|
pathmatch:
|
||||||
@ -88,9 +88,14 @@ cos:
|
|||||||
|
|
||||||
yuapi:
|
yuapi:
|
||||||
client:
|
client:
|
||||||
access-key: ENC(v27uTfT5pLqgnpL5glE1dJGChWOzY9ODw/kXrvZ/YO4vbWpyjbI80nclIm2neceZwN7rCiexSFhmrXEu18eZsyfOlU5IfbwFAITBPg/GJ2I=)
|
access-key: ojhebu7ow90w3d9dcpw4s37h17j5kpd3
|
||||||
secret-key: ENC(5Gn5+7922Qg1Ru3VrzVMkX/PdKou6DfzaTKS2tKetd1Z7PXsNY0Pv6GNXIZwzkb2z2+OKU40XKRdPH57Ds/D0p6338kbMUg704Wj8INOWhI=)
|
secret-key: bi6ns6acne4sdu357yz5akwvkn3a22nt
|
||||||
|
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
password: ${ENCRYPTOR_PASSWORD}
|
password: ${ENCRYPTOR_PASSWORD}
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
top.peng: @logging.level@
|
||||||
|
org.springframework: warn
|
||||||
Loading…
Reference in New Issue
Block a user