Merge branch 'develop' into dev/dev
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
version: "3"
|
||||
services:
|
||||
aida_back:
|
||||
container_name: develop-version-aida-back
|
||||
container_name: stable-version-aida-back
|
||||
build: .
|
||||
volumes:
|
||||
# 数据挂载
|
||||
- /workspace/home/aida/file/:/workspace/home/aida/file/
|
||||
ports:
|
||||
- "10090:5567"
|
||||
- "10086:5567"
|
||||
6
pom.xml
6
pom.xml
@@ -76,6 +76,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
|
||||
@@ -41,10 +41,11 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
private SecurityProperties properties;
|
||||
|
||||
private static final List<String> FILTER_URL =
|
||||
Arrays.asList("/favicon.ico", "/doc.html", "api/account/login", "api/account/preLogin", "api/account/sendEmail",
|
||||
Arrays.asList("/favicon.ico", "/doc.html", "api/account/login", "api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired",
|
||||
"/webjars/", "/swagger-resources", "/v2/api-docs", "api/account/resetPwd",
|
||||
"/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId",
|
||||
"/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile",
|
||||
"/api/third/party/addNoLoginRequired","/api/third/party/deleteNoLoginRequired",
|
||||
"/api/python/chatStream",
|
||||
"/api/python/flush",
|
||||
"/api/account/healthy"
|
||||
@@ -110,12 +111,12 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
//校验token
|
||||
String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
|
||||
|
||||
// if(StringUtils.isEmpty(cacheToken)){
|
||||
// throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
// }
|
||||
// if(!cacheToken.equals(jwtToken) ){
|
||||
// throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
// }
|
||||
if(StringUtils.isEmpty(cacheToken)){
|
||||
throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
}
|
||||
if(!cacheToken.equals(jwtToken) ){
|
||||
throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
}
|
||||
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
|
||||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
|
||||
@@ -143,4 +143,10 @@ public class AccountController {
|
||||
public Response<Long> getExpiredTime(){
|
||||
return Response.success(accountService.getExpiredTime());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询账号到期时间")
|
||||
@PostMapping("/noLoginRequired")
|
||||
public Response<AccountLoginVO> noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO){
|
||||
return Response.success(accountService.noLoginRequired(noLoginRequiredDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,17 @@ public class ThirdPartyController {
|
||||
return Response.success(accountService.addTrialUser(accountTrialDTO));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "add No Login Required")
|
||||
@PostMapping("/addNoLoginRequired")
|
||||
public Response<Boolean> addNoLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO) {
|
||||
return Response.success(accountService.addNoLoginRequired(noLoginRequiredDTO));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "add No Login Required")
|
||||
@PostMapping("/deleteNoLoginRequired")
|
||||
public Response<Boolean> deleteNoLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO) {
|
||||
return Response.success(accountService.deleteNoLoginRequired(noLoginRequiredDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,4 +78,6 @@ public class Account implements Serializable {
|
||||
private Integer isTrial;
|
||||
|
||||
private Integer isBeginner;
|
||||
|
||||
private String browserIdentifiers;
|
||||
}
|
||||
|
||||
@@ -29,4 +29,15 @@ public class DesignSingleIncludeLayersDTO {
|
||||
@NotBlank(message = "timeZone.cannot.be.empty")
|
||||
@ApiModelProperty("本地时区,比如 'Asia/Tokyo' 东京时间 , 'Asia/Shanghai' 北京时间 由js本地获取")
|
||||
private String timeZone;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DesignSingleIncludeLayersDTO{" +
|
||||
"designItemId=" + designItemId +
|
||||
", designSingleItemDTOList=" + designSingleItemDTOList +
|
||||
", isPreview=" + isPreview +
|
||||
", processId='" + processId + '\'' +
|
||||
", timeZone='" + timeZone + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NoLoginRequiredDTO {
|
||||
private String browserIdentifiers;
|
||||
}
|
||||
@@ -1208,20 +1208,22 @@ public class PythonService {
|
||||
//如果包含Pin只传一个
|
||||
if (isPin) {
|
||||
List<CollectionElement> finalPinData = pinData;
|
||||
DesignPythonItem.OUTWEAR_DRESS_BLOUSE.forEach(type -> {
|
||||
//剩余的的PinData
|
||||
for (String type : DesignPythonItem.OUTWEAR_DRESS_BLOUSE) {
|
||||
// 剩余的的 PinData
|
||||
List<CollectionElement> residueInnerPinData = residuePinData(finalPinData, existPinDataIds, elementVO.getHasUseMd5List());
|
||||
CollectionElement elementNew = residueInnerPinData.stream()
|
||||
.filter(element -> element.getLevel2Type().equals(type)).findFirst().orElse(null);
|
||||
if (Objects.nonNull(elementNew)) {
|
||||
items.add(coverToDesignPythonItem(elementNew.getId(), type, elementNew.getUrl(), elementVO));
|
||||
//去重用
|
||||
// 去重用
|
||||
existPinDataIds.add(elementNew.getId());
|
||||
//添加md5
|
||||
// 添加md5
|
||||
elementVO.getHasUseMd5List().add(elementNew.getMd5());
|
||||
|
||||
// 提前结束循环
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,4 +115,10 @@ public interface AccountService extends IService<Account> {
|
||||
Boolean trialOrderRefuse(List<Long> ids);
|
||||
|
||||
Long getExpiredTime();
|
||||
|
||||
Boolean addNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
|
||||
|
||||
Boolean deleteNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
|
||||
|
||||
AccountLoginVO noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -566,4 +567,59 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
return accountMapper.selectById(userInfo.getId()).getValidEndTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO) {
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().isNotNull(Account::getBrowserIdentifiers);
|
||||
qw.lambda().like(Account::getUserName, "PolyU-SFT-");
|
||||
List<Account> accountList = accountMapper.selectList(qw);
|
||||
if (accountList.size() >= 100) {
|
||||
throw new BusinessException("The number of registered accounts exceeds the limit");
|
||||
}
|
||||
qw.lambda().eq(Account::getBrowserIdentifiers, noLoginRequiredDTO.getBrowserIdentifiers());
|
||||
if (!accountMapper.selectList(qw).isEmpty()) {
|
||||
throw new BusinessException("This browser has already been registered");
|
||||
}
|
||||
Account account = new Account();
|
||||
account.setUserName("PolyU-SFT-" + String.format("%03d", accountList.size() + 1));
|
||||
account.setUserPassword("Third-000000");
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(System.currentTimeMillis() + 365L * 24 * 60 * 60 * 1000);
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsBeginner(1);
|
||||
account.setIsTrial(0);
|
||||
account.setBrowserIdentifiers(noLoginRequiredDTO.getBrowserIdentifiers());
|
||||
accountMapper.insert(account);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO) {
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Account::getBrowserIdentifiers, noLoginRequiredDTO.getBrowserIdentifiers());
|
||||
accountMapper.delete(qw);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountLoginVO noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO) {
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Account::getBrowserIdentifiers, noLoginRequiredDTO.getBrowserIdentifiers());
|
||||
List<Account> accountList = accountMapper.selectList(qw);
|
||||
if (CollectionUtil.isEmpty(accountList)) {
|
||||
throw new BusinessException("This browser is not registered as login free");
|
||||
}
|
||||
Account account = accountList.get(0);
|
||||
AccountLoginVO response = CopyUtil.copyObject(account, AccountLoginVO.class);
|
||||
String token = LocalCacheUtils.getTokenCache(String.valueOf(account.getId()));
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
//用户已登入
|
||||
response.setToken(token);
|
||||
} else {
|
||||
response.setToken(createAccountToken(account));
|
||||
}
|
||||
response.setUserId(account.getId());
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
Integer timeout = 99999999;
|
||||
|
||||
@Value("${access.python.ip:''}")
|
||||
private String accessPythonIp;
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ChatRobotVO sendMessageToChatRobot(ChatSendDTO chatSendDTO) {
|
||||
@@ -142,7 +146,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
// .url("http://127.0.0.1:5000/api/chat_stream_test")
|
||||
.url("http://18.167.251.121:9991/api/chat_stream_test")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/chat_stream_test")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
|
||||
@@ -413,6 +413,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO) {
|
||||
log.info("designSingle request入参 ==> " + designSingleIncludeLayersDTO.toString());
|
||||
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = selectById(designSingleIncludeLayersDTO.getDesignItemId());
|
||||
if (Objects.isNull(designItem)) {
|
||||
|
||||
@@ -77,6 +77,11 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
@Value("${minio.bucketName.sysImage}")
|
||||
private String sysImage;
|
||||
|
||||
@Value("${access.python.ip:''}")
|
||||
private String accessPythonIp;
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
|
||||
@Resource
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
|
||||
@@ -292,7 +297,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
log.info("processMannequins请求python 参数:####{}", param);
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url("http://18.167.251.121:9991/api/model_process")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/model_process")
|
||||
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -349,7 +354,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
log.info("processSketchBoards请求python 参数:####{}", param);
|
||||
RequestBody body = RequestBody.create(mediaType, param);
|
||||
Request request = new Request.Builder()
|
||||
.url("http://18.167.251.121:9991/api/sketches_bounding_box")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/sketches_bounding_box")
|
||||
.method("POST", body)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
|
||||
@@ -50,7 +50,8 @@ spring.servlet.multipart.max-request-size= 5MB
|
||||
#access.python.ip=http://43.198.80.117
|
||||
access.python.ip=http://18.167.251.121
|
||||
#access.python.ip=http://18.167.251.121:9991/
|
||||
access.python.port=9992
|
||||
#access.python.port=9992
|
||||
access.python.port=9990
|
||||
|
||||
# minIO服务配置之信息
|
||||
minio.endpoint=https://www.minio.aida.com.hk:9000
|
||||
|
||||
85
src/main/resources/logback-spring.xml
Normal file
85
src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="./log" />
|
||||
<!-- 日志输出格式 -->
|
||||
<!--value为输出格式设置,用正则表达式格式化 d:时间 -->
|
||||
<!--<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %-5level %logger{36} - [%method,%line] - %msg%n" />-->
|
||||
<property name="log.pattern.console" value="${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
<property name="log.pattern.file" value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%15t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern.console}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<!--动态的创建一个文件,将日志写入到新的文件中-->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/aida-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/aida-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!--encoder 将事件转换为格式化后的日志记录,在文件中输出-->
|
||||
<encoder>
|
||||
<pattern>${log.pattern.file}</pattern>
|
||||
</encoder>
|
||||
<!--LevelFilter过滤器,对指定level的日志进行记录(或不记录),
|
||||
对不等于指定level的日志不记录(或记录)-->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 只会打印debug不会有info日志-->
|
||||
<!-- <level>DEBUG</level>-->
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/aida-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/aida-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern.file}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ai.da" level="debug" />
|
||||
<logger name="com.ai.da.mapper" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user