Merge branch 'release/3.0' into dev/dev_xp

# Conflicts:
#	src/main/java/com/ai/da/python/PythonService.java
#	src/main/java/com/ai/da/service/impl/DesignItemServiceImpl.java
This commit is contained in:
2024-06-11 15:23:24 +08:00
15 changed files with 74 additions and 64 deletions

View File

@@ -12,16 +12,16 @@ public class MQConfig {
// public static final String GENERATE_QUEUE = "generate-queue-test"; // 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-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-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-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-local";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-dev"; public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";
public MQConfig() { public MQConfig() {
} }

View File

@@ -218,17 +218,17 @@ public class SRConsumer {
taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null); taskListService.updateTaskStatusOrOutputRedis(uniqueId, "fail", null);
} }
// @RabbitListener(queues = MQConfig.SR_QUEUE) @RabbitListener(queues = MQConfig.SR_QUEUE)
// @RabbitHandler @RabbitHandler
// public void SRConsumer1(Message msg, Channel channel) { public void SRConsumer1(Message msg, Channel channel) {
// superResolution(msg, channel, "consumer 1"); superResolution(msg, channel, "consumer 1");
// } }
//
//
// @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE) @RabbitListener(queues = MQConfig.SR_RESULT_QUEUE)
// @RabbitHandler @RabbitHandler
// public void SRResultConsumer1(Message msg, Channel channel) { public void SRResultConsumer1(Message msg, Channel channel) {
// getSRResult(msg, channel, "consumer 1"); getSRResult(msg, channel, "consumer 1");
// } }
} }

View File

@@ -34,7 +34,7 @@ public class MyTaskScheduler {
// 定时任务,每十五天执行一次 // 定时任务,每十五天执行一次
// @Scheduled(cron = "0 0 0 ? * MON") // @Scheduled(cron = "0 0 0 ? * MON")
// @Scheduled(cron = "0 0 0 */15 * ?") @Scheduled(cron = "0 0 0 */15 * ?")
public void checkExpiry() { public void checkExpiry() {
// 检测正式用户是否快要过期 // 检测正式用户是否快要过期
QueryWrapper<Account> qw = new QueryWrapper<>(); QueryWrapper<Account> qw = new QueryWrapper<>();
@@ -68,7 +68,7 @@ public class MyTaskScheduler {
} }
} }
} }
// @Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
public void sendTrialOrderExcelToManagements() { public void sendTrialOrderExcelToManagements() {
// 获取前一天日期 // 获取前一天日期
LocalDate yesterday = LocalDate.now().minusDays(1); LocalDate yesterday = LocalDate.now().minusDays(1);

View File

@@ -23,7 +23,7 @@ public class PaypalTask {
@Resource @Resource
private PayPalCheckoutService payPalCheckoutService; private PayPalCheckoutService payPalCheckoutService;
// @Scheduled(cron = "0/30 * * * * ?") @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm() throws SerializeException { public void orderConfirm() throws SerializeException {
log.info("PayPal orderConfirm 被执行......"); log.info("PayPal orderConfirm 被执行......");

View File

@@ -136,7 +136,7 @@ public class SendEmailUtil {
private final static Long TRIAL_ORDER_LIST_ID = 122273L; private final static Long TRIAL_ORDER_LIST_ID = 122273L;
private final static Long NO_TRIAL_ORDER_LIST_ID = 122591L; private final static Long NO_TRIAL_ORDER_LIST_ID = 122591L;
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country) { public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country, boolean link) {
try { try {
// 实例化一个认证对象 // 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy); Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -173,7 +173,7 @@ public class SendEmailUtil {
}else { }else {
template.setTemplateID(NOTIFICATION_TEMPLATE_ID); template.setTemplateID(NOTIFICATION_TEMPLATE_ID);
} }
template.setTemplateData(buildNotificationData(trialOrder)); template.setTemplateData(buildNotificationData(trialOrder, link));
break; break;
default: default:
break; break;
@@ -345,7 +345,7 @@ public class SendEmailUtil {
} }
// 构建试用订单通过通知数据 // 构建试用订单通过通知数据
private static String buildNotificationData(TrialOrder trialOrder) { private static String buildNotificationData(TrialOrder trialOrder, boolean link) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
// 设置试用订单通过通知相关数据 // 设置试用订单通过通知相关数据
jsonObject.put("title", trialOrder.getTitle()); jsonObject.put("title", trialOrder.getTitle());
@@ -353,6 +353,11 @@ public class SendEmailUtil {
jsonObject.put("givenName", trialOrder.getGivenName()); jsonObject.put("givenName", trialOrder.getGivenName());
jsonObject.put("userName", trialOrder.getUserName()); jsonObject.put("userName", trialOrder.getUserName());
jsonObject.put("email", trialOrder.getEmail()); jsonObject.put("email", trialOrder.getEmail());
if (link) {
jsonObject.put("days", 14);
}else {
jsonObject.put("days", 5);
}
return jsonObject.toJSONString(); return jsonObject.toJSONString();
} }

View File

@@ -75,7 +75,7 @@ public class CollectionElement implements Serializable {
*/ */
private String md5; private String md5;
private String gradientString; // private String gradientString;
/** /**
* 创建时间 * 创建时间

View File

@@ -64,7 +64,7 @@ public class DesignItemDetail implements Serializable {
*/ */
private String color; private String color;
private String gradientString; // private String gradientString;
/** /**
* 对应的print图片的绝对路径 * 对应的print图片的绝对路径

View File

@@ -26,10 +26,10 @@ public class CollectionColorDTO {
@ApiModelProperty("潘通RGB值") @ApiModelProperty("潘通RGB值")
private String rgbValue; private String rgbValue;
private Gradient gradient; // private Gradient gradient;
//
// private String gradientString;
private String gradientString; // private String gradientMinioUrl;
private String gradientMinioUrl;
} }

View File

@@ -50,8 +50,8 @@ public class DesignSingleItemDTO implements Serializable {
@ApiModelProperty("图层优先级") @ApiModelProperty("图层优先级")
private Integer priority; private Integer priority;
@ApiModelProperty("渐变 颜色") // @ApiModelProperty("渐变 颜色")
private Gradient gradient; // private Gradient gradient;
@ApiModelProperty("画笔修改过的sketch图片的base64格式的数据") @ApiModelProperty("画笔修改过的sketch图片的base64格式的数据")
private String sketchString; private String sketchString;

View File

@@ -28,9 +28,9 @@ public class DesignPythonItem {
*/ */
private String color; private String color;
private String gradient; // private String gradient;
private String gradientString; // private String gradientString;
/** /**
* 对应的print图片的绝对路径 * 对应的print图片的绝对路径
@@ -114,7 +114,7 @@ public class DesignPythonItem {
} }
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, Long businessId, public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, Long businessId,
Long image_id, List<Long> offset, Float[] resize_scale, Integer priority, String gradient, String gradientString) { Long image_id, List<Long> offset, Float[] resize_scale, Integer priority) {
this.type = type; this.type = type;
this.path = path; this.path = path;
this.color = color; this.color = color;
@@ -125,8 +125,8 @@ public class DesignPythonItem {
this.offset = offset; this.offset = offset;
this.resize_scale = resize_scale; this.resize_scale = resize_scale;
this.priority = priority; this.priority = priority;
this.gradient = gradient; // this.gradient = gradient;
this.gradientString = gradientString; // this.gradientString = gradientString;
} }
public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, String icon, Long businessId, Long image_id) { public DesignPythonItem(String type, String path, String color, DesignPythonItemPrint print, String icon, Long businessId, Long image_id) {

View File

@@ -184,7 +184,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
} }
private void validateUserValidaExpire(Account account) { private void validateUserValidaExpire(Account account) {
Long currentTime = new Date().getTime(); Long currentTime = new Date().getTime();
if (Objects.nonNull(account.getValidStartTime())) { if (Objects.nonNull(account.getValidStartTime())) {
if (currentTime < account.getValidStartTime()) { if (currentTime < account.getValidStartTime()) {
@@ -469,6 +468,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
public Boolean addTrialUser(AccountTrialDTO accountTrialDTO, HttpServletRequest request) { public Boolean addTrialUser(AccountTrialDTO accountTrialDTO, HttpServletRequest request) {
// 获取用户申请试用IP // 获取用户申请试用IP
String ipAddress = RequestInfoUtil.getIpAddress(request); String ipAddress = RequestInfoUtil.getIpAddress(request);
boolean link = false;
if (StringUtils.isNotBlank(accountTrialDTO.getRef())) {
link = true;
}
// 先检测试用订单 // 先检测试用订单
QueryWrapper<TrialOrder> trialOrderQueryWrapper = new QueryWrapper<>(); QueryWrapper<TrialOrder> trialOrderQueryWrapper = new QueryWrapper<>();
trialOrderQueryWrapper.eq("BINARY email", accountTrialDTO.getEmail()); trialOrderQueryWrapper.eq("BINARY email", accountTrialDTO.getEmail());
@@ -516,7 +519,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
account.setIsTrial(1); account.setIsTrial(1);
account.setIsBeginner(1); account.setIsBeginner(1);
account.setValidStartTime(System.currentTimeMillis()); account.setValidStartTime(System.currentTimeMillis());
if (StringUtils.isNotBlank(accountTrialDTO.getRef())) {
if (link) {
account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli());
}else { }else {
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
@@ -528,7 +532,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
account.setUserEmail(trialOrder.getEmail()); account.setUserEmail(trialOrder.getEmail());
account.setLanguage(Language.ENGLISH.name()); account.setLanguage(Language.ENGLISH.name());
account.setValidStartTime(System.currentTimeMillis()); account.setValidStartTime(System.currentTimeMillis());
if (StringUtils.isNotBlank(accountTrialDTO.getRef())) { if (link) {
account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(14, ChronoUnit.DAYS).toEpochMilli());
}else { }else {
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli()); account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
@@ -543,9 +547,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2); // SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2); // SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
if (trialOrder.getCountry().equals("China")) { if (trialOrder.getCountry().equals("China")) {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry()); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry(), link);
}else { }else {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry()); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry(), link);
} }
} }
return Boolean.TRUE; return Boolean.TRUE;
@@ -595,9 +599,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2, trialOrder.getCountry()); // SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2, trialOrder.getCountry());
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2, trialOrder.getCountry()); // SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2, trialOrder.getCountry());
if (trialOrder.getCountry().equals("China")) { if (trialOrder.getCountry().equals("China")) {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry()); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry(), false);
}else { }else {
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry()); SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry(), false);
} }
} }
return Boolean.TRUE; return Boolean.TRUE;

View File

@@ -351,20 +351,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
@Override @Override
public ValidateElementVO validateElement(DesignCollectionDTO designDTO) { public ValidateElementVO validateElement(DesignCollectionDTO designDTO) {
ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class); ValidateElementVO elementVO = CopyUtil.copyObject(designDTO, ValidateElementVO.class);
List<CollectionColorDTO> colorBoards = elementVO.getColorBoards(); // List<CollectionColorDTO> colorBoards = elementVO.getColorBoards();
for (CollectionColorDTO colorBoard : colorBoards) { // for (CollectionColorDTO colorBoard : colorBoards) {
if (Objects.nonNull(colorBoard.getGradient())) { // if (Objects.nonNull(colorBoard.getGradient())) {
String colorImg = colorBoard.getGradient().getColorImg(); // String colorImg = colorBoard.getGradient().getColorImg();
String[] parts = colorImg.split(","); // String[] parts = colorImg.split(",");
String imageType = parts[0].split("/")[1].split(";")[0]; // String imageType = parts[0].split("/")[1].split(";")[0];
String base64Data = parts[1]; // String base64Data = parts[1];
String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType); // String gradientMinioUrl = minioUtil.uploadImageFromBase64(gradientBucketName, base64Data, imageType);
colorBoard.setGradientMinioUrl(gradientMinioUrl); // colorBoard.setGradientMinioUrl(gradientMinioUrl);
colorBoard.getGradient().setColorImg(null); // colorBoard.getGradient().setColorImg(null);
colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient())); // colorBoard.setGradientString(JSON.toJSONString(colorBoard.getGradient()));
} // }
} // }
elementVO.setColorBoards(colorBoards); // elementVO.setColorBoards(colorBoards);
List<Long> usedElementIds = elementVO.getUsedElementIds(); List<Long> usedElementIds = elementVO.getUsedElementIds();
List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements(); List<CollectionElement> libraryCollectionElements = elementVO.getLibraryCollectionElements();
List<CollectionElement> generateCollectionElements = elementVO.getGenerateCollectionElements(); List<CollectionElement> generateCollectionElements = elementVO.getGenerateCollectionElements();
@@ -783,10 +783,10 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
element.setColorRgb(color.getRgbValue()); element.setColorRgb(color.getRgbValue());
//按时区计算 //按时区计算
element.setCreateDate(DateUtil.getByTimeZone(timeZone)); element.setCreateDate(DateUtil.getByTimeZone(timeZone));
if (Objects.nonNull(color.getGradient())) { // if (Objects.nonNull(color.getGradient())) {
color.getGradient().setColorImg(null); // color.getGradient().setColorImg(null);
} // }
element.setGradientString(JSON.toJSONString(color.getGradient())); // element.setGradientString(JSON.toJSONString(color.getGradient()));
elements.add(element); elements.add(element);
}); });
return elements; return elements;

View File

@@ -998,7 +998,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60)); d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60));
d.setMinIOPath(o.getPath()); d.setMinIOPath(o.getPath());
d.setLevel1Type(converTypeToLevel1(o.getType())); d.setLevel1Type(converTypeToLevel1(o.getType()));
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class)); // d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
// 根据designItemDetailId获取印花 // 根据designItemDetailId获取印花
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId()); List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId());
// 判断有无印花 // 判断有无印花

View File

@@ -58,6 +58,7 @@ minio.bucketName.results=aida-results
minio.bucketName.sysImage=aida-sys-image minio.bucketName.sysImage=aida-sys-image
minio.bucketName.users=aida-users minio.bucketName.users=aida-users
minio.bucketName.collectionElement=aida-collection-element minio.bucketName.collectionElement=aida-collection-element
minio.bucketName.gradient=aida-gradient
redirect_url=http://18.167.251.121:7788 redirect_url=http://18.167.251.121:7788
spring.rabbitmq.host=18.167.251.121 spring.rabbitmq.host=18.167.251.121
@@ -69,7 +70,7 @@ spring.rabbitmq.virtual-host=/
spring.redis.host=172.31.11.32 spring.redis.host=172.31.11.32
#spring.redis.host=18.167.251.121 #spring.redis.host=18.167.251.121
spring.redis.port=6379 spring.redis.port=6379
spring.redis.database=1 spring.redis.database=2
spring.redis.password=Aidlab spring.redis.password=Aidlab
spring.redis.lettuce.pool.max-active=8 spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8 spring.redis.lettuce.pool.max-idle=8

View File

@@ -2,7 +2,7 @@
#spring.profiles.active=test #spring.profiles.active=test
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) #<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
#spring.profiles.active=prod spring.profiles.active=prod
#<23><><EFBFBD><EFBFBD>application-dev<65>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) #<23><><EFBFBD><EFBFBD>application-dev<65>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
spring.profiles.active=dev #spring.profiles.active=dev