Compare commits
188 Commits
test/stabl
...
dev/dev_sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e28d579d1 | ||
|
|
1c96522447 | ||
| ea0332851d | |||
| a25a7dc023 | |||
|
|
b4fe1ca199 | ||
|
|
b315ae5644 | ||
|
|
8d6e3e9644 | ||
|
|
be1119be6f | ||
|
|
b836e7fd67 | ||
| a237b4041d | |||
| ea4cd29723 | |||
| 13397fa1f7 | |||
| 2fab472150 | |||
| 8c71b4845a | |||
| b70f909a32 | |||
|
|
9f064609e7 | ||
|
|
fd10d4dbc4 | ||
|
|
fadb5faf0d | ||
| e5e514b522 | |||
| 74e6d5a1da | |||
| 3cf0570912 | |||
|
|
8da51a0a82 | ||
|
|
37ff7fbb91 | ||
|
|
8c20b51e13 | ||
| 391a28d659 | |||
| 4535fb7dfb | |||
| 546d1b4c44 | |||
| 5fe605c130 | |||
| 4408c0ecc6 | |||
| 49f08d1191 | |||
| 903bafb245 | |||
| 59b02b3f28 | |||
| 4a23e33080 | |||
| 1e1b06fc48 | |||
| 7c56d2bf4e | |||
| 4add0a806c | |||
| c9bb7fe502 | |||
| a8a7a129c9 | |||
| c3c5532cb5 | |||
| 78bfc16287 | |||
|
|
6c6162df74 | ||
|
|
a837aff0fb | ||
|
|
f673afc7fc | ||
|
|
0ea96c728c | ||
|
|
77e71e3296 | ||
|
|
ce870b9acf | ||
|
|
7f889b54e0 | ||
|
|
ebd596d0d2 | ||
| 04ce95caa4 | |||
| 29bf172187 | |||
|
|
41619febb9 | ||
|
|
0f4b769d49 | ||
| 66cd8217b9 | |||
| e684c4e547 | |||
| c439f41d69 | |||
| 823e96b014 | |||
| 0cca24ee30 | |||
| 66cccd0867 | |||
| 463ddf3cb2 | |||
|
|
f0e0987f31 | ||
|
|
16bea58ab5 | ||
|
|
f2bbbaaeb6 | ||
|
|
5098f6f4a1 | ||
|
|
bc1815ae1b | ||
| 6256c90958 | |||
| f0bfe249e0 | |||
| 7bbfd7c506 | |||
| 3c7cbe28a1 | |||
| c834aacf3a | |||
| 90b0ef41e3 | |||
|
|
2aeeec4468 | ||
| a7c5723e10 | |||
|
|
ba595b9d2c | ||
|
|
d9118aaf93 | ||
| 1bdc71998b | |||
| a597f7a67a | |||
| 195964ef5a | |||
|
|
c27ca77717 | ||
|
|
7d0d460e5c | ||
| 5ac9df3056 | |||
| b8d64f1f28 | |||
| c8dd9664be | |||
| 8899a3a6bb | |||
|
|
67f56f9b84 | ||
|
|
fd12b9e571 | ||
| fb329c94aa | |||
| 16d06582ee | |||
|
|
6f98f111dd | ||
|
|
51a1c1d8e1 | ||
|
|
8445c23984 | ||
| 961f8f874e | |||
| 283b6244b1 | |||
| f19a15dbe8 | |||
| 791d44df02 | |||
|
|
28e67db78d | ||
|
|
63a120c652 | ||
|
|
f60cabbbc0 | ||
| 06db759749 | |||
|
|
373608d989 | ||
|
|
45e3dde03f | ||
|
|
3625180a6e | ||
| aae1442a6f | |||
| 08dcd03468 | |||
|
|
deda511e32 | ||
|
|
9bcf615b4b | ||
|
|
70912c4c43 | ||
|
|
fa013c1974 | ||
| 11fbeb1ed0 | |||
| f432b8cce6 | |||
|
|
05ddd33bcd | ||
|
|
9f5c901502 | ||
| 33d5d3a2ea | |||
| 2668dd3c47 | |||
| 2bc5fef175 | |||
| ea92e1f20d | |||
| 9f1cf1d90e | |||
| b43f9baead | |||
|
|
41ffe335fc | ||
|
|
56d0dcd25f | ||
|
|
4304acbe6f | ||
| 2f1b22d423 | |||
| 3eb8626831 | |||
| 5a86f2e649 | |||
| 93e9c61943 | |||
|
|
c5e9941adb | ||
| 56679808e9 | |||
|
|
40f5705e7a | ||
|
|
32975d9900 | ||
|
|
72db49e7f5 | ||
|
|
472f5e65b4 | ||
| e2f8fb082c | |||
| a47e53b19e | |||
| c01acec9e6 | |||
| 969d7586fc | |||
| 31a40ff7ca | |||
| afb9c99228 | |||
| 8ee6a529a0 | |||
| cebc05d132 | |||
| d23ac82b1b | |||
| e86b576050 | |||
| 8a774aa328 | |||
| c5da68dc47 | |||
| 28df672a7d | |||
| 203c88dd70 | |||
| fa86a2af45 | |||
| ac28ba233c | |||
|
|
47dc2bfc6e | ||
| 085dac0630 | |||
| 7b27b1362d | |||
| 704e3c25bf | |||
| 7e5b10aab3 | |||
| 3ccbd8f905 | |||
| 89a234e77d | |||
| 388dd54bfa | |||
| 035c4412f1 | |||
| d4eb7c846b | |||
| fef50d7a37 | |||
| e5a95972a5 | |||
|
|
36a796b38b | ||
| 94927ae0a4 | |||
| 4d7153661c | |||
| 76062136d6 | |||
| ea4ba74989 | |||
|
|
5a09d7a195 | ||
|
|
e0332b9ddf | ||
|
|
685ba09f7d | ||
|
|
7aa1fc0342 | ||
|
|
653264151a | ||
|
|
fada00c738 | ||
| a10d30337a | |||
| 85ffed114b | |||
| 1093ac68b6 | |||
| 71e6abd816 | |||
| 00c948116e | |||
| b6efd598bd | |||
| bfe7ad4aa6 | |||
| 018ccef46a | |||
| feb836f849 | |||
| 0106f21b86 | |||
| 1b5f64785d | |||
| 77a4aee88e | |||
|
|
ce1e2f3eab | ||
|
|
75fbd2844b | ||
|
|
832f331603 | ||
| 9a2d58d922 | |||
|
|
34c4cd47ef | ||
| c46f65600f | |||
| aa1eb7411e |
34
pom.xml
34
pom.xml
@@ -276,6 +276,40 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
<version>5.5.13.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.auth</groupId>
|
||||
<artifactId>google-auth-library-oauth2-http</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.api-client</groupId>
|
||||
<artifactId>google-api-client</artifactId>
|
||||
<version>1.32.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.oauth-client</groupId>
|
||||
<artifactId>google-oauth-client</artifactId>
|
||||
<version>1.32.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.http-client</groupId>
|
||||
<artifactId>google-http-client-jackson2</artifactId>
|
||||
<version>1.41.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.apache.tomcat.jni.Time;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -30,6 +31,9 @@ public class GenerateConsumer {
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@@ -243,73 +247,73 @@ public class GenerateConsumer {
|
||||
log.info("============ProcessRelightResult End listening==========");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer1(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 1");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer2(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 2");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer3(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 3");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer4(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 4");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer5(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 5");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer6(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 6");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer7(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 7");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer8(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 8");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generate}")
|
||||
@RabbitHandler
|
||||
public void generateConsumer9(Message msg, Channel channel) {
|
||||
generate(msg, channel, "consumer 9");
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.GENERATE_RESULT_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.generateResult}")
|
||||
@RabbitHandler
|
||||
public void getGenerateResult(Message msg, Channel channel) {
|
||||
processGenerateResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.TO_PRODUCT_IMAGE_RESULT_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.toProductImageResult}")
|
||||
@RabbitHandler
|
||||
public void getToProductImageResult(Message msg, Channel channel) {
|
||||
processToProductImageResult(msg, channel);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.RELIGHT_RESULT_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.relightResult}")
|
||||
@RabbitHandler
|
||||
public void getRelightResult(Message msg, Channel channel) {
|
||||
processRelightResult(msg, channel);
|
||||
|
||||
@@ -1,66 +1,43 @@
|
||||
package com.ai.da.common.RabbitMQ;
|
||||
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MQConfig {
|
||||
|
||||
public static final String GENERATE_EXCHANGE_FANOUT = "generate-exchange";
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-prod";
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-test";
|
||||
// ==================================================================
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-local";
|
||||
// public static final String GENERATE_QUEUE = "generate-queue-dev";
|
||||
public static final String GENERATE_QUEUE = "generate-queue-prod";
|
||||
//
|
||||
// public static final String SR_QUEUE = "SR-queue-local";
|
||||
// public static final String SR_QUEUE = "SR-queue-dev";
|
||||
public static final String SR_QUEUE = "SR-queue-prod";
|
||||
//
|
||||
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
|
||||
// public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
|
||||
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
|
||||
//
|
||||
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
|
||||
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
public static final String TO_PRODUCT_IMAGE_RESULT_QUEUE = "ToProductImage-prod";
|
||||
|
||||
public static final String RELIGHT_RESULT_QUEUE = "Relight-prod";
|
||||
public MQConfig() {
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// FanoutExchange fanoutRasaExchange() {
|
||||
// return new FanoutExchange(GENERATE_EXCHANGE_FANOUT);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 创建队列,使用工作模式,不用定义交换机
|
||||
*/
|
||||
@Bean
|
||||
public Queue generateQueue() {
|
||||
return new Queue(GENERATE_QUEUE);
|
||||
return new Queue(rabbitMQProperties.getQueues().getGenerate());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue SRQueue() {
|
||||
return new Queue(SR_QUEUE);
|
||||
return new Queue(rabbitMQProperties.getQueues().getSr());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue SRResultQueue() {
|
||||
return new Queue(SR_RESULT_QUEUE);
|
||||
return new Queue(rabbitMQProperties.getQueues().getSrResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将队列绑定到交换机上【队列订阅交换机】
|
||||
*/
|
||||
// @Bean
|
||||
// Binding bindingExchangeRasa() {
|
||||
// return BindingBuilder.bind(queueRasa()).to(fanoutRasaExchange());
|
||||
// }
|
||||
@Bean
|
||||
public Queue generateResultQueue() {
|
||||
return new Queue(rabbitMQProperties.getQueues().getGenerateResult());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue toProductImageResultQueue() {
|
||||
return new Queue(rabbitMQProperties.getQueues().getToProductImageResult());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue relightResultQueue() {
|
||||
return new Queue(rabbitMQProperties.getQueues().getRelightResult());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.common.RabbitMQ;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -10,19 +11,19 @@ import javax.annotation.Resource;
|
||||
@Component
|
||||
public class MQPublisher {
|
||||
|
||||
// private final String url = "http://localhost:15672/api/queues/%2f/generate-queue";
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private AmqpTemplate amqpTemplate;
|
||||
|
||||
public void sendGenerateMessage(String mm) {
|
||||
log.info("send message:" + mm);
|
||||
amqpTemplate.convertAndSend(MQConfig.GENERATE_QUEUE, mm);
|
||||
log.info("send message: " + mm);
|
||||
amqpTemplate.convertAndSend(rabbitMQProperties.getQueues().getGenerate(), mm);
|
||||
}
|
||||
|
||||
public void sendSRMessage(String mm) {
|
||||
log.info("send message:" + mm);
|
||||
amqpTemplate.convertAndSend(MQConfig.SR_QUEUE, mm);
|
||||
log.info("send message: " + mm);
|
||||
amqpTemplate.convertAndSend(rabbitMQProperties.getQueues().getSr(), mm);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ai.da.common.RabbitMQ;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "rabbitmq")
|
||||
@Data
|
||||
public class RabbitMQProperties {
|
||||
|
||||
private Queues queues;
|
||||
private Exchange exchange;
|
||||
|
||||
@Data
|
||||
public static class Queues {
|
||||
private String generate;
|
||||
private String sr;
|
||||
private String srResult;
|
||||
private String generateResult;
|
||||
private String toProductImageResult;
|
||||
private String relightResult;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Exchange {
|
||||
private String generate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -27,6 +28,9 @@ import java.util.HashMap;
|
||||
@Component
|
||||
public class SRConsumer {
|
||||
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@@ -218,14 +222,13 @@ public class SRConsumer {
|
||||
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
|
||||
}
|
||||
|
||||
@RabbitListener(queues = MQConfig.SR_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.sr}")
|
||||
@RabbitHandler
|
||||
public void SRConsumer1(Message msg, Channel channel) {
|
||||
superResolution(msg, channel, "consumer 1");
|
||||
}
|
||||
|
||||
|
||||
@RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
|
||||
@RabbitListener(queues = "#{rabbitMQProperties.queues.srResult}")
|
||||
@RabbitHandler
|
||||
public void SRResultConsumer1(Message msg, Channel channel) {
|
||||
getSRResult(msg, channel, "consumer 1");
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.ai.da.common.utils.SendEmailUtil;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||
import com.ai.da.model.enums.StyleEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
@@ -31,7 +33,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MyTaskScheduler {
|
||||
|
||||
@@ -49,7 +51,7 @@ public class MyTaskScheduler {
|
||||
|
||||
// 定时任务,每十五天执行一次
|
||||
// @Scheduled(cron = "0 0 0 ? * MON")
|
||||
@Scheduled(cron = "0 0 0 */15 * ?")
|
||||
// @Scheduled(cron = "0 0 0 */15 * ?")
|
||||
public void checkExpiry() {
|
||||
// 检测正式用户是否快要过期
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
@@ -83,7 +85,7 @@ public class MyTaskScheduler {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Scheduled(cron = "0 0 8 * * ?")
|
||||
// @Scheduled(cron = "0 0 9 * * ?")
|
||||
public void sendTrialOrderExcelToManagements() {
|
||||
// 获取前一天日期
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
@@ -219,29 +221,47 @@ public class MyTaskScheduler {
|
||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
|
||||
public void addSystemFileStyle() {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
// ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
try {
|
||||
String[] filePaths = {
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Blouse style output updated25.6.2024.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Dress style output updated25.6.2024.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Outerwear style output.xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Skirt style output .xlsx",
|
||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Trousers style output.xlsx"
|
||||
};
|
||||
// try {
|
||||
// String[] filePaths = {
|
||||
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens bottom style output.xlsx",
|
||||
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens outer style output.xlsx",
|
||||
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens top style output.xlsx"
|
||||
//// "/workspace/shb/Mens_bottom_style_output.xlsx",
|
||||
//// "/workspace/shb/Mens_outer_style_output.xlsx",
|
||||
//// "/workspace/shb/Mens_top_style_output.xlsx"
|
||||
// };
|
||||
//
|
||||
// for (String filePath : filePaths) {
|
||||
//// executorService.submit(() -> processExcelFile(filePath));
|
||||
// processExcelFile(filePath);
|
||||
// }
|
||||
// }catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
// } finally {
|
||||
// executorService.shutdown();
|
||||
// try {
|
||||
// if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
||||
// executorService.shutdownNow();
|
||||
// }
|
||||
// } catch (InterruptedException e) {
|
||||
// executorService.shutdownNow();
|
||||
// }
|
||||
// }
|
||||
String[] filePaths = {
|
||||
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens bottom style output.xlsx",
|
||||
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens outer style output.xlsx",
|
||||
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens top style output.xlsx"
|
||||
// "/workspace/shb/Mens_bottom_style_output.xlsx",
|
||||
// "/workspace/shb/Mens_outer_style_output.xlsx",
|
||||
// "/workspace/shb/Mens_top_style_output.xlsx"
|
||||
};
|
||||
|
||||
for (String filePath : filePaths) {
|
||||
executorService.submit(() -> processExcelFile(filePath));
|
||||
}
|
||||
} finally {
|
||||
executorService.shutdown();
|
||||
try {
|
||||
if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
executorService.shutdownNow();
|
||||
}
|
||||
for (String filePath : filePaths) {
|
||||
// executorService.submit(() -> processExcelFile(filePath));
|
||||
processExcelFile(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,6 +283,37 @@ public class MyTaskScheduler {
|
||||
attributeRetrievalMapper.updateStyleByFileName("X", prefix + fileName, tableName);
|
||||
System.out.println(fileName);
|
||||
} else {
|
||||
// if (style.equals("Y2K 风")) {
|
||||
// StyleEnum.COUNTRY_STYLE
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }else if (style.equals("")) {
|
||||
//
|
||||
// }
|
||||
attributeRetrievalMapper.updateStyleByFileName(style, prefix + fileName, tableName);
|
||||
System.out.println(fileName);
|
||||
}
|
||||
@@ -284,6 +335,12 @@ public class MyTaskScheduler {
|
||||
return "female_skirt";
|
||||
} else if (filePath.contains("Trousers")) {
|
||||
return "female_pants";
|
||||
} else if (filePath.contains("bottom")) {
|
||||
return "male_bottom";
|
||||
} else if (filePath.contains("outer")) {
|
||||
return "male_outwear";
|
||||
} else if (filePath.contains("top")) {
|
||||
return "male_top";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -299,6 +356,12 @@ public class MyTaskScheduler {
|
||||
return "skirt/";
|
||||
} else if (filePath.contains("Trousers")) {
|
||||
return "trousers/";
|
||||
} else if (filePath.contains("bottom")) {
|
||||
return "bottom/";
|
||||
} else if (filePath.contains("outer")) {
|
||||
return "outer/";
|
||||
} else if (filePath.contains("top")) {
|
||||
return "top/";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ai.da.common.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CommonConstant {
|
||||
// 单位 秒 10分钟过期
|
||||
// public static final Long TASK_EXPIRE_TIME = 24 * 60 * 60L;
|
||||
@@ -31,6 +34,46 @@ public class CommonConstant {
|
||||
|
||||
public static final String PYTHON_PORT_9997 = "9997";
|
||||
|
||||
public static final List<String> AGES_EN = Arrays.asList("Below 20", "20-30", "30-40", "40+");
|
||||
|
||||
public static final List<String> AGES_CN = Arrays.asList("20岁以下", "20-30岁", "30-40岁", "40+岁");
|
||||
public static final List<String> IF_HELPFUL_EN = Arrays.asList("Easy to learn and use", "Easy to get trend information",
|
||||
"Lots of creative design proposals","The AIGC functions for moodboard is helpful","The AIGC functions for design sketches is helpful",
|
||||
"Easy to select the right color","The Chatbot function is helpful","The print position function is helpful",
|
||||
"The drawing function is helpful","The export function is useful","Easy to edit the design","Others");
|
||||
|
||||
public static final List<String> IF_HELPFUL_CN = Arrays.asList("易于学习和使用", "容易获取趋势信息",
|
||||
"提供大量创意设计方案","AIGC功能对灵感板有帮助","AIGC功能对设计草图有帮助",
|
||||
"容易选择合适的颜色","聊天机器人功能有帮助","打印位置功能有帮助",
|
||||
"绘图功能有帮助","导出功能有用","设计编辑简单","其他");
|
||||
|
||||
public static final List<String> IF_IMPROVE_EN = Arrays.asList("Proposed designs are boring, need more interesting designs",
|
||||
"Difficult to make changes on design","Only 2D output, no 3D results","Difficult to apply keywords for AIGC generation",
|
||||
"Clothing is not in the right proportion","Not compatible with pattern making solutions","Improved user interface for better navigation",
|
||||
"Lack of responsive customer support","Insufficient tutorial or guidance for new users","Limited personalization options for designs","Others");
|
||||
|
||||
public static final List<String> IF_IMPROVE_CN = Arrays.asList("提供的设计很无聊,需要更多有趣的设计",
|
||||
"设计修改困难","只有2D输出,没有3D结果","难以选择合适的关键词应用于AIGC生成",
|
||||
"服装比例不正确","与打版解决方案不兼容","改进用户界面以便更好导航",
|
||||
"客户支持响应不及时","对新用户的教程或指导不足","设计个性化选项有限","其他");
|
||||
|
||||
public static final List<String> IS_SUBSCRIBE = Arrays.asList("yes", "no");
|
||||
|
||||
// public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.jpg";
|
||||
public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.png";
|
||||
|
||||
/* 截止至2024/08/26,在Code-Create DB中pmr_users表中最大的用户id */
|
||||
public static final Long MAXIMUM_USER_ID = 704L;
|
||||
// public static final Long MAXIMUM_USER_ID = 225L;
|
||||
|
||||
// 激活更改邮箱 链接有效期 毫秒 3天
|
||||
public static final Long CHANGE_MAILBOX_LINK_VALIDITY = 259200000L;
|
||||
|
||||
public static final String RCA_WORKSHOP_TAG = "#RCAworkshop_2024";
|
||||
|
||||
public static final String PORTFOLIO_DELETED_EN = "Portfolio has been deleted";
|
||||
|
||||
public static final String PORTFOLIO_DELETED_CN = "作品已删除";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@ public enum AuthenticationOperationTypeEnum {
|
||||
/**
|
||||
* 忘记密码
|
||||
*/
|
||||
FORGET_PWD;
|
||||
FORGET_PWD,
|
||||
/**
|
||||
* 更改邮箱
|
||||
*/
|
||||
CHANGE_MAILBOX;
|
||||
|
||||
public static AuthenticationOperationTypeEnum of(String name) {
|
||||
return Stream.of(AuthenticationOperationTypeEnum.values()).filter(v -> v.name().equals(name)).findFirst().orElse(null);
|
||||
|
||||
@@ -31,6 +31,7 @@ public enum CreditsEventsEnum {
|
||||
TO_PRODUCT_IMAGE("ToProductImage","5"),
|
||||
RELIGHT("Relight","5"),
|
||||
QUESTIONNAIRE("Questionnaire","100"),
|
||||
IMAGE_TO_SKETCH("ImageToSketch","5"),
|
||||
|
||||
OTHER("Other","5");
|
||||
|
||||
|
||||
@@ -1,133 +1,134 @@
|
||||
package com.ai.da.common.security.filter;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.security.config.SecurityProperties;
|
||||
import com.ai.da.common.security.jwt.JWTTokenHelper;
|
||||
import com.ai.da.common.utils.LocalCacheUtils;
|
||||
import com.ai.da.common.utils.MultiReadHttpServletRequest;
|
||||
import com.ai.da.common.utils.MultiReadHttpServletResponse;
|
||||
import com.ai.da.common.utils.RequestInfoUtil;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.security.sasl.AuthenticationException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: dangweijian
|
||||
* @description: 认证拦截器
|
||||
* @create: 2020-07-10 16:50
|
||||
**/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
private JWTTokenHelper jwtTokenHelper;
|
||||
@Resource
|
||||
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","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/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew",
|
||||
"/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
|
||||
"/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
|
||||
"/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
|
||||
"/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify"
|
||||
);
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
|
||||
String requestURI = httpServletRequest.getRequestURI();
|
||||
|
||||
if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
HttpServletRequest wrappedRequest = httpServletRequest;
|
||||
HttpServletResponse wrappedResponse = httpServletResponse;
|
||||
try {
|
||||
stopWatch.start();
|
||||
if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
|
||||
extracted(wrappedRequest);
|
||||
filterChain.doFilter(wrappedRequest, wrappedResponse);
|
||||
} else {
|
||||
wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
|
||||
wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
|
||||
extracted(wrappedRequest);
|
||||
filterChain.doFilter(wrappedRequest, wrappedResponse);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SecurityContextHolder.clearContext();
|
||||
throw e;
|
||||
} finally {
|
||||
stopWatch.stop();
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean calculateUrl(String requestURI) {
|
||||
String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
|
||||
return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
||||
private boolean hasAuthorizationToken(HttpServletRequest request) {
|
||||
String authorizationHeader = request.getHeader("Authorization");
|
||||
return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
|
||||
}
|
||||
|
||||
private void extracted(HttpServletRequest request) throws AuthenticationException {
|
||||
String jwtToken = request.getHeader(properties.getJwtTokenHeader());
|
||||
// log.debug("后台检查令牌:{}", jwtToken);
|
||||
|
||||
if (StrUtil.isBlank(jwtToken)) {
|
||||
String ipAddress = RequestInfoUtil.getIpAddress(request);
|
||||
log.info("本次请求的ip为 : " + ipAddress);
|
||||
throw new RuntimeException("请传入token!");
|
||||
}
|
||||
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
|
||||
//写死 暂时放行
|
||||
return;
|
||||
}
|
||||
// 检查token
|
||||
boolean validate = jwtTokenHelper.validateToken(jwtToken);
|
||||
if (validate) {
|
||||
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
|
||||
if (principal == null) {
|
||||
throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
}
|
||||
//先清空当前线程变量,防止上一个线程遗留
|
||||
UserContext.delete();
|
||||
//存取用户信息到缓存
|
||||
UserContext.setUserHolder(principal);
|
||||
//校验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已过期,请重新登录!");
|
||||
}
|
||||
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
|
||||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.ai.da.common.security.filter;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.security.config.SecurityProperties;
|
||||
import com.ai.da.common.security.jwt.JWTTokenHelper;
|
||||
import com.ai.da.common.utils.LocalCacheUtils;
|
||||
import com.ai.da.common.utils.MultiReadHttpServletRequest;
|
||||
import com.ai.da.common.utils.MultiReadHttpServletResponse;
|
||||
import com.ai.da.common.utils.RequestInfoUtil;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.security.sasl.AuthenticationException;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: dangweijian
|
||||
* @description: 认证拦截器
|
||||
* @create: 2020-07-10 16:50
|
||||
**/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
private JWTTokenHelper jwtTokenHelper;
|
||||
@Resource
|
||||
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","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/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew","/api/third/party/updateNoLoginRequiredNew",
|
||||
"/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
|
||||
"/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
|
||||
"/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
|
||||
"/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify",
|
||||
"/notification","/api/account/activateNewEmail","/api/third/party/auth/google_callback","/api/third/party/parseGoogleCredential","/api/third/party/receiveDesignResults","/api/third/party/parseWeChatCode"
|
||||
);
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
|
||||
String requestURI = httpServletRequest.getRequestURI();
|
||||
|
||||
if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
HttpServletRequest wrappedRequest = httpServletRequest;
|
||||
HttpServletResponse wrappedResponse = httpServletResponse;
|
||||
try {
|
||||
stopWatch.start();
|
||||
if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
|
||||
extracted(wrappedRequest);
|
||||
filterChain.doFilter(wrappedRequest, wrappedResponse);
|
||||
} else {
|
||||
wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
|
||||
wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
|
||||
extracted(wrappedRequest);
|
||||
filterChain.doFilter(wrappedRequest, wrappedResponse);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SecurityContextHolder.clearContext();
|
||||
throw e;
|
||||
} finally {
|
||||
stopWatch.stop();
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean calculateUrl(String requestURI) {
|
||||
String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
|
||||
return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
||||
private boolean hasAuthorizationToken(HttpServletRequest request) {
|
||||
String authorizationHeader = request.getHeader("Authorization");
|
||||
return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
|
||||
}
|
||||
|
||||
private void extracted(HttpServletRequest request) throws AuthenticationException {
|
||||
String jwtToken = request.getHeader(properties.getJwtTokenHeader());
|
||||
// log.debug("后台检查令牌:{}", jwtToken);
|
||||
|
||||
if (StrUtil.isBlank(jwtToken)) {
|
||||
String ipAddress = RequestInfoUtil.getIpAddress(request);
|
||||
log.info("本次请求的ip为 : " + ipAddress);
|
||||
throw new RuntimeException("请传入token!");
|
||||
}
|
||||
if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
|
||||
//写死 暂时放行
|
||||
return;
|
||||
}
|
||||
// 检查token
|
||||
boolean validate = jwtTokenHelper.validateToken(jwtToken);
|
||||
if (validate) {
|
||||
AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
|
||||
if (principal == null) {
|
||||
throw new RuntimeException("TOKEN已过期,请重新登录!");
|
||||
}
|
||||
//先清空当前线程变量,防止上一个线程遗留
|
||||
UserContext.delete();
|
||||
//存取用户信息到缓存
|
||||
UserContext.setUserHolder(principal);
|
||||
//校验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已过期,请重新登录!");
|
||||
}
|
||||
// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
|
||||
// SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.common.security.jwt;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.security.config.SecurityProperties;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -30,6 +31,7 @@ public class JWTTokenHelper {
|
||||
|
||||
private static final String ISSUER = "DWJ";
|
||||
private static final String AUTHORITIES = "authorities";
|
||||
private static final String CHANGE_MAILBOX = "changeMailbox";
|
||||
|
||||
public String createToken(AuthPrincipalVo principal) {
|
||||
String token = Jwts.builder()
|
||||
@@ -65,4 +67,21 @@ public class JWTTokenHelper {
|
||||
token = token.replaceAll(securityProperties.getJwtTokenPrefix(), "");
|
||||
return Jwts.parser().setSigningKey(securityProperties.getJwtSecret()).parseClaimsJws(token).getBody();
|
||||
}
|
||||
|
||||
public String createToken(Long userId, String userEmail){
|
||||
String token = Jwts.builder()
|
||||
.setId(String.valueOf(userId))
|
||||
.setSubject(userEmail + "_" + userId)
|
||||
.setIssuedAt(new Date())
|
||||
.setIssuer(ISSUER)
|
||||
.claim(CHANGE_MAILBOX, JSON.toJSONString(new ArrayList<>()))//自定义属性 权限
|
||||
.setExpiration(new Date(System.currentTimeMillis() + CommonConstant.CHANGE_MAILBOX_LINK_VALIDITY))
|
||||
.signWith(SignatureAlgorithm.HS256, securityProperties.getJwtSecret())
|
||||
.compact();
|
||||
return token;
|
||||
}
|
||||
|
||||
public String parseToEmailAndId(String token) {
|
||||
return parser(token).getSubject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.ai.da.common.task;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.service.AccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -14,18 +16,55 @@ public class AccountTask {
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
/** 每周日晚上刷新 年付用户、月付用户的积分 */
|
||||
/**
|
||||
* 每周日晚上刷新 年付用户、月付用户的积分
|
||||
*/
|
||||
@Scheduled(cron = "59 59 23 ? * SUN")
|
||||
// @Scheduled(cron = "59 59 23 * * ?")
|
||||
public void refreshCreditsMonthly(){
|
||||
public void refreshCreditsMonthly() {
|
||||
log.info("每周日晚11:59:59刷新付费用户积分为 6000");
|
||||
accountService.refreshCreditsWeekly();
|
||||
}
|
||||
|
||||
// todo 多久执行一次?
|
||||
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||
public void getPaidUser(){
|
||||
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||
public void getPaidUser() {
|
||||
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
||||
accountService.extendValidityForCC();
|
||||
}
|
||||
|
||||
// 每天凌晨0点执行一次
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
public void cancelActivityBenefits() {
|
||||
// 1、查询当前所有参与了活动且过期的用户
|
||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
||||
|
||||
// 2、将到期用户置为游客
|
||||
for (Account account : accountList) {
|
||||
log.info("参与活动的用户{} : {} 于 {} 账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
||||
accountService.toVisitor(account);
|
||||
}
|
||||
}
|
||||
|
||||
// 每天检测正式用户到期情况,每天凌晨0点执行
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
public void paidUserToVisitor() {
|
||||
// 1、查询当前已过期正式用户或试用用户
|
||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(1);
|
||||
accountList.addAll(accountService.getExpiredUserBySystemUser(2));
|
||||
accountList.addAll(accountService.getExpiredUserBySystemUser(3));
|
||||
|
||||
// 2、将到期用户置为游客
|
||||
for (Account account : accountList) {
|
||||
log.info("用户{} : {} 于 {}账号有效期到期,置为游客", account.getId(), account.getUserEmail(), account.getValidEndTime());
|
||||
accountService.toVisitor(account);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Code-Create上注册的用户添加为AiDA的游客
|
||||
*/
|
||||
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||
public void registerUserToVisitor() {
|
||||
accountService.registerUserToVisitor();
|
||||
}
|
||||
}
|
||||
|
||||
216
src/main/java/com/ai/da/common/task/MoveDataScheduler.java
Normal file
216
src/main/java/com/ai/da/common/task/MoveDataScheduler.java
Normal file
@@ -0,0 +1,216 @@
|
||||
//package com.ai.da.common.task;
|
||||
//
|
||||
//import com.ai.da.common.utils.CopyUtil;
|
||||
//import com.ai.da.common.utils.ExcelReader;
|
||||
//import com.ai.da.common.utils.MinioUtil;
|
||||
//import com.ai.da.common.utils.SendEmailUtil;
|
||||
//import com.ai.da.mapper.primary.*;
|
||||
//import com.ai.da.mapper.primary.entity.*;
|
||||
//import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||
//import com.ai.da.mapper.third.*;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.apache.poi.ss.usermodel.Row;
|
||||
//import org.apache.poi.ss.usermodel.Sheet;
|
||||
//import org.apache.poi.ss.usermodel.Workbook;
|
||||
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import javax.annotation.PostConstruct;
|
||||
//import javax.annotation.Resource;
|
||||
//import java.io.FileOutputStream;
|
||||
//import java.io.IOException;
|
||||
//import java.nio.file.Files;
|
||||
//import java.nio.file.Paths;
|
||||
//import java.time.LocalDate;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//import java.util.List;
|
||||
//import java.util.concurrent.ExecutorService;
|
||||
//import java.util.concurrent.Executors;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
//@Component
|
||||
//public class MoveDataScheduler {
|
||||
//
|
||||
// @PostConstruct
|
||||
// public void test() {
|
||||
// moveData();
|
||||
// }
|
||||
//
|
||||
// @Resource
|
||||
// private UserLikeGroupMapper userLikeGroupMapper;
|
||||
// @Resource
|
||||
// private UserLikeGroupZSMapper userLikeGroupZSMapper;
|
||||
// @Resource
|
||||
// private UserLikeMapper userLikeMapper;
|
||||
// @Resource
|
||||
// private UserLikeZSMapper userLikeZSMapper;
|
||||
// @Resource
|
||||
// private CollectionElementMapper collectionElementMapper;
|
||||
// @Resource
|
||||
// private CollectionElementZSMapper collectionElementZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private CollectionMapper collectionMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private CollectionZSMapper collectionZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignMapper designMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignZSMapper designZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignItemMapper designItemMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignItemZSMapper designItemZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private TDesignPythonOutfitZSMapper designPythonOutfitZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private TDesignPythonOutfitDetailZSMapper designPythonOutfitDetailZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignItemDetailMapper designItemDetailMapper;
|
||||
// @Resource
|
||||
// private DesignItemZSDetailMapper designItemDetailZSMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
//
|
||||
// @Resource
|
||||
// private DesignItemDetailPrintZSMapper designItemDetailPrintZSMapper;
|
||||
//
|
||||
//
|
||||
// private void moveData() {
|
||||
// // 查询用户所有history记录
|
||||
// QueryWrapper<UserLikeGroup> userLikeGroupQueryWrapper = new QueryWrapper<>();
|
||||
// userLikeGroupQueryWrapper.lambda().eq(UserLikeGroup::getAccountId, 11411);
|
||||
// List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(userLikeGroupQueryWrapper);
|
||||
//
|
||||
// for (UserLikeGroup userLikeGroup : userLikeGroupList) {
|
||||
//
|
||||
// com.ai.da.mapper.third.entity.UserLikeGroup userLikeGroupZS = CopyUtil.copyObject(userLikeGroup, com.ai.da.mapper.third.entity.UserLikeGroup.class);
|
||||
// userLikeGroupZS.setAccountId(11420L);
|
||||
// userLikeGroupZS.setId(null);
|
||||
// Collection collection = collectionMapper.selectById(userLikeGroup.getCollectionId());
|
||||
// com.ai.da.mapper.third.entity.Collection collectionZS = CopyUtil.copyObject(collection, com.ai.da.mapper.third.entity.Collection.class);
|
||||
// collectionZS.setAccountId(11420L);
|
||||
// collectionZS.setId(null);
|
||||
//
|
||||
// if (collection.getMoodTemplateId() != null) {
|
||||
// CollectionElement element = collectionElementMapper.selectById(collection.getMoodTemplateId());
|
||||
// com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(element, com.ai.da.mapper.third.entity.CollectionElement.class);
|
||||
// collectionElementZS.setAccountId(11420L);
|
||||
// collectionElementZS.setId(null);
|
||||
// collectionElementZSMapper.insert(collectionElementZS);
|
||||
// collectionZS.setMoodTemplateId(String.valueOf(collectionElementZS.getId()));
|
||||
// }
|
||||
// collectionZSMapper.insert(collectionZS);
|
||||
// userLikeGroupZS.setCollectionId(collectionZS.getId());
|
||||
// userLikeGroupZSMapper.insert(userLikeGroupZS);
|
||||
//
|
||||
// // 生成元素
|
||||
// QueryWrapper<CollectionElement> collectionElementQueryWrapper = new QueryWrapper<>();
|
||||
// collectionElementQueryWrapper.lambda().eq(CollectionElement::getCollectionId, userLikeGroup.getCollectionId());
|
||||
// List<CollectionElement> collectionElements = collectionElementMapper.selectList(collectionElementQueryWrapper);
|
||||
//
|
||||
// for (CollectionElement collectionElement : collectionElements) {
|
||||
// com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(collectionElement, com.ai.da.mapper.third.entity.CollectionElement.class);
|
||||
// collectionElementZS.setId(null);
|
||||
// collectionElementZS.setAccountId(11420L);
|
||||
// collectionElementZS.setCollectionId(collectionZS.getId());
|
||||
// collectionElementZSMapper.insert(collectionElementZS);
|
||||
// }
|
||||
//
|
||||
// // 查询记录关联
|
||||
// QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
|
||||
// userLikeQueryWrapper.lambda().eq(UserLike::getUserLikeGroupId, userLikeGroup.getId());
|
||||
// List<UserLike> userLikes = userLikeMapper.selectList(userLikeQueryWrapper);
|
||||
// for (UserLike userLike : userLikes) {
|
||||
// Design design = designMapper.selectById(userLike.getDesignId());
|
||||
// com.ai.da.mapper.third.entity.Design designZS = CopyUtil.copyObject(design, com.ai.da.mapper.third.entity.Design.class);
|
||||
// designZS.setId(null);
|
||||
// designZS.setAccountId(11420L);
|
||||
// designZS.setCollectionId(collectionZS.getId());
|
||||
// designZSMapper.insert(designZS);
|
||||
//
|
||||
// com.ai.da.mapper.third.entity.UserLike userLikeZS = CopyUtil.copyObject(userLike, com.ai.da.mapper.third.entity.UserLike.class);
|
||||
//// Design design = designMapper.selectById(userLike.getDesignId());
|
||||
// userLikeZS.setId(null);
|
||||
// DesignItem designItem = designItemMapper.selectById(userLike.getDesignItemId());
|
||||
// com.ai.da.mapper.third.entity.DesignItem designItemZS = CopyUtil.copyObject(designItem, com.ai.da.mapper.third.entity.DesignItem.class);
|
||||
// designItemZS.setId(null);
|
||||
// designItemZS.setAccountId(11420L);
|
||||
// designItemZS.setDesignId(designZS.getId());
|
||||
// designItemZSMapper.insert(designItemZS);
|
||||
//
|
||||
// QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
|
||||
// designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItem.getId());
|
||||
// List<DesignItemDetail> designItemDetails = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
|
||||
// for (DesignItemDetail designItemDetail : designItemDetails) {
|
||||
// com.ai.da.mapper.third.entity.DesignItemDetail designItemDetailZS = CopyUtil.copyObject(designItemDetail, com.ai.da.mapper.third.entity.DesignItemDetail.class);
|
||||
// designItemDetailZS.setId(null);
|
||||
// designItemDetailZS.setDesignItemId(designItemZS.getId());
|
||||
// designItemDetailZS.setAccountId(11420L);
|
||||
// designItemDetailZS.setDesignId(designZS.getId());
|
||||
// designItemDetailZSMapper.insert(designItemDetailZS);
|
||||
//
|
||||
// QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
|
||||
// designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetail.getId());
|
||||
// List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
|
||||
// if (!CollectionUtils.isEmpty(designItemDetailPrintList)) {
|
||||
// for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
|
||||
// com.ai.da.mapper.third.entity.DesignItemDetailPrint designItemDetailPrintZS = CopyUtil.copyObject(designItemDetailPrint, com.ai.da.mapper.third.entity.DesignItemDetailPrint.class);
|
||||
// designItemDetailPrintZS.setId(null);
|
||||
// designItemDetailPrintZS.setDesignItemDetailId(designItemDetailZS.getId());
|
||||
// designItemDetailPrintZSMapper.insert(designItemDetailPrintZS);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// userLikeZS.setDesignItemId(designItemZS.getId());
|
||||
// TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId());
|
||||
// com.ai.da.mapper.third.entity.TDesignPythonOutfit tDesignPythonOutfitZS = CopyUtil.copyObject(tDesignPythonOutfit, com.ai.da.mapper.third.entity.TDesignPythonOutfit.class);
|
||||
// tDesignPythonOutfitZS.setId(null);
|
||||
// tDesignPythonOutfitZS.setDesignItemId(designItemZS.getId());
|
||||
// tDesignPythonOutfitZS.setCollectionId(collectionZS.getId());
|
||||
// tDesignPythonOutfitZS.setUserId(11420L);
|
||||
// tDesignPythonOutfitZS.setDesignId(designZS.getId());
|
||||
// designPythonOutfitZSMapper.insert(tDesignPythonOutfitZS);
|
||||
//
|
||||
// userLikeZS.setUserLikeGroupId(userLikeGroupZS.getId());
|
||||
// userLikeZS.setDesignId(designZS.getId());
|
||||
// userLikeZS.setDesignOutfitId(tDesignPythonOutfitZS.getId());
|
||||
// userLikeZSMapper.insert(userLikeZS);
|
||||
//
|
||||
// QueryWrapper<TDesignPythonOutfitDetail> designPythonOutfitDetailQueryWrapper = new QueryWrapper<>();
|
||||
// designPythonOutfitDetailQueryWrapper.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, tDesignPythonOutfit.getId());
|
||||
// List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(designPythonOutfitDetailQueryWrapper);
|
||||
// for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
|
||||
// com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail tDesignPythonOutfitDetailZS = CopyUtil.copyObject(tDesignPythonOutfitDetail, com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail.class);
|
||||
// tDesignPythonOutfitDetailZS.setDesignPythonOutfitId(tDesignPythonOutfitZS.getId());
|
||||
// tDesignPythonOutfitDetailZS.setId(null);
|
||||
// tDesignPythonOutfitDetailZS.setDesignId(designZS.getId());
|
||||
// designPythonOutfitDetailZSMapper.insert(tDesignPythonOutfitDetailZS);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -23,7 +23,7 @@ public class PaypalTask {
|
||||
@Resource
|
||||
private PayPalCheckoutService payPalCheckoutService;
|
||||
|
||||
@Scheduled(cron = "0/30 * * * * ?")
|
||||
// @Scheduled(cron = "0/30 * * * * ?")
|
||||
public void orderConfirm() throws SerializeException {
|
||||
|
||||
// log.info("PayPal orderConfirm 被执行......");
|
||||
|
||||
@@ -22,7 +22,7 @@ public class StripeTask {
|
||||
@Resource
|
||||
private StripeService stripeService;
|
||||
|
||||
@Scheduled(cron = "0/30 * * * * ?")
|
||||
// @Scheduled(cron = "0/30 * * * * ?")
|
||||
public void orderConfirm() throws SerializeException {
|
||||
|
||||
// 查看超过30分钟以上仍未支付的订单 置为超时订单
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
@@ -23,9 +24,28 @@ public class ExcelReader {
|
||||
for (int i = 0; i < numberOfColumns; i++) {
|
||||
List<String> columnData = new ArrayList<>();
|
||||
for (Row row : sheet) {
|
||||
columnData.add(row.getCell(i).getStringCellValue());
|
||||
Cell cell = row.getCell(i);
|
||||
if (cell != null) {
|
||||
switch (cell.getCellType()) {
|
||||
case STRING:
|
||||
columnData.add(cell.getStringCellValue());
|
||||
break;
|
||||
case NUMERIC:
|
||||
columnData.add(String.valueOf(cell.getNumericCellValue()));
|
||||
break;
|
||||
case BOOLEAN:
|
||||
columnData.add(String.valueOf(cell.getBooleanCellValue()));
|
||||
break;
|
||||
default:
|
||||
// 跳过空单元格或其他类型(比如错误类型)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 只有当这一列有数据时,才添加到结果列表中
|
||||
if (!columnData.isEmpty()) {
|
||||
data.add(columnData);
|
||||
}
|
||||
data.add(columnData);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
||||
@@ -484,6 +484,57 @@ public class MinioUtil {
|
||||
return null; // or throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 MinIO 下载对象到本地路径
|
||||
*
|
||||
* @param bucketName 存储桶名称
|
||||
* @param objectName MinIO 上对象的名称
|
||||
* @param localFilePath 本地文件路径
|
||||
*/
|
||||
public void downloadMinioObjectToLocal(String bucketName, String objectName, String localFilePath) {
|
||||
File localFile = new File(localFilePath);
|
||||
File parentDir = localFile.getParentFile();
|
||||
if (parentDir != null) {
|
||||
parentDir.mkdirs(); // 创建文件夹,确保路径结构与 MinIO 一致
|
||||
}
|
||||
|
||||
try (InputStream stream = minioClient.getObject(
|
||||
GetObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||
FileOutputStream out = new FileOutputStream(localFile)) {
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = stream.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
log.info("Downloaded object {} to {}", objectName, localFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while downloading object {}: {}", objectName, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中提取存储桶名称
|
||||
*
|
||||
* @param path MinIO 路径
|
||||
* @return 存储桶名称
|
||||
*/
|
||||
public String getBucketNameFromPath(String path) {
|
||||
int index = path.indexOf("/");
|
||||
return path.substring(0, index); // 获取第一级路径作为 bucket 名称
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中提取对象名称
|
||||
*
|
||||
* @param path MinIO 路径
|
||||
* @return 对象名称
|
||||
*/
|
||||
public String getObjectNameFromPath(String path) {
|
||||
int index = path.indexOf("/");
|
||||
return path.substring(index + 1); // 获取路径的其余部分作为对象名称
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -154,6 +152,8 @@ public class RedisUtil {
|
||||
return redisTemplate.keys(key);
|
||||
}
|
||||
|
||||
public Long getSize(String key){return redisTemplate.opsForSet().size(key);}
|
||||
|
||||
public List<String> getMultiValue(Set<String> keys){
|
||||
return redisTemplate.opsForValue().multiGet(keys);
|
||||
}
|
||||
@@ -216,4 +216,66 @@ public class RedisUtil {
|
||||
return redisTemplate.opsForValue().increment(key, 0);
|
||||
}
|
||||
|
||||
public Long getViewCount(String key) {
|
||||
Object value = redisTemplate.opsForValue().get(key);
|
||||
if (value instanceof Integer) {
|
||||
return Long.valueOf((Integer) value);
|
||||
} else if (value instanceof Long) {
|
||||
return (Long) value;
|
||||
} else if (value instanceof String) {
|
||||
return Long.valueOf((String) value);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected value type");
|
||||
}
|
||||
}
|
||||
|
||||
public final static String PERSONAL_HOMEPAGE_VIEW_KEY = "PersonalHomepage:view:";
|
||||
|
||||
public void increasePersonalHomepageViewCount(Long accountId) {
|
||||
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
|
||||
redisTemplate.opsForValue().increment(key);
|
||||
}
|
||||
|
||||
public Long getPersonalHomepageViewCount(Long accountId) {
|
||||
String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
|
||||
return redisTemplate.opsForValue().increment(key, 0);
|
||||
}
|
||||
|
||||
public final static String MOODBOARD_POSITION_KEY = "moodboard:position:";
|
||||
|
||||
public void saveMoodboardPosition(Long id, String moodboardPosition) {
|
||||
addToString(MOODBOARD_POSITION_KEY + id, moodboardPosition);
|
||||
}
|
||||
|
||||
public String getMoodboardPosition(Long id) {
|
||||
return getFromString(MOODBOARD_POSITION_KEY + id);
|
||||
}
|
||||
public final static String NICKNAME_MODIFY_TIMES = "NicknameModifyTimes:";
|
||||
public void increaseCount(String key) {
|
||||
redisTemplate.opsForValue().increment(key);
|
||||
}
|
||||
|
||||
public Long getIncrementCount(String key) {
|
||||
return redisTemplate.opsForValue().increment(key, 0);
|
||||
}
|
||||
|
||||
public void setKeyExpire(String key, Long expire) {
|
||||
redisTemplate.expire(key, expire, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
public final static String CHANGE_MAILBOX = "ChangeMailbox:";
|
||||
|
||||
// 每天允许通知3次
|
||||
public final static String UPLOAD_TIMEOUT_REMINDER_COUNTER = "UploadTimeoutReminderCounter";
|
||||
|
||||
public void addProcessId(String processId, int progress) {
|
||||
// Redis 中的键,可以通过 processId 来唯一标识
|
||||
String redisKey = "process:progress:" + processId;
|
||||
|
||||
// 将当前进度存储到 Redis
|
||||
redisTemplate.opsForValue().set(redisKey, String.valueOf(progress));
|
||||
|
||||
// 设置过期时间为 5 分钟(300 秒)
|
||||
redisTemplate.expire(redisKey, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,22 @@ public class S3Util {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPreSignedUrl(String path, int expiry, boolean resetCache) {
|
||||
if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) {
|
||||
if (!path.contains("/")) {
|
||||
throw new BusinessException("The path is error!");
|
||||
}
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
String fileName = path.substring(index + 1);
|
||||
String presignedUrl = getPreSignatureUrl(bucketName, fileName, expiry);
|
||||
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
|
||||
return presignedUrl;
|
||||
} else {
|
||||
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyName key名称: test/2022/06/123.pdf
|
||||
* @param signatureDurationTime 有效期 单位:秒
|
||||
|
||||
@@ -53,6 +53,7 @@ public class SendEmailUtil {
|
||||
* 绑定邮箱
|
||||
*/
|
||||
public static String BIND_MAILBOX_SUBJECT = "绑定邮箱";
|
||||
public static String CHANGE_MAILBOX_SUBJECT = "Change Mailbox";
|
||||
/**
|
||||
* 登入模板id
|
||||
*/
|
||||
@@ -71,6 +72,8 @@ public class SendEmailUtil {
|
||||
*/
|
||||
public static Long BIND_MAILBOX_TEMPLATE_ID = 45619L;
|
||||
|
||||
public static Long CHANGE_MAILBOX_TEMPLATE_ID = 128210L;
|
||||
|
||||
|
||||
public static Boolean send(String receiverAddress, String ip, Long templateId, String verifyCode) {
|
||||
try {
|
||||
@@ -92,7 +95,8 @@ public class SendEmailUtil {
|
||||
req.setDestination(new String[]{receiverAddress});
|
||||
String subject = templateId == LOGIN_TEMPLATE_ID ? LOGIN_SUBJECT :
|
||||
templateId == UPDATE_PWD_TEMPLATE_ID ? FORGET_PWD_SUBJECT :
|
||||
templateId == EXCEPTION_ID_TEMPLATE_ID ? EXCEPTION_ID_SUBJECT : BIND_MAILBOX_SUBJECT;
|
||||
templateId == EXCEPTION_ID_TEMPLATE_ID ? EXCEPTION_ID_SUBJECT :
|
||||
templateId == CHANGE_MAILBOX_TEMPLATE_ID ? CHANGE_MAILBOX_SUBJECT : BIND_MAILBOX_SUBJECT;
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(contractTemplate(templateId, verifyCode, ip));
|
||||
|
||||
@@ -393,10 +397,10 @@ public class SendEmailUtil {
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
// }
|
||||
if (type == 1) {
|
||||
subject = "Successful System Upgrade and New Features in AiDA 3.0";
|
||||
subject = "Successful System Upgrade and New Features in AiDA 3.1";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
|
||||
}else {
|
||||
subject = "系统升级成功和AiDA 3.0新功能";
|
||||
subject = "系统升级成功和AiDA 3.1新功能";
|
||||
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
@@ -590,4 +594,218 @@ public class SendEmailUtil {
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long NEW_USER_REGISTER_NOTIFICATION_EN = 126919L;
|
||||
|
||||
public static void notificationForRegisterUser(String receiverAddress){
|
||||
try{
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{receiverAddress});
|
||||
|
||||
req.setSubject("Welcome to AiDa");
|
||||
Template template = new Template();
|
||||
template.setTemplateID(NEW_USER_REGISTER_NOTIFICATION_EN);
|
||||
template.setTemplateData("{\"email\":\" " + receiverAddress + "\"}");
|
||||
req.setTemplate(template);
|
||||
|
||||
// 返回的resp是一个SendEmailResponse的实例,与请求对象对应
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long CHANGE_MAILBOX_CONFIRM_CN = 128278L;
|
||||
private final static Long CHANGE_MAILBOX_CONFIRM_EN = 128277L;
|
||||
|
||||
public static void changeMailboxConfirm(String receiverAddress, String language, String name, String link){
|
||||
try{
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{receiverAddress});
|
||||
Template template = new Template();
|
||||
if (language.equals("ENGLISH")){
|
||||
req.setSubject("Change the email address bound to the AiDA account");
|
||||
template.setTemplateID(CHANGE_MAILBOX_CONFIRM_EN);
|
||||
}else {
|
||||
req.setSubject("更换AiDA账号绑定的邮箱地址");
|
||||
template.setTemplateID(CHANGE_MAILBOX_CONFIRM_CN);
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("userName", name);
|
||||
param.put("link", link);
|
||||
|
||||
template.setTemplateData(param.toJSONString());
|
||||
req.setTemplate(template);
|
||||
|
||||
// 返回的resp是一个SendEmailResponse的实例,与请求对象对应
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long UPLOAD_TIMEOUT_REMINDER = 128324L;
|
||||
|
||||
public static void uploadTimeoutReminder(String userName, String time){
|
||||
String xp = "xupei3360@163.com";
|
||||
String shb = "shahaibodd99@gmail.com";
|
||||
String wxd = "X1627315083@163.com";
|
||||
String pkc = "kaicpang.pang@connect.polyu.hk";
|
||||
try{
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
req.setFromEmailAddress(SEND_ADDRESS);
|
||||
req.setDestination(new String[]{shb, xp, wxd, pkc});
|
||||
Template template = new Template();
|
||||
req.setSubject("上传图片超时提醒");
|
||||
template.setTemplateID(UPLOAD_TIMEOUT_REMINDER);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("userName", userName);
|
||||
param.put("time", time);
|
||||
|
||||
template.setTemplateData(param.toJSONString());
|
||||
req.setTemplate(template);
|
||||
|
||||
// 返回的resp是一个SendEmailResponse的实例,与请求对象对应
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
|
||||
private final static Long HALFPRICEPROMOTION_CN_ID = 128582L;
|
||||
private final static Long HALFPRICEPROMOTION_EN_ID = 128583L;
|
||||
public static void halfPricePromotion(Account account, String senderAddress, int type) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
if (StringUtils.isEmpty(senderAddress)) {
|
||||
senderAddress = CODE_CREATE_SEND_ADDRESS;
|
||||
}
|
||||
req.setFromEmailAddress(senderAddress);
|
||||
req.setDestination(new String[]{account.getUserEmail()});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
// if (type == 1) {
|
||||
// subject = "Upcoming System Upgrade for AiDA 3.0";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
|
||||
// }else {
|
||||
// subject = "即将到来的AiDA 3.0系统升级";
|
||||
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
|
||||
// }
|
||||
if (type == 1) {
|
||||
subject = "AiDA workshop - Win a trip to Hong Kong!";
|
||||
template.setTemplateID(HALFPRICEPROMOTION_EN_ID);
|
||||
}else {
|
||||
subject = "AiDA workshop - 赢取香港之旅";
|
||||
template.setTemplateID(HALFPRICEPROMOTION_CN_ID);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
private final static Long SYSTEM_UPGRADE_CN_ID = 131743L;
|
||||
private final static Long SYSTEM_UPGRADE_EN_ID = 131744L;
|
||||
public static void temporaryUpgrade(Account account, String senderAddress, int type) {
|
||||
try {
|
||||
// 实例化一个认证对象
|
||||
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("ses.tencentcloudapi.com");
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
|
||||
SendEmailRequest req = new SendEmailRequest();
|
||||
if (StringUtils.isEmpty(senderAddress)) {
|
||||
senderAddress = CODE_CREATE_SEND_ADDRESS;
|
||||
}
|
||||
req.setFromEmailAddress(senderAddress);
|
||||
req.setDestination(new String[]{account.getUserEmail()});
|
||||
|
||||
// 根据邮件类型设置不同的主题和模板
|
||||
String subject = "";
|
||||
Template template = new Template();
|
||||
if (type == 1) {
|
||||
subject = "AiDA system upgrade completed";
|
||||
template.setTemplateID(SYSTEM_UPGRADE_EN_ID);
|
||||
}else {
|
||||
subject = "AiDA系统升级完成";
|
||||
template.setTemplateID(SYSTEM_UPGRADE_CN_ID);
|
||||
}
|
||||
template.setTemplateData(buildAccountData(account));
|
||||
|
||||
req.setSubject(subject);
|
||||
req.setTemplate(template);
|
||||
|
||||
// 发送邮件
|
||||
SendEmailResponse resp = client.SendEmail(req);
|
||||
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info("邮件发送失败###{}", e.toString());
|
||||
throw new BusinessException("failed.to.send.mail");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ai.da.common.websocket;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@ServerEndpoint(value = "/notification/{id}")
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NotificationConnection {
|
||||
|
||||
//连接超时
|
||||
public static final long MAX_TIME_OUT = 3 * 60 * 1000;
|
||||
|
||||
private Session session;
|
||||
private Long userId;
|
||||
// 这里用ConcurrentHashMap 因为他是一个线程安全的Map
|
||||
private static ConcurrentHashMap<Long, NotificationConnection> websockets = new ConcurrentHashMap<>();
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam("id") String id) { // 接收到前端传来的用户ID
|
||||
this.session = session;
|
||||
this.userId = Long.valueOf(id);
|
||||
this.session.setMaxIdleTimeout(MAX_TIME_OUT);
|
||||
websockets.put(Long.parseLong(id), this); //将ID作为key,当前的对象作为Value
|
||||
log.info("【建立连接】 用户为:{}", this.session);
|
||||
log.info("【建立连接】 用户Id为:{}", id);
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
}
|
||||
|
||||
@OnClose
|
||||
public void onClose(CloseReason reason) {
|
||||
log.info("【连接断开】 用户为:{}, sessionId: {}, 原因为{}", this.userId, this.session.getId(), reason);
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
websockets.remove(this.userId); // 将当前的对象从集合中删除
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误时调用
|
||||
* @param throwable 异常
|
||||
*/
|
||||
@OnError
|
||||
public void onError(Throwable throwable) {
|
||||
log.info("【连接异常】 用户为:{} , sessionId: {}", this.userId, this.session.getId(), throwable);
|
||||
websockets.remove(this.userId); // 将当前的对象从集合中删除
|
||||
log.info("【当前连接总数】 为:{}", websockets.size());
|
||||
}
|
||||
|
||||
//收到了客户端消息执行的操作
|
||||
@OnMessage
|
||||
public void onMessage(@RequestParam String text){
|
||||
Map<String, String> textMap = JSONObject.parseObject(text, Map.class);
|
||||
log.info("收到了一条来自 {} 的消息:{}, sessionId:{}", this.userId, textMap.get("text"), this.session.getId());
|
||||
// return "已收到你的消息";
|
||||
if (textMap.get("text").equals("PING")){
|
||||
sendMsg(JSON.toJSONString("PONG"), this.userId);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMsg(String message, Long userId) {
|
||||
if (userId == null) { // 如果等于null则证明是群发
|
||||
// 获取当前Map的一个迭代器,遍历Map的方式有很多种,看着来
|
||||
// 这个就是遍历这个集合的过程....
|
||||
for (Map.Entry<Long, NotificationConnection> entry : websockets.entrySet()) {
|
||||
// 获取每一个Entry实例
|
||||
// 获取每一个Value,而这个Value就是WebSocket的实例
|
||||
NotificationConnection webSocket = entry.getValue();
|
||||
// 接下来就是遍历群发
|
||||
log.info("广播消息 【给用户】 :{}发送消息【{}】", webSocket, message);
|
||||
try {
|
||||
webSocket.session.getBasicRemote().sendText(message); // 发送!!!!!!!!!
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to send message to session {}: {}", webSocket.session.getId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
} else { // 如果不是群发,则判断ID,其余步骤一致
|
||||
// 获取当前Map的一个迭代器,遍历Map的方式有很多种,看着来
|
||||
// 这个就是遍历这个集合的过程....
|
||||
for (Map.Entry<Long, NotificationConnection> entry : websockets.entrySet()) {
|
||||
// 获取每一个Entry实例
|
||||
// 获取每一个Value,而这个Value就是WebSocket的实例
|
||||
NotificationConnection webSocket = entry.getValue();
|
||||
// 获取每一个Key,这个Key就是用户ID
|
||||
Long key = entry.getKey();
|
||||
// 判断用户ID与当前的Key相等
|
||||
if (userId.equals(key)) {
|
||||
log.info("私发消息 【给用户】 :{}发送消息【{}】", key, message); // 打印
|
||||
if (webSocket.session.isOpen()){
|
||||
// 避免因为网络问题或其他原因导致连接突然关闭而报错
|
||||
try {
|
||||
webSocket.session.getBasicRemote().sendText(message); // 则发送给当前的用户即可
|
||||
} catch (IOException e) {
|
||||
log.error("Failed to send message to session {}: {}", webSocket.session.getId(), e.getMessage());
|
||||
// 这里可以选择移除关闭的 session
|
||||
websockets.remove(entry.getKey());
|
||||
}
|
||||
}else {
|
||||
log.info("连接已关闭,sessionId:{}, userId:{}", webSocket.session.getId(), key);
|
||||
websockets.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ai.da.common.websocket.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
/**
|
||||
* Configuration of WebSocket
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.AccountLoginVO;
|
||||
import com.ai.da.model.vo.AccountPreLoginVO;
|
||||
import com.ai.da.model.vo.PersonalHomepageVO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -177,4 +182,132 @@ public class AccountController {
|
||||
public Response<Boolean> questionnaire(@Valid @RequestBody String questionnaireInfo){
|
||||
return Response.success(accountService.collectQuestionnaires(questionnaireInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 参与活动 获取福利
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "参与活动 获取福利")
|
||||
@GetMapping("/activity")
|
||||
public Response<String> getActivityBenefits(){
|
||||
return Response.success(accountService.getActivityBenefits());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "将用户账号过期时间设置为过期当天的23:59:59")
|
||||
@GetMapping("/setUserValidToDayEnd")
|
||||
public Response<List<Long>> setUserValidToDayEnd(){
|
||||
return Response.success(accountService.setUserValidToDayEnd());
|
||||
}
|
||||
|
||||
// 用户上传头像
|
||||
@ApiOperation(value = "上传头像")
|
||||
@PostMapping(path = "/uploadAvatar")
|
||||
public Response<String> uploadAvatar(@RequestParam("file") MultipartFile file) {
|
||||
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
return Response.success(accountService.uploadAvatar(file));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "个人主页浏览量增加")
|
||||
@GetMapping("/viewsIncrease")
|
||||
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
|
||||
return Response.success(accountService.viewsIncrease(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取个人主页信息")
|
||||
@GetMapping("/personalHomepage")
|
||||
public Response<PersonalHomepageVO> getPersonalHomepage(@RequestParam("id") Long id){
|
||||
return Response.success(accountService.getPersonalHomepage(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "getUsernameModifyTimes")
|
||||
@GetMapping("/getNicknameModifyTimes")
|
||||
public Response<Map<String, Long>> getNicknameModifyTimes(){
|
||||
return Response.success(accountService.getNicknameModifyTimes());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "editUserName")
|
||||
@GetMapping("/editUserName")
|
||||
public Response<String> editUserName(@RequestParam("newUserName") String newUserName){
|
||||
accountService.editUserName(newUserName);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "verifyUserEmail")
|
||||
@GetMapping("/verifyUserEmail")
|
||||
public Response<String> verifyUserEmail(@RequestParam("verifyCode") String verifyCode){
|
||||
accountService.verifyUserEmail(verifyCode);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "changeUserEmail")
|
||||
@GetMapping("/changeUserEmail")
|
||||
public Response<String> changeUserEmail(@RequestParam("newMailbox") String newMailbox){
|
||||
accountService.changeUserEmail(newMailbox);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "activateNewEmail")
|
||||
@GetMapping("/activateNewEmail")
|
||||
public Response<String> activateNewEmail(@RequestParam("token") String token){
|
||||
accountService.activateNewEmail(token);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@PostMapping("halfPricePromotion")
|
||||
@ApiOperation(value = "十月半价活动")
|
||||
public Response<Boolean> halfPricePromotion() {
|
||||
accountService.halfPricePromotion();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("temporaryUpgrade")
|
||||
@ApiOperation(value = "临时升级")
|
||||
public Response<Boolean> temporaryUpgrade() {
|
||||
accountService.temporaryUpgrade();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("enterpriseLogin")
|
||||
@ApiOperation(value = "企业登录")
|
||||
public Response<AccountLoginVO> enterpriseLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
|
||||
return Response.success(accountService.enterpriseLogin(accountDTO));
|
||||
}
|
||||
|
||||
@PostMapping("schoolLogin")
|
||||
@ApiOperation(value = "学校登录")
|
||||
public Response<AccountLoginVO> schoolLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
|
||||
return Response.success(accountService.schoolLogin(accountDTO));
|
||||
}
|
||||
|
||||
@PostMapping("addOrUpdateSubAccount")
|
||||
@ApiOperation(value = "子账号新增")
|
||||
public Response<Boolean> addSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
||||
return Response.success(accountService.addSubAccount(addSubAccountDTO));
|
||||
}
|
||||
|
||||
@PostMapping("deleteSubAccount")
|
||||
@ApiOperation(value = "子账号删除")
|
||||
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
||||
return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
|
||||
}
|
||||
|
||||
@PostMapping("subAccountList")
|
||||
@ApiOperation(value = "子账号查询")
|
||||
public Response<PageBaseResponse<Account>> subAccountList(@Valid @RequestBody SubAccountPageDTO subAccountPageDTO) {
|
||||
return Response.success(accountService.subAccountList(subAccountPageDTO));
|
||||
}
|
||||
|
||||
@GetMapping("accountDetail")
|
||||
@ApiOperation(value = "账号详情")
|
||||
public Response<Account> accountDetail(@RequestParam("id") Long id) {
|
||||
return Response.success(accountService.accountDetail(id));
|
||||
}
|
||||
|
||||
@PostMapping("getAccountDetail")
|
||||
@ApiOperation(value = "获取账户信息")
|
||||
public Response<AccountLoginVO> getAccountDetail() {
|
||||
return Response.success(accountService.getAccountDetail());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,60 +4,167 @@ package com.ai.da.controller;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.DesignMapper;
|
||||
import com.ai.da.mapper.primary.TrialOrderMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.UserDesignStatisticDTO;
|
||||
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
|
||||
import com.ai.da.model.vo.QuestionnaireVO;
|
||||
import com.ai.da.model.vo.QueryUserConditionsVO;
|
||||
import com.ai.da.service.ConvenientInquiryService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Api(tags = "便利查询")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/inquiry")
|
||||
public class ConvenientInquiryController {
|
||||
|
||||
@Resource
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private ConvenientInquiryService convenientInquiryService;
|
||||
|
||||
|
||||
@ApiOperation("获取当前所有试用用户")
|
||||
@GetMapping("/getTrial")
|
||||
public Response<List<TrialOrder>> getTrial(){
|
||||
@PostMapping("/getTrial")
|
||||
public Response<IPage<TrialOrder>> getTrial(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)){
|
||||
List<TrialOrder> trialOrders = trialOrderMapper.selectList(null);
|
||||
return Response.success(trialOrders);
|
||||
}else {
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
return Response.success(convenientInquiryService.getTrial(queryUserConditionsVO));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime,@RequestParam String endTime){
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
|
||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)){
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
|
||||
if (StringUtil.isNullOrEmpty(endTime)){
|
||||
if (StringUtil.isNullOrEmpty(endTime)) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
Date date = new Date();
|
||||
endTime = simpleDateFormat.format(date);
|
||||
}
|
||||
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime);
|
||||
if (!StringUtil.isNullOrEmpty(email)){
|
||||
email = email.trim();
|
||||
}
|
||||
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime, ids, email);
|
||||
return Response.success(designStatistic);
|
||||
}else {
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//调查问卷
|
||||
@ApiOperation("获取调查问卷统计详情")
|
||||
@GetMapping("/getQuestionnaireStatistic")
|
||||
public Response<QuestionnaireFeedbackVO> getQuestionnaire() {
|
||||
return Response.success(convenientInquiryService.getQuestionnaireInfo());
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有调查问卷")
|
||||
@GetMapping("/getAllQuestionnaire")
|
||||
public Response<List<QuestionnaireVO>> getAllQuestionnaire() {
|
||||
return Response.success(convenientInquiryService.getAllQuestionnaire());
|
||||
}
|
||||
|
||||
@ApiOperation("获取近期新用户")
|
||||
@PostMapping("/recentNewUser")
|
||||
public Response<IPage<Account>> recentNewUser(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
return Response.success(convenientInquiryService.recentNewUser(queryUserConditionsVO));
|
||||
}
|
||||
|
||||
@ApiOperation("获取近期新用户图表数据")
|
||||
@GetMapping("/recentNewUserChart")
|
||||
public Response<Map<String, Object>> recentNewUserChart(@ApiParam(value = "startTime") @RequestParam @Nullable String startTime,
|
||||
@ApiParam(value = "endTime") @RequestParam @Nullable String endTime,
|
||||
@ApiParam("userType") @RequestParam Integer userType) {
|
||||
return Response.success(convenientInquiryService.recentNewUserChart(startTime, endTime, userType));
|
||||
}
|
||||
|
||||
@ApiOperation("获取近期活跃用户")
|
||||
@PostMapping("/recentActiveUser")
|
||||
public Response<IPage<Account>> recentActiveUser(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
return Response.success(convenientInquiryService.recentActiveUser(queryUserConditionsVO));
|
||||
}
|
||||
|
||||
@ApiOperation("获取近期活跃用户图表数据")
|
||||
@GetMapping("/recentActiveUserChart")
|
||||
public Response<Integer> recentActiveUserChart(@ApiParam(value = "startTime") @RequestParam @Nullable String startTime,
|
||||
@ApiParam(value = "endTime") @RequestParam @Nullable String endTime) {
|
||||
return Response.success(convenientInquiryService.recentActiveUserChart(startTime, endTime));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户的各模块功能使用详情")
|
||||
@GetMapping("/getActiveUserFunc")
|
||||
public Response<Map<String, List<Object>>> getActiveUserFunc(@ApiParam(value = "startTime") @RequestParam @Nullable String startTime,
|
||||
@ApiParam(value = "endTime") @RequestParam @Nullable String endTime,
|
||||
@ApiParam("userIdList") @RequestParam @Nullable List<Long> userIdList) {
|
||||
return Response.success(convenientInquiryService.getActiveUserFunc(startTime, endTime, userIdList));
|
||||
}
|
||||
|
||||
@ApiOperation("试用用户到正式用户的转化率")
|
||||
@GetMapping("/conversionRate")
|
||||
public Response<Map<String, Object>> conversionRate(@ApiParam(value = "startTime") @RequestParam(required = false) @Nullable String startTime,
|
||||
@ApiParam(value = "endTime") @RequestParam(required = false) @Nullable String endTime) {
|
||||
return Response.success(convenientInquiryService.conversionRate(startTime, endTime));
|
||||
}
|
||||
|
||||
@ApiOperation("试用用户国家/城市分布")
|
||||
@GetMapping("/trialUserCountry")
|
||||
public Response<Map<String, List<Object>>> trialUserCountry(@ApiParam(value = "startTime") @RequestParam(required = false) @Nullable String startTime,
|
||||
@ApiParam(value = "endTime") @RequestParam(required = false) @Nullable String endTime) {
|
||||
return Response.success(convenientInquiryService.trialUserCountry(startTime, endTime));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping("/addUser")
|
||||
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
|
||||
return Response.success(convenientInquiryService.addUser(accountAddDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户信息")
|
||||
@PostMapping("/modifyUser")
|
||||
public Response<Boolean> modifyUser(@ApiParam(value = "用户id") @RequestParam @Nullable Long accountId,
|
||||
@ApiParam(value = "有效期截止时间的毫秒级unix格式") @RequestParam @Nullable Long validEndTime,
|
||||
@ApiParam(value = "用户类型 1/2/3/0 -> yearly/monthly/trial/visitor") @RequestParam @Nullable Integer systemUser,
|
||||
@ApiParam("积分") @RequestParam @Nullable Long credits) {
|
||||
return Response.success(convenientInquiryService.modifyUser(accountId, validEndTime, systemUser, credits));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户信息")
|
||||
@PostMapping("/getUserInfo")
|
||||
public Response<IPage<Account>> getUserInfo(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
|
||||
return Response.success(convenientInquiryService.getUserInfo(queryUserConditionsVO));
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有用户id")
|
||||
@GetMapping("/getAllUserId")
|
||||
public Response<List<Map<String, Object>>> getAllUsrIdList() {
|
||||
return Response.success(convenientInquiryService.getAllUserIdList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DesignController {
|
||||
@ApiOperation(value = "设计 Conllection")
|
||||
@PostMapping("/designCollection")
|
||||
@CrossOrigin
|
||||
public Response<DesignCollectionVO> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
||||
public Response<String> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
||||
return Response.success(designService.designCollection(designDTO));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DesignController {
|
||||
|
||||
@ApiOperation(value = "重新设计 Collection")
|
||||
@PostMapping("/reDesignCollection")
|
||||
public Response<DesignCollectionVO> reDesignCollection(@Valid @RequestBody ReDesignCollectionDTO reDesignDTO) {
|
||||
public Response<String> reDesignCollection(@Valid @RequestBody ReDesignCollectionDTO reDesignDTO) {
|
||||
return Response.success(designService.reDesignCollection(reDesignDTO));
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ public class DesignController {
|
||||
|
||||
@ApiOperation(value = "sketchBoard upload generate design前裁剪")
|
||||
@PostMapping("/sketchBoardsBoundingBox")
|
||||
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody SketchesBoundingBoxDTO sketchesBoundingBoxDTO) {
|
||||
return Response.success(designService.sketchesBoundingBox(sketchesBoundingBoxDTO));
|
||||
public Response<List<CollectionSketchVO>> sketchesBoundingBox(@Valid @RequestBody ReDesignCollectionDTO reDesignCollectionDTO) {
|
||||
return Response.success(designService.sketchesBoundingBox(reDesignCollectionDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过designItemId获取模特图")
|
||||
@@ -83,4 +83,16 @@ public class DesignController {
|
||||
return Response.success(designService.getModel(designItemIdList));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取design结果")
|
||||
@GetMapping("/getDesignResult")
|
||||
public Response<DesignCollectionVO> getDesignResult(@RequestParam("requestId") String requestId, @RequestParam("objectSignList") List<String> objectSignList){
|
||||
return Response.success(designService.getDesignResult(requestId, objectSignList));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "云生成")
|
||||
@PostMapping("/designCloud")
|
||||
@CrossOrigin
|
||||
public Response<String> designCloud(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
||||
return Response.success(designService.designCloud(designDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.DesignItemService;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.UserLikeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Api(tags = "design Detail模块")
|
||||
@@ -77,4 +80,18 @@ public class DesignDetailController {
|
||||
public Response<ComposeLayersVO> editPositionAndScale(@Valid @RequestBody EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException {
|
||||
return Response.success(designItemService.editLayersPositionAndScale(positionAndScaleVO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "mask数据兼容")
|
||||
@GetMapping("/convertWithoutGradient")
|
||||
public Response<String> convertHistoryMaskWithoutGradient(){
|
||||
designItemService.convertHistoryMaskWithoutGradient();
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "mask数据库路径更新")
|
||||
@GetMapping("/updateMaskUrl")
|
||||
public Response<String> updateMaskUrl(){
|
||||
designItemService.updateMaskUrl();
|
||||
return Response.success("success");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.model.dto.GenerateLikeDTO;
|
||||
import com.ai.da.model.dto.GenerateModifyDTO;
|
||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||
import com.ai.da.model.dto.ImageToSketchDTO;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.GenerateService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -83,5 +85,17 @@ public class GenerateController {
|
||||
return Response.success(generateResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "imageToSketch")
|
||||
@PostMapping("/imageToSketch")
|
||||
public Response<GenerateResultVO> imageToSketch(@Valid @RequestBody ImageToSketchDTO imageToSketchDTO) {
|
||||
return Response.success(generateService.imageToSketch(imageToSketchDTO));
|
||||
}
|
||||
|
||||
// modifySketch
|
||||
@ApiOperation(value = "modifySketch")
|
||||
@PostMapping("/modifySketch")
|
||||
public Response<GenerateResultVO> modifySketch(@Valid @RequestBody GenerateModifyDTO generateModifyDTO) {
|
||||
return Response.success(generateService.modifySketch(generateModifyDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.model.dto.GetNotificationDTO;
|
||||
import com.ai.da.model.vo.NotificationVO;
|
||||
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||
import com.ai.da.service.MessageCenterService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "消息中心模块")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/message")
|
||||
public class MessageCenterController {
|
||||
|
||||
@Resource
|
||||
private MessageCenterService messageCenterService;
|
||||
|
||||
// 获取未读消息总数
|
||||
@ApiOperation(value = "获取未读消息数")
|
||||
@GetMapping("/getUnreadCount")
|
||||
public Response<Map<String, Long>> getUnreadMessage(){
|
||||
return Response.success(messageCenterService.getAllTypeMessageUnreadCount());
|
||||
}
|
||||
|
||||
// 获取历史消息
|
||||
@ApiOperation(value = "获取历史消息")
|
||||
@PostMapping("/getHistoryNotification")
|
||||
public Response<PageBaseResponse<NotificationVO>> getHistoryNotification(@Valid @RequestBody GetNotificationDTO getNotificationDTO) {
|
||||
return Response.success(messageCenterService.getHistoryNotification(getNotificationDTO));
|
||||
}
|
||||
|
||||
// 已读消息
|
||||
@ApiOperation(value = "设置消息状态为已读")
|
||||
@PostMapping("/setReadStatus")
|
||||
public Response<Boolean> setReadStatus(@RequestParam("notificationIdList") List<Long> notificationIdList, @RequestParam("type") String type) {
|
||||
return Response.success(messageCenterService.setReadStatus(notificationIdList, type));
|
||||
}
|
||||
|
||||
// 发布系统消息
|
||||
@ApiOperation(value = "发布系统消息")
|
||||
@PostMapping("/publishSysMessage")
|
||||
public Response<String> publishSysMessage(@Valid @RequestBody PublishSysNotificationDTO message) {
|
||||
messageCenterService.publishSystemNotification(message);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "一键已读")
|
||||
@PostMapping("/oneClickRead")
|
||||
public Response<String> setReadAll(@RequestParam("type") String type) {
|
||||
messageCenterService.setReadAll(type);
|
||||
return Response.success("success");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.model.vo.CommentVO;
|
||||
import com.ai.da.model.vo.PortfolioVO;
|
||||
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||
import com.ai.da.model.vo.UserLikeGroupVO;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -16,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "Portfolio模块")
|
||||
@Slf4j
|
||||
@@ -28,7 +31,7 @@ public class PortfolioController {
|
||||
|
||||
@ApiOperation(value = "发布作品集")
|
||||
@PostMapping("/publish")
|
||||
public Response<Boolean> preLogin(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
|
||||
public Response<Long> preLogin(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
|
||||
return Response.success(portfolioService.publish(canvas, data));
|
||||
}
|
||||
|
||||
@@ -117,4 +120,38 @@ public class PortfolioController {
|
||||
public Response<Boolean> commentDelete(@Valid @RequestBody CommentDTO commentDTO) {
|
||||
return Response.success(portfolioService.commentDelete(commentDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "关注")
|
||||
@GetMapping("/follow")
|
||||
public Response<String> follow(@RequestParam("followeeId") Long followeeId) {
|
||||
portfolioService.follow(followeeId);
|
||||
return Response.success(BusinessException.getMessageFromResource("subscription.success"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消关注")
|
||||
@GetMapping("/cancelFollow")
|
||||
public Response<String> cancelFollow(@RequestParam("followeeId") Long followeeId) {
|
||||
portfolioService.cancelFollow(followeeId);
|
||||
return Response.success(BusinessException.getMessageFromResource("unsubscribe.success"));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取关注列表")
|
||||
@PostMapping("/getFolloweeList")
|
||||
public Response<List<AccountFollowVO>> getFolloweeList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFolloweeList(getFollowListDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取粉丝列表")
|
||||
@PostMapping("/getFollowerList")
|
||||
public Response<List<AccountFollowVO>> getFollowerList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFollowerList(getFollowListDTO));
|
||||
}
|
||||
|
||||
|
||||
/* @ApiOperation(value = "按标签名查询作品")
|
||||
@GetMapping("/queryPortfolioByTag")
|
||||
public Response<List<PortfolioVO>> queryPortfolioByTag(@RequestParam(value = "tagName", required = false) String tagName,
|
||||
@RequestParam(value = "tagId", required = false) Long tagId) {
|
||||
return Response.success(portfolioService.queryPortfolioByTag(tagName, tagId));
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ public class SavedCollectionController {
|
||||
}
|
||||
List<Long> groupIds = page.getRecords().stream().map(UserLikeGroup::getId).collect(Collectors.toList());
|
||||
List<UserLikeVO> groupDetails = userLikeService.getGroupDetails(groupIds);
|
||||
if (CollectionUtils.isEmpty(groupDetails)) {
|
||||
throw new BusinessException("groupDetails.not.found");
|
||||
}
|
||||
// if (CollectionUtils.isEmpty(groupDetails)) {
|
||||
// throw new BusinessException("groupDetails.not.found");
|
||||
// }
|
||||
Map<Long, List<UserLikeVO>> groupDetailMap = groupDetails.stream()
|
||||
.collect(Collectors.groupingBy(UserLikeVO::getUserLikeGroupId));
|
||||
|
||||
@@ -117,13 +117,17 @@ public class SavedCollectionController {
|
||||
userLikeGroupVO.setUpdateDate(group.getUpdateDate().getTime());
|
||||
userLikeGroupVO.setAuthor(account.getUserName());
|
||||
//count 和detail
|
||||
List<UserLikeVO> details = groupDetailMap.get(group.getId());
|
||||
for (UserLikeVO detail : details) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
if (groupDetailMap.keySet().contains(group.getId())) {
|
||||
List<UserLikeVO> details = groupDetailMap.get(group.getId());
|
||||
for (UserLikeVO detail : details) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
userLikeGroupVO.setGroupDetails(details);
|
||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||
}else {
|
||||
userLikeGroupVO.setSketchCount(0);
|
||||
}
|
||||
userLikeGroupVO.setGroupDetails(details);
|
||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||
if (userLikeGroupVO.getOriginal() == 0) {
|
||||
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
@@ -235,4 +239,22 @@ public class SavedCollectionController {
|
||||
List<MagicToolResultVO> magicToolResultVOList = userLikeGroupService.getRelightResult(taskIdList);
|
||||
return Response.success(magicToolResultVOList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "likeHistoryRelSketch")
|
||||
@PostMapping("/likeHistoryRelSketch")
|
||||
public Response<String> likeHistoryRelSketch() {
|
||||
return Response.success(userLikeGroupService.likeHistoryRelSketch());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "download")
|
||||
@PostMapping("/download")
|
||||
public Response<String> download() {
|
||||
return Response.success(userLikeGroupService.download());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "productImageInitialize")
|
||||
@PostMapping("/productImageInitialize")
|
||||
public Response<Boolean> productImageUpload(@Valid @RequestBody ProductImageInitializeDTO productImageInitializeDTO) {
|
||||
return Response.success(userLikeGroupService.productImageInitialize(productImageInitializeDTO));
|
||||
}
|
||||
}
|
||||
|
||||
31
src/main/java/com/ai/da/controller/TagsController.java
Normal file
31
src/main/java/com/ai/da/controller/TagsController.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Product;
|
||||
import com.ai.da.mapper.primary.entity.Tags;
|
||||
import com.ai.da.service.ProductService;
|
||||
import com.ai.da.service.TagsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin //开放前端的跨域访问
|
||||
@Api(tags = "标签管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/tags")
|
||||
public class TagsController {
|
||||
|
||||
@Resource
|
||||
private TagsService tagsService;
|
||||
|
||||
@ApiOperation("获取标签")
|
||||
@GetMapping("/getTags")
|
||||
public Response<List<Tags>> getTags(@RequestParam("userInput") String userInput) {
|
||||
return Response.success(tagsService.getTags(userInput));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.GoogleUser;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.AccountLoginVO;
|
||||
import com.ai.da.model.vo.DesignCollectionVO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.Valid;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
@@ -27,6 +32,9 @@ public class ThirdPartyController {
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
|
||||
/*@ApiOperation(value = "Add user information")
|
||||
@PostMapping("/addUser")
|
||||
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
|
||||
@@ -107,4 +115,35 @@ public class ThirdPartyController {
|
||||
public Response<String> getRedirectUrl() {
|
||||
return Response.success(REDIRECT_URL);
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "updateNoLoginRequiredNew")
|
||||
@PostMapping("/updateNoLoginRequiredNew")
|
||||
public Response<String> updateNoLoginRequiredNew(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request) {
|
||||
return Response.success(accountService.updateNoLoginRequiredNew(noLoginRequiredDTO, request));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("/auth/google_callback")
|
||||
public Response<String> googleCallback(@RequestParam("code") String code, HttpSession session) {
|
||||
return Response.success(accountService.googleCallback(code, session));
|
||||
}
|
||||
@CrossOrigin
|
||||
@GetMapping("/parseGoogleCredential")
|
||||
public Response<AccountLoginVO> parseGoogleCredential(@RequestParam("credential") String credential) {
|
||||
return Response.success(accountService.parseGoogleCredential(credential));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("/parseWeChatCode")
|
||||
public Response<AccountLoginVO> parseWeChatCode(@RequestParam("code") String code) {
|
||||
return Response.success(accountService.parseWeChatCode(code));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收Design结果")
|
||||
@PostMapping("/receiveDesignResults")
|
||||
@CrossOrigin
|
||||
public Response<Boolean> receiveDesignResults(@Valid @RequestBody JSONObject responseObject) {
|
||||
return Response.success(designService.receiveDesignResults(responseObject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.AccountExtend;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author easy-generator
|
||||
* @since 2022-06-13
|
||||
*/
|
||||
public interface AccountExtendMapper extends CommonMapper<AccountExtend> {
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,4 +30,6 @@ public interface AccountMapper extends CommonMapper<Account> {
|
||||
*/
|
||||
// Account findById(String id);
|
||||
|
||||
void toVisitor(Long id, Date date);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,5 @@ public interface DesignMapper extends CommonMapper<Design> {
|
||||
//返回插入数据后生成的主键
|
||||
Long insertDesign(Design design);
|
||||
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime);
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email);
|
||||
}
|
||||
|
||||
@@ -3,5 +3,10 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Generate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface GenerateMapper extends CommonMapper<Generate> {
|
||||
|
||||
List<Map<String, Object>> getByTypeAndTime(String startTime, String endTime, List<Long> accountIdList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Notification;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface NotificationMapper extends CommonMapper<Notification> {
|
||||
|
||||
List<Map<String, Object>> getTypeCount(Long receiverId);
|
||||
|
||||
/** 解决mybatis-plus自动过滤 is_deleted为1的数据 问题 */
|
||||
Notification getUniqueLikeAndFollow(String type, Long senderId, Long receiverId, Long portfolioId);
|
||||
|
||||
void updateUniqueLikeAndFollow(Long id, LocalDateTime time);
|
||||
|
||||
void deleteNotification(Long id, LocalDateTime time);
|
||||
|
||||
void setPersonalNotificationAllRead(String type, Long receiverId, LocalDateTime time);
|
||||
|
||||
List<Long> getUnreadSysNotification(Long accountId);
|
||||
}
|
||||
@@ -3,6 +3,10 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PortfolioMapper extends CommonMapper<Portfolio> {
|
||||
Portfolio getByIdAll(Long originalPortfolioId);
|
||||
|
||||
List<Portfolio> getByTag(Long accountId, String tagName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.PortfolioTags;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public interface PortfolioTagsMapper extends CommonMapper<PortfolioTags> {
|
||||
|
||||
void deleteByPortfolioId(Long portfolioId);
|
||||
|
||||
// portfolioId与tagId建立唯一约束, 如果组合 portfolio_id 和 tag_id 已经存在,插入操作会被忽略。
|
||||
void insertIgnore(Long portfolioId, Long tagId, LocalDateTime time);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ProductImageAttribute;
|
||||
|
||||
public interface ProductImageAttributeMapper extends CommonMapper<ProductImageAttribute> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.SysNotificationReadStatus;
|
||||
|
||||
public interface SysNotificationReadStatusMapper extends CommonMapper<SysNotificationReadStatus> {
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,4 +26,7 @@ public interface TDesignPythonOutfitDetailMapper extends CommonMapper<TDesignPyt
|
||||
*/
|
||||
List<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail);
|
||||
|
||||
@Delete("DELETE FROM t_design_python_outfit_detail WHERE design_python_outfit_id = #{designPythonOutfitId}")
|
||||
void deleteByDesignPythonOutfitIdPhysical(@Param("designPythonOutfitId") Long designPythonOutfitId);
|
||||
|
||||
}
|
||||
|
||||
17
src/main/java/com/ai/da/mapper/primary/TagsMapper.java
Normal file
17
src/main/java/com/ai/da/mapper/primary/TagsMapper.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.Tags;
|
||||
import com.ai.da.model.dto.TagsDTO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface TagsMapper extends CommonMapper<Tags> {
|
||||
|
||||
List<Map<String, String>> getMatchingTags(String userInput);
|
||||
|
||||
List<TagsDTO> getTagByPortfolioId(Long portfolioId);
|
||||
|
||||
}
|
||||
@@ -3,5 +3,10 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ToProductImageResultMapper extends CommonMapper<ToProductImageResult> {
|
||||
|
||||
List<Map<String, Object>> getByTypeAndTime(String startTime, String endTime, List<Long> accountIdList);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
@@ -11,6 +14,6 @@ import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
*/
|
||||
public interface TrialOrderMapper extends CommonMapper<TrialOrder> {
|
||||
|
||||
|
||||
Map<String, Long> countOfficialUser();
|
||||
|
||||
}
|
||||
|
||||
19
src/main/java/com/ai/da/mapper/primary/UserFollowMapper.java
Normal file
19
src/main/java/com/ai/da/mapper/primary/UserFollowMapper.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.UserFollow;
|
||||
import com.ai.da.model.vo.AccountFollowVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface UserFollowMapper extends CommonMapper<UserFollow> {
|
||||
List<AccountFollowVO> getFolloweeListByFollower(Long followerAccountId, Integer limit, Integer offset, String order);
|
||||
|
||||
List<AccountFollowVO> getFollowerListByFollowee(Long followeeAccountId, Integer limit, Integer offset, String order);
|
||||
|
||||
List<AccountFollowVO> getFolloweeListByName(String name, Long followerId);
|
||||
|
||||
List<AccountFollowVO> getFollowerListByName(String name, Long followeeId);
|
||||
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package com.ai.da.mapper.primary;
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.primary.entity.UserLike;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ai.da.mapper.primary.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -69,11 +70,13 @@ public class Account implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date createDate;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date updateDate;
|
||||
|
||||
private Integer isTrial;
|
||||
@@ -93,6 +96,28 @@ public class Account implements Serializable {
|
||||
* 1 : 年付用户
|
||||
* 2 : 月付用户
|
||||
* 3 : 试用用户
|
||||
* 4 : 参加活动获取30天有效期和6000个积分的用户
|
||||
* 5 : 企业管理员账号
|
||||
* 6 : 企业子账号
|
||||
* 7 : 学校管理员
|
||||
* 8 : 学校子账号
|
||||
*/
|
||||
private Integer systemUser;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
private String organizationName;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
private Integer isAdmin;
|
||||
|
||||
private BigDecimal shareCredits;
|
||||
|
||||
private Integer subAccountNum;
|
||||
|
||||
private String invitationCode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("account_extend")
|
||||
public class AccountExtend implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private String authType;
|
||||
|
||||
private String auth;
|
||||
}
|
||||
@@ -40,6 +40,8 @@ public class Collection implements Serializable {
|
||||
*/
|
||||
private String moodTemplateId;
|
||||
|
||||
private String moodboardPosition;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -72,6 +72,19 @@ public class Generate {
|
||||
*/
|
||||
private String seed;
|
||||
|
||||
/**
|
||||
* 1 -> 粗
|
||||
* 2 -> 中
|
||||
* 3 -> 细
|
||||
* custom -> 自定义
|
||||
*/
|
||||
private String sketchStyle;
|
||||
|
||||
/**
|
||||
* sketch 风格参考图的collection_element_id
|
||||
*/
|
||||
private Long styleImageElementId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GoogleUser {
|
||||
private String sub; // 用户唯一标识
|
||||
private String email;
|
||||
private String name;
|
||||
private String picture;
|
||||
private boolean emailVerified;
|
||||
private String givenName;
|
||||
private String familyName;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_notification")
|
||||
@Data
|
||||
public class Notification extends BaseEntity{
|
||||
/**
|
||||
* 操作类型 system/like/comment/follow
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 发起操作者用户id
|
||||
*/
|
||||
private Long senderId;
|
||||
/**
|
||||
* 被操作对象用户id
|
||||
*/
|
||||
private Long receiverId;
|
||||
/**
|
||||
* 点赞评论时的作品id
|
||||
*/
|
||||
private Long portfolioId;
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 评论id
|
||||
*/
|
||||
private Long commentId;
|
||||
/**
|
||||
* 个人消息已读状态
|
||||
*/
|
||||
private Integer isRead;
|
||||
/**
|
||||
* 系统消息发布状态
|
||||
*/
|
||||
private Integer publishFlag;
|
||||
|
||||
/**
|
||||
* 是否被删除
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
public Notification() {
|
||||
}
|
||||
|
||||
public Notification(String type, Long senderId, Long receiverId) {
|
||||
this.type = type;
|
||||
this.senderId = senderId;
|
||||
this.receiverId = receiverId;
|
||||
}
|
||||
|
||||
public Notification(String type, Long senderId, Long receiverId, Long portfolioId) {
|
||||
this.type = type;
|
||||
this.senderId = senderId;
|
||||
this.receiverId = receiverId;
|
||||
this.portfolioId = portfolioId;
|
||||
}
|
||||
|
||||
public Notification(String type, Long senderId, Long receiverId, Long portfolioId, String content, Long commentId) {
|
||||
this.type = type;
|
||||
this.senderId = senderId;
|
||||
this.receiverId = receiverId;
|
||||
this.portfolioId = portfolioId;
|
||||
this.content = content;
|
||||
this.commentId = commentId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_portfolio_tags")
|
||||
@Data
|
||||
public class PortfolioTags extends BaseEntity{
|
||||
private Long portfolioId;
|
||||
|
||||
private Long tagId;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("product_image_attribute")
|
||||
public class ProductImageAttribute implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private String imgName;
|
||||
private String length;
|
||||
private String sleeveLength;
|
||||
private String sleeveShape;
|
||||
private String sleeveShoulder;
|
||||
private String neckline;
|
||||
private String collar;
|
||||
private String design;
|
||||
private String silhouette;
|
||||
private String type;
|
||||
private String openingType;
|
||||
private String subtype;
|
||||
|
||||
private String style;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_sys_notification_read_status")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysNotificationReadStatus extends BaseEntity{
|
||||
/**
|
||||
* 系统消息id
|
||||
*/
|
||||
private Long system_notification_id;
|
||||
|
||||
/**
|
||||
* 已读当前消息的用户id将被存储
|
||||
*/
|
||||
private Long account_id;
|
||||
}
|
||||
13
src/main/java/com/ai/da/mapper/primary/entity/Tags.java
Normal file
13
src/main/java/com/ai/da/mapper/primary/entity/Tags.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_tags")
|
||||
@Data
|
||||
public class Tags extends BaseEntity{
|
||||
|
||||
private String tagName;
|
||||
}
|
||||
@@ -42,4 +42,6 @@ public class ToProductImageResult implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "generate 结果类型")
|
||||
private String resultType;
|
||||
|
||||
private Double brightenValue;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ai.da.mapper.primary.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -49,11 +50,13 @@ public class TrialOrder implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_user_follow")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserFollow extends BaseEntity{
|
||||
|
||||
/**
|
||||
* 被关注者用户id
|
||||
*/
|
||||
private Long followeeId;
|
||||
/**
|
||||
* 关注者用户id
|
||||
*/
|
||||
private Long followerId;
|
||||
|
||||
|
||||
}
|
||||
@@ -59,4 +59,9 @@ public class UserLike implements Serializable {
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateDate;
|
||||
|
||||
/**
|
||||
* design对应的mask是否已替换为最新的
|
||||
*/
|
||||
private Integer converted;
|
||||
}
|
||||
|
||||
@@ -28,4 +28,6 @@ public interface AttributeRetrievalMapper {
|
||||
void updateStyleById(Long idByFileName, String style, String tableName);
|
||||
|
||||
void updateStyleByFileName(String style, String fileName, String tableName);
|
||||
|
||||
String getStyleByUrl(String replace,String tableName);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,4 @@ public class AttributeRetrieval {
|
||||
private String subtype;
|
||||
|
||||
private String style;
|
||||
|
||||
private Integer deprecated;
|
||||
}
|
||||
|
||||
@@ -32,4 +32,6 @@ public class AccountLoginDTO {
|
||||
@ApiModelProperty("邮箱验证码")
|
||||
private String emailVerifyCode;
|
||||
|
||||
private String organizationName;
|
||||
|
||||
}
|
||||
|
||||
12
src/main/java/com/ai/da/model/dto/AddSubAccountDTO.java
Normal file
12
src/main/java/com/ai/da/model/dto/AddSubAccountDTO.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AddSubAccountDTO extends Account {
|
||||
|
||||
private List<Long> deleteIdList;
|
||||
}
|
||||
@@ -27,10 +27,6 @@ public class DesignCollectionDTO {
|
||||
@ApiModelProperty("手稿板图片id 数组")
|
||||
private List<CollectionSketchDTO> sketchBoards;
|
||||
|
||||
// 2023.10版本去除该入参
|
||||
// @ApiModelProperty("市场手稿板图片id 数组")
|
||||
// private List<DesignCollectionElementDTO> marketingSketchs;
|
||||
|
||||
@NotNull(message = "systemScale.cannot.be.empty")
|
||||
@ApiModelProperty("系统取图比列")
|
||||
private BigDecimal systemScale;
|
||||
@@ -65,4 +61,10 @@ public class DesignCollectionDTO {
|
||||
@ApiModelProperty("python端design进程ID")
|
||||
private String processId;
|
||||
|
||||
private String moodboardPostion;
|
||||
|
||||
private List<String> requestIdList;
|
||||
|
||||
private Integer designNum;
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,10 @@ public class DesignSingleItemDTO implements Serializable {
|
||||
@ApiModelProperty("衣服上的装饰")
|
||||
private DesignSinglePrintDTO trims;
|
||||
|
||||
@ApiModelProperty("标注后的mask 的base64")
|
||||
private String maskUrl;
|
||||
|
||||
@ApiModelProperty("mask 的minio地址")
|
||||
private String maskMinioUrl;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class EmailSendDTO {
|
||||
private String email;
|
||||
|
||||
@NotBlank(message = "operationType.cannot.be.empty")
|
||||
@ApiModelProperty("操作类型 LOGIN 注册 FORGET_PWD 忘记密码 BIND_MAILBOX 绑定邮箱")
|
||||
@ApiModelProperty("操作类型 LOGIN 注册 FORGET_PWD 忘记密码 BIND_MAILBOX 绑定邮箱 CHANGE_MAILBOX 更改邮箱")
|
||||
private String operationType;
|
||||
|
||||
@ApiModelProperty("异常ip")
|
||||
|
||||
30
src/main/java/com/ai/da/model/dto/GenerateModifyDTO.java
Normal file
30
src/main/java/com/ai/da/model/dto/GenerateModifyDTO.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("修改imageToSketch提取出的sketch")
|
||||
@Data
|
||||
public class GenerateModifyDTO {
|
||||
@NotNull(message = "image cannot be empty")
|
||||
@ApiModelProperty(value = "需要保存的图片的base64格式", required = true)
|
||||
private String base64;
|
||||
|
||||
@NotNull(message = "gender cannot be empty")
|
||||
@ApiModelProperty(value = "sketch所属性别", required = true)
|
||||
private String gender;
|
||||
|
||||
@NotNull(message = "category cannot be empty")
|
||||
@ApiModelProperty(value = "sketch所属分类", required = true)
|
||||
private String category;
|
||||
|
||||
@NotNull(message = "id cannot be empty")
|
||||
@ApiModelProperty(value = "原图id", required = true)
|
||||
private String originalId;
|
||||
|
||||
@ApiModelProperty("是否覆盖原图")
|
||||
private Boolean isOverride;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class GenerateThroughImageTextDTO {
|
||||
@ApiModelProperty("text image text-image")
|
||||
String generateType;
|
||||
|
||||
@ApiModelProperty("图片是update,还是从library中选择 collection || library")
|
||||
@ApiModelProperty("图片来源:update,从library中选择,从toProductImage结果中选择 collection || library || productImage")
|
||||
String designType;
|
||||
|
||||
@NotBlank(message = "level1Type cannot be empty!")
|
||||
|
||||
@@ -29,12 +29,15 @@ public class GenerateToPythonDTO {
|
||||
|
||||
private String svg;
|
||||
|
||||
public GenerateToPythonDTO(String tasks_id, String prompt, String image_url, String mode, String category, String gender) {
|
||||
private String version;
|
||||
|
||||
public GenerateToPythonDTO(String tasks_id, String prompt, String image_url, String mode, String category, String gender, String version) {
|
||||
this.image_url = image_url;
|
||||
this.category = category;
|
||||
this.prompt = prompt;
|
||||
this.mode = mode;
|
||||
this.tasks_id = tasks_id;
|
||||
this.gender = gender;
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
||||
19
src/main/java/com/ai/da/model/dto/GetFollowListDTO.java
Normal file
19
src/main/java/com/ai/da/model/dto/GetFollowListDTO.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("按条件分页查询关注列表")
|
||||
public class GetFollowListDTO extends PageQueryBaseVo {
|
||||
|
||||
@ApiModelProperty("查找指定用户名")
|
||||
private String searchByName;
|
||||
|
||||
@ApiModelProperty("按关注时间排序 DESC 降序 || ASC 升序")
|
||||
private String order;
|
||||
}
|
||||
16
src/main/java/com/ai/da/model/dto/GetNotificationDTO.java
Normal file
16
src/main/java/com/ai/da/model/dto/GetNotificationDTO.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel
|
||||
@Data
|
||||
public class GetNotificationDTO extends PageQueryBaseVo {
|
||||
|
||||
@ApiModelProperty("system/like/comment/follow/newPosted")
|
||||
private String type;
|
||||
}
|
||||
22
src/main/java/com/ai/da/model/dto/ImageToSketchDTO.java
Normal file
22
src/main/java/com/ai/da/model/dto/ImageToSketchDTO.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("image to sketch")
|
||||
@Data
|
||||
public class ImageToSketchDTO {
|
||||
|
||||
@ApiModelProperty("上传图片的collection_element_id")
|
||||
private Long elementId;
|
||||
|
||||
@ApiModelProperty("sketch线条风格 1->粗, 2->中, 3->细,传数字,自定义风格时,传空 ")
|
||||
private String style;
|
||||
|
||||
@ApiModelProperty("自定义线条风格,上传图片的collection_element_id")
|
||||
private Long styleImageId;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
}
|
||||
@@ -2,11 +2,11 @@ package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PortfolioDTO extends Portfolio {
|
||||
private Long userLikeGroupId;
|
||||
|
||||
private List<TagsDTO> tagsDTO;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProductImageInitializeDTO {
|
||||
private List<Long> libraryIds;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("发布系统消息")
|
||||
public class PublishSysNotificationDTO {
|
||||
|
||||
@ApiModelProperty("系统消息标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("系统消息内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("系统消息 活动链接")
|
||||
private String link;
|
||||
}
|
||||
@@ -2,11 +2,8 @@ package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("作品集分页查询")
|
||||
public class QueryPortfolioPageDTO extends PageQueryBaseVo {
|
||||
@@ -14,4 +11,8 @@ public class QueryPortfolioPageDTO extends PageQueryBaseVo {
|
||||
private Integer getMyPortfolio;
|
||||
|
||||
private Integer getLikePortfolio;
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private Long tagId;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
@ApiModel("重新设计Collection 入参")
|
||||
public class ReDesignCollectionDTO {
|
||||
|
||||
@NotNull(message = "collectionId.cannot.be.empty")
|
||||
@ApiModelProperty("collectionId")
|
||||
private Long collectionId;
|
||||
|
||||
@@ -34,7 +33,7 @@ public class ReDesignCollectionDTO {
|
||||
@ApiModelProperty("市场手稿板图片id 数组")
|
||||
private List<DesignCollectionElementDTO> marketingSketchs;
|
||||
|
||||
@NotNull(message = "colorBoards.cannot.be.empty")
|
||||
@NotNull(message = "systemScale.cannot.be.empty")
|
||||
@ApiModelProperty("系统取图比列")
|
||||
private BigDecimal systemScale;
|
||||
|
||||
@@ -64,4 +63,8 @@ public class ReDesignCollectionDTO {
|
||||
@NotBlank(message = "processId.cannot.be.empty")
|
||||
@ApiModelProperty("python端design进程ID")
|
||||
private String processId;
|
||||
|
||||
private String moodboardPosition;
|
||||
|
||||
private String moodTemplateId;
|
||||
}
|
||||
|
||||
9
src/main/java/com/ai/da/model/dto/SubAccountPageDTO.java
Normal file
9
src/main/java/com/ai/da/model/dto/SubAccountPageDTO.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SubAccountPageDTO extends PageQueryBaseVo {
|
||||
private String userName;
|
||||
}
|
||||
6
src/main/java/com/ai/da/model/dto/TagsDTO.java
Normal file
6
src/main/java/com/ai/da/model/dto/TagsDTO.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Tags;
|
||||
|
||||
public class TagsDTO extends Tags {
|
||||
}
|
||||
@@ -13,4 +13,5 @@ public class ToProductImageDTO {
|
||||
private String prompt;
|
||||
private BigDecimal imageStrength;
|
||||
private String direction;
|
||||
private Double brightenValue;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ public class UserDesignStatisticDTO {
|
||||
|
||||
private String isTrial;
|
||||
|
||||
private String credits;
|
||||
|
||||
private String trialOrderId;
|
||||
|
||||
private String title;
|
||||
|
||||
18
src/main/java/com/ai/da/model/enums/SketchGenerateType.java
Normal file
18
src/main/java/com/ai/da/model/enums/SketchGenerateType.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
public enum SketchGenerateType implements IEnumDisplay{
|
||||
GENERATE("generate"),
|
||||
|
||||
EXTRACT("extract"),;
|
||||
|
||||
private String value;
|
||||
|
||||
SketchGenerateType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/ai/da/model/enums/SketchStyle.java
Normal file
20
src/main/java/com/ai/da/model/enums/SketchStyle.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
public enum SketchStyle implements IEnumDisplay{
|
||||
|
||||
THICK("1"),
|
||||
|
||||
MEDIUM("2"),
|
||||
|
||||
THIN("3");
|
||||
|
||||
private String value;
|
||||
|
||||
SketchStyle(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
33
src/main/java/com/ai/da/model/vo/AccountFollowVO.java
Normal file
33
src/main/java/com/ai/da/model/vo/AccountFollowVO.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccountFollowVO {
|
||||
/**
|
||||
* userId
|
||||
*/
|
||||
private Long senderId;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* followTime
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* mutualFollowing 互粉
|
||||
*/
|
||||
private Integer isFollow;
|
||||
}
|
||||
@@ -34,4 +34,10 @@ public class AccountLoginVO {
|
||||
|
||||
private Integer systemUser;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Long followeeCount;
|
||||
|
||||
private Long followerCount;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public class DesignCollectionItemVO {
|
||||
@ApiModelProperty("t_design_python_outfit id")
|
||||
private String designOutfitUrl;
|
||||
|
||||
private String objectSign;
|
||||
|
||||
public DesignCollectionItemVO() {
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public class DesignCollectionVO {
|
||||
|
||||
private String processId;
|
||||
|
||||
private List<String> UnfinishedList;
|
||||
|
||||
public DesignCollectionVO() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,10 @@ public class GenerateResultVO {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public GenerateResultVO(Long id, String url, String status) {
|
||||
public GenerateResultVO(Long id, String url, String status, String category) {
|
||||
this.id = id;
|
||||
this.url = url;
|
||||
this.status = status;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
13
src/main/java/com/ai/da/model/vo/GoogleTokenResponse.java
Normal file
13
src/main/java/com/ai/da/model/vo/GoogleTokenResponse.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GoogleTokenResponse {
|
||||
private String accessToken;
|
||||
private String idToken;
|
||||
private long expiresIn;
|
||||
private String tokenType;
|
||||
private String scope;
|
||||
|
||||
}
|
||||
29
src/main/java/com/ai/da/model/vo/NotificationVO.java
Normal file
29
src/main/java/com/ai/da/model/vo/NotificationVO.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.Notification;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class NotificationVO extends Notification {
|
||||
|
||||
/**
|
||||
* senderUserName
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
// private String senderUserAvatar;
|
||||
|
||||
private String portfolioName;
|
||||
|
||||
/**
|
||||
* sender头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
private Integer isFollow;
|
||||
|
||||
private String canvas;
|
||||
|
||||
}
|
||||
31
src/main/java/com/ai/da/model/vo/PersonalHomepageVO.java
Normal file
31
src/main/java/com/ai/da/model/vo/PersonalHomepageVO.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("个人主页返回信息")
|
||||
public class PersonalHomepageVO {
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("用户头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty("用户作品总数")
|
||||
private Long portfolioCount;
|
||||
|
||||
@ApiModelProperty("粉丝总数")
|
||||
private Long followerCount;
|
||||
|
||||
@ApiModelProperty("关注者总数")
|
||||
private Long followeeCount;
|
||||
|
||||
@ApiModelProperty("个人主页总浏览量")
|
||||
private Long homepageViewCount;
|
||||
|
||||
@ApiModelProperty("是否关注了主页用户")
|
||||
private Integer isFollow;
|
||||
}
|
||||
@@ -28,4 +28,8 @@ public class PortfolioVO extends Portfolio {
|
||||
private Integer selected;
|
||||
|
||||
private Integer jumpable;
|
||||
|
||||
private Integer isFollow;
|
||||
|
||||
private String avatar;
|
||||
}
|
||||
|
||||
38
src/main/java/com/ai/da/model/vo/QueryUserConditionsVO.java
Normal file
38
src/main/java/com/ai/da/model/vo/QueryUserConditionsVO.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("按条件筛选试用用户")
|
||||
public class QueryUserConditionsVO extends PageQueryBaseVo {
|
||||
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String email;
|
||||
|
||||
private String country;
|
||||
|
||||
private String occupation;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty("Ascending(升序) || Descending(降序)")
|
||||
private String order;
|
||||
|
||||
// by id | time | credits
|
||||
private String orderBy;
|
||||
|
||||
private Integer systemUser;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QuestionnaireFeedbackVO {
|
||||
private Info age;
|
||||
private Info question1;
|
||||
private Info question2;
|
||||
private Info question3;
|
||||
private List<String> otherDesignTools;
|
||||
|
||||
public QuestionnaireFeedbackVO() {
|
||||
}
|
||||
|
||||
public QuestionnaireFeedbackVO(Info age, Info question1, Info question2, Info question3, List<String> otherDesignTools) {
|
||||
this.age = age;
|
||||
this.question1 = question1;
|
||||
this.question2 = question2;
|
||||
this.question3 = question3;
|
||||
this.otherDesignTools = otherDesignTools;
|
||||
}
|
||||
|
||||
public static class Info{
|
||||
public List<String> name;
|
||||
public List<Integer> values;
|
||||
public List<String> otherReason;
|
||||
|
||||
public Info() {
|
||||
}
|
||||
|
||||
public Info(List<String> name, List<Integer> values) {
|
||||
this.name = name;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public Info(List<String> name, List<Integer> values, List<String> otherReason) {
|
||||
this.name = name;
|
||||
this.values = values;
|
||||
this.otherReason = otherReason;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.model.dto.PortfolioDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@ApiModel("用户choose详细-响应")
|
||||
@@ -24,4 +23,7 @@ public class UserLikeChooseVO {
|
||||
private String sex;
|
||||
|
||||
private Integer beenPublished;
|
||||
|
||||
// private Portfolio portfolio;
|
||||
private PortfolioDTO portfolioDTO;
|
||||
}
|
||||
|
||||
@@ -35,4 +35,6 @@ public class UserLikeCollectionVO {
|
||||
|
||||
@ApiModelProperty("市场手稿板图片 数组")
|
||||
private List<CollectionElementVO> marketingSketchs;
|
||||
|
||||
private String moodboardPosition;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,8 @@ public class ValidateElementVO {
|
||||
private String modelSex;
|
||||
|
||||
private String style;
|
||||
|
||||
private List<String> requestIdList;
|
||||
|
||||
private Integer designNum;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user