diff --git a/docker-compose.yml b/docker-compose.yml
index b9bca48c..c1843a76 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -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"
\ No newline at end of file
+ - "10086:5567"
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f699d574..50c4b965 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,12 @@
org.springframework.boot
spring-boot-starter-validation
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
cn.hutool
hutool-all
diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
index 39b52960..1103242c 100644
--- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
+++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
@@ -41,10 +41,11 @@ public class AuthenticationFilter extends OncePerRequestFilter {
private SecurityProperties properties;
private static final List 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);
}
diff --git a/src/main/java/com/ai/da/controller/AccountController.java b/src/main/java/com/ai/da/controller/AccountController.java
index 0d45b622..4e5c54e2 100644
--- a/src/main/java/com/ai/da/controller/AccountController.java
+++ b/src/main/java/com/ai/da/controller/AccountController.java
@@ -143,4 +143,10 @@ public class AccountController {
public Response getExpiredTime(){
return Response.success(accountService.getExpiredTime());
}
+
+ @ApiOperation(value = "查询账号到期时间")
+ @PostMapping("/noLoginRequired")
+ public Response noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO){
+ return Response.success(accountService.noLoginRequired(noLoginRequiredDTO));
+ }
}
diff --git a/src/main/java/com/ai/da/controller/ThirdPartyController.java b/src/main/java/com/ai/da/controller/ThirdPartyController.java
index e3b45b3b..a9db8b2a 100644
--- a/src/main/java/com/ai/da/controller/ThirdPartyController.java
+++ b/src/main/java/com/ai/da/controller/ThirdPartyController.java
@@ -42,4 +42,17 @@ public class ThirdPartyController {
return Response.success(accountService.addTrialUser(accountTrialDTO));
}
+ @CrossOrigin
+ @ApiOperation(value = "add No Login Required")
+ @PostMapping("/addNoLoginRequired")
+ public Response addNoLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO) {
+ return Response.success(accountService.addNoLoginRequired(noLoginRequiredDTO));
+ }
+
+ @CrossOrigin
+ @ApiOperation(value = "add No Login Required")
+ @PostMapping("/deleteNoLoginRequired")
+ public Response deleteNoLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO) {
+ return Response.success(accountService.deleteNoLoginRequired(noLoginRequiredDTO));
+ }
}
diff --git a/src/main/java/com/ai/da/mapper/entity/Account.java b/src/main/java/com/ai/da/mapper/entity/Account.java
index 44a5755b..3dd607b6 100644
--- a/src/main/java/com/ai/da/mapper/entity/Account.java
+++ b/src/main/java/com/ai/da/mapper/entity/Account.java
@@ -78,4 +78,6 @@ public class Account implements Serializable {
private Integer isTrial;
private Integer isBeginner;
+
+ private String browserIdentifiers;
}
diff --git a/src/main/java/com/ai/da/model/dto/DesignSingleIncludeLayersDTO.java b/src/main/java/com/ai/da/model/dto/DesignSingleIncludeLayersDTO.java
index a7c99b21..76161990 100644
--- a/src/main/java/com/ai/da/model/dto/DesignSingleIncludeLayersDTO.java
+++ b/src/main/java/com/ai/da/model/dto/DesignSingleIncludeLayersDTO.java
@@ -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 + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/com/ai/da/model/dto/NoLoginRequiredDTO.java b/src/main/java/com/ai/da/model/dto/NoLoginRequiredDTO.java
new file mode 100644
index 00000000..661703fd
--- /dev/null
+++ b/src/main/java/com/ai/da/model/dto/NoLoginRequiredDTO.java
@@ -0,0 +1,8 @@
+package com.ai.da.model.dto;
+
+import lombok.Data;
+
+@Data
+public class NoLoginRequiredDTO {
+ private String browserIdentifiers;
+}
diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java
index 1b4fec5c..578de9ef 100644
--- a/src/main/java/com/ai/da/python/PythonService.java
+++ b/src/main/java/com/ai/da/python/PythonService.java
@@ -1208,20 +1208,22 @@ public class PythonService {
//如果包含Pin只传一个
if (isPin) {
List finalPinData = pinData;
- DesignPythonItem.OUTWEAR_DRESS_BLOUSE.forEach(type -> {
- //剩余的的PinData
+ for (String type : DesignPythonItem.OUTWEAR_DRESS_BLOUSE) {
+ // 剩余的的 PinData
List 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;
}
- });
+ }
}
}
diff --git a/src/main/java/com/ai/da/service/AccountService.java b/src/main/java/com/ai/da/service/AccountService.java
index 57ebf72f..b9089c54 100644
--- a/src/main/java/com/ai/da/service/AccountService.java
+++ b/src/main/java/com/ai/da/service/AccountService.java
@@ -115,4 +115,10 @@ public interface AccountService extends IService {
Boolean trialOrderRefuse(List ids);
Long getExpiredTime();
+
+ Boolean addNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
+
+ Boolean deleteNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
+
+ AccountLoginVO noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO);
}
diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
index 74c68055..c26aa6bf 100644
--- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
+++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java
@@ -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 impl
AuthPrincipalVo userInfo = UserContext.getUserHolder();
return accountMapper.selectById(userInfo.getId()).getValidEndTime();
}
+
+ @Override
+ public Boolean addNoLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.lambda().isNotNull(Account::getBrowserIdentifiers);
+ qw.lambda().like(Account::getUserName, "PolyU-SFT-");
+ List 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 qw = new QueryWrapper<>();
+ qw.lambda().eq(Account::getBrowserIdentifiers, noLoginRequiredDTO.getBrowserIdentifiers());
+ accountMapper.delete(qw);
+ return Boolean.TRUE;
+ }
+
+ @Override
+ public AccountLoginVO noLoginRequired(NoLoginRequiredDTO noLoginRequiredDTO) {
+ QueryWrapper qw = new QueryWrapper<>();
+ qw.lambda().eq(Account::getBrowserIdentifiers, noLoginRequiredDTO.getBrowserIdentifiers());
+ List 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;
+ }
}
diff --git a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java
index e94c5a3c..5f06a194 100644
--- a/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java
+++ b/src/main/java/com/ai/da/service/impl/ChatRobotServiceImpl.java
@@ -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")
diff --git a/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
index 2682a959..7b8853ca 100644
--- a/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
+++ b/src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
@@ -413,6 +413,8 @@ public class DesignItemServiceImpl extends ServiceImpl " + designSingleIncludeLayersDTO.toString());
+
AuthPrincipalVo userInfo = UserContext.getUserHolder();
DesignItem designItem = selectById(designSingleIncludeLayersDTO.getDesignItemId());
if (Objects.isNull(designItem)) {
diff --git a/src/main/java/com/ai/da/service/impl/LibraryServiceImpl.java b/src/main/java/com/ai/da/service/impl/LibraryServiceImpl.java
index 35b24038..bde22e96 100644
--- a/src/main/java/com/ai/da/service/impl/LibraryServiceImpl.java
+++ b/src/main/java/com/ai/da/service/impl/LibraryServiceImpl.java
@@ -77,6 +77,11 @@ public class LibraryServiceImpl extends ServiceImpl 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 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 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")
diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties
index 18e2ca91..9027b77f 100644
--- a/src/main/resources/application-test.properties
+++ b/src/main/resources/application-test.properties
@@ -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
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..99a282ae
--- /dev/null
+++ b/src/main/resources/logback-spring.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${log.pattern.console}
+
+
+
+
+
+
+ ${log.path}/aida-info.log
+
+
+
+ ${log.path}/aida-info.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+
+ ${log.pattern.file}
+
+
+
+
+
+
+ ACCEPT
+
+ DENY
+
+
+
+
+ ${log.path}/aida-error.log
+
+
+
+ ${log.path}/aida-error.%d{yyyy-MM-dd}.log
+
+ 60
+
+
+ ${log.pattern.file}
+
+
+
+ ERROR
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file