[fix]部署上线
This commit is contained in:
parent
9f8de780fd
commit
7d88987660
31
pom.xml
31
pom.xml
@ -16,6 +16,37 @@
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</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>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -1,14 +1,23 @@
|
||||
package top.peng.answerbi.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -69,6 +78,8 @@ public class ChartController {
|
||||
@Resource
|
||||
private BiMessageProducer biMessageProducer;
|
||||
|
||||
@Value("${upload.dir}")
|
||||
private String uploadDir;
|
||||
// region 增删改查
|
||||
|
||||
/**
|
||||
@ -362,6 +373,19 @@ public class ChartController {
|
||||
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 对象
|
||||
*
|
||||
|
||||
@ -70,6 +70,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
User user = new User();
|
||||
user.setUserAccount(userAccount);
|
||||
user.setUserPassword(encryptPassword);
|
||||
user.setUserName(userAccount);
|
||||
user.setUserAvatar("https://pengspace.top/img/avatar.png");
|
||||
boolean saveResult = this.save(user);
|
||||
if (!saveResult) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "注册失败,数据库错误");
|
||||
|
||||
@ -21,4 +21,7 @@ spring:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
password: guest
|
||||
|
||||
upload:
|
||||
dir: D:/CodesSpaces/myProject/AnsBi/upload
|
||||
@ -4,23 +4,25 @@ spring:
|
||||
# 数据库配置
|
||||
datasource:
|
||||
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
|
||||
password: ENC(W22KZePz8XkyZFkevBe50CCkRC+72Ql+5JJlrJJs/WKLe6FaZHG/hCL84pgH7Xre)
|
||||
password: 123456
|
||||
# Redis 配置
|
||||
redis:
|
||||
database: 1
|
||||
host: localhost
|
||||
port: 6379
|
||||
timeout: 5000
|
||||
password: ENC(fSQ1SjW1aMVBfbTIO/+FCKgywMK+MfCqJbGxGz6sDpnZaVi1l73H0kpPazxV5Tb7)
|
||||
password: 123456
|
||||
# rabbitMq 配置
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# 生产环境关闭日志
|
||||
log-impl: ''
|
||||
#mybatis-plus:
|
||||
# configuration:
|
||||
# # 生产环境关闭日志
|
||||
# log-impl: ''
|
||||
upload:
|
||||
dir: /dev-ops/my-app/answerBi/upload/
|
||||
@ -3,7 +3,7 @@ spring:
|
||||
name: answerBi-backend
|
||||
# 默认 dev 环境
|
||||
profiles:
|
||||
active: dev
|
||||
active: @profiles.active@
|
||||
# 支持 swagger3
|
||||
mvc:
|
||||
pathmatch:
|
||||
@ -88,9 +88,14 @@ cos:
|
||||
|
||||
yuapi:
|
||||
client:
|
||||
access-key: ENC(v27uTfT5pLqgnpL5glE1dJGChWOzY9ODw/kXrvZ/YO4vbWpyjbI80nclIm2neceZwN7rCiexSFhmrXEu18eZsyfOlU5IfbwFAITBPg/GJ2I=)
|
||||
secret-key: ENC(5Gn5+7922Qg1Ru3VrzVMkX/PdKou6DfzaTKS2tKetd1Z7PXsNY0Pv6GNXIZwzkb2z2+OKU40XKRdPH57Ds/D0p6338kbMUg704Wj8INOWhI=)
|
||||
access-key: ojhebu7ow90w3d9dcpw4s37h17j5kpd3
|
||||
secret-key: bi6ns6acne4sdu357yz5akwvkn3a22nt
|
||||
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: ${ENCRYPTOR_PASSWORD}
|
||||
password: ${ENCRYPTOR_PASSWORD}
|
||||
|
||||
logging:
|
||||
level:
|
||||
top.peng: @logging.level@
|
||||
org.springframework: warn
|
||||
Loading…
Reference in New Issue
Block a user