From 36e488e0aace2e07ad699df7b276143f7d7b3cd0 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 9 Jan 2024 13:52:03 +0800 Subject: [PATCH 01/11] =?UTF-8?q?TASK:docker=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=9B=9E=E9=80=80;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 6fbcab93514d151ecf945d680d415d3425671d72 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 9 Jan 2024 13:54:32 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=EF=BC=8C=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E5=88=B0=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 ++ .../security/filter/AuthenticationFilter.java | 12 +-- src/main/resources/logback-spring.xml | 84 +++++++++++++++++++ 3 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/logback-spring.xml 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..4b78233d 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 @@ -110,12 +110,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/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..e80db240 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + ${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 From ef6c8e85cb3c4bee947ad0f05c3b0d869de9f280 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 9 Jan 2024 17:44:17 +0800 Subject: [PATCH 03/11] =?UTF-8?q?TASK:python=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 0d9913ab..ff77a4e2 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -42,7 +42,7 @@ 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=9991 +access.python.port=9990 minio.endpoint=https://www.minio.aida.com.hk:9000 minio.accessKey=admin From 74ef15b88ec585f533d4f861ce003e8db1cbaff8 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 9 Jan 2024 18:05:49 +0800 Subject: [PATCH 04/11] =?UTF-8?q?mybatis-plus=20DEBUG=E7=BA=A7=E5=88=AB?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E4=B8=8D=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index e80db240..99a282ae 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -68,6 +68,7 @@ + From 39367f5fb703747c12b68ec1b8cb120b35945811 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Wed, 10 Jan 2024 10:48:48 +0800 Subject: [PATCH 05/11] =?UTF-8?q?TASK:=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ai/da/service/impl/ChatRobotServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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") From 10e80bfc27db5ab687f767daee4e137402cbdacd Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Wed, 10 Jan 2024 11:47:40 +0800 Subject: [PATCH 06/11] =?UTF-8?q?TASK:python=20IP=E7=AB=AF=E5=8F=A3;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ai/da/service/impl/LibraryServiceImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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") From 547272dfcf215db83629bacdc2905c2ceb2d7ab5 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Wed, 10 Jan 2024 14:02:17 +0800 Subject: [PATCH 07/11] =?UTF-8?q?BUGFIX:design=20pin=E9=80=BB=E8=BE=91;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/python/PythonService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; } - }); + } } } From fe0a736feb448eb0a2ba082f30f494f7b2c13ec1 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 10 Jan 2024 15:14:54 +0800 Subject: [PATCH 08/11] =?UTF-8?q?designSingle=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/model/dto/DesignSingleIncludeLayersDTO.java | 11 +++++++++++ .../com/ai/da/service/impl/DesignItemServiceImpl.java | 2 ++ 2 files changed, 13 insertions(+) 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/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)) { From 1b836175b16865e1466ad1bf63455d88ebc6a1e7 Mon Sep 17 00:00:00 2001 From: xupei Date: Fri, 12 Jan 2024 11:14:43 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E7=89=88=20python=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-test.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 62f9bb3795ed218ce6a68ccf66188e02c280b3e2 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Mon, 15 Jan 2024 15:06:48 +0800 Subject: [PATCH 10/11] =?UTF-8?q?TASK:=E6=9C=BA=E6=88=BF=E5=85=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B5=8B=E8=AF=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/filter/AuthenticationFilter.java | 1 + .../ai/da/controller/AccountController.java | 6 ++ .../da/controller/ThirdPartyController.java | 13 +++++ .../java/com/ai/da/mapper/entity/Account.java | 2 + .../ai/da/model/dto/NoLoginRequiredDTO.java | 8 +++ .../com/ai/da/service/AccountService.java | 6 ++ .../da/service/impl/AccountServiceImpl.java | 56 +++++++++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 src/main/java/com/ai/da/model/dto/NoLoginRequiredDTO.java 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 4b78233d..b1bfc6cd 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 @@ -45,6 +45,7 @@ public class AuthenticationFilter extends OncePerRequestFilter { "/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/python/chatStream", "/api/python/flush", "/api/account/healthy" 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/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/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; + } } From fc55a775f80b5a371ea0feda937960f22f0a72f7 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Mon, 15 Jan 2024 15:08:39 +0800 Subject: [PATCH 11/11] =?UTF-8?q?TASK:=E6=9C=BA=E6=88=BF=E5=85=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B5=8B=E8=AF=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/common/security/filter/AuthenticationFilter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b1bfc6cd..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,11 +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/addNoLoginRequired","/api/third/party/deleteNoLoginRequired", "/api/python/chatStream", "/api/python/flush", "/api/account/healthy"