Merge branch 'dev/3.1_release_merge' into temp_PromotionCode
This commit is contained in:
@@ -202,7 +202,7 @@ public class MyTaskScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void sendTrialOrderExcelToManagements() {
|
public void sendTrialOrderExcelToManagements() {
|
||||||
// 获取前一天日期
|
// 获取前一天日期
|
||||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
|
|||||||
@@ -61,10 +61,7 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
|||||||
, "/api/account/schoolLogin", "/api/account/enterpriseLogin", "/api/account/organizationNameSearch",
|
, "/api/account/schoolLogin", "/api/account/enterpriseLogin", "/api/account/organizationNameSearch",
|
||||||
"/api/llm/stream",
|
"/api/llm/stream",
|
||||||
//GlobalAwardController
|
//GlobalAwardController
|
||||||
"/api/global-award/uploads/pdf/init", "/api/global-award/uploads/pdf/chunk", "/api/global-award/uploads/pdf/complete", "/api/global-award/uploads/pdf/status",
|
"/api/global-award"
|
||||||
"/api/global-award/uploads/video/init", "/api/global-award/uploads/video/chunk", "/api/global-award/uploads/video/complete", "/api/global-award/uploads/video/status",
|
|
||||||
"/api/global-award/contestants/save", "/api/global-award/contestants/by-email", "/api/global-award/checkEmail", "/api/global-award/checkCode","/api/global-award/contestants/export",
|
|
||||||
"/api/global-award/contestants/export/files"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class AccountTask {
|
|||||||
accountService.refreshCreditsMonthly();
|
accountService.refreshCreditsMonthly();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||||
public void getPaidUser() {
|
public void getPaidUser() {
|
||||||
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
// 获取code-create 表中 指定日期之后 订单状态为wc-processing的订单
|
||||||
accountService.extendValidityForCC();
|
accountService.extendValidityForCC();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class PaymentTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayPalCheckoutService payPalCheckoutService;
|
private PayPalCheckoutService payPalCheckoutService;
|
||||||
|
|
||||||
// @Scheduled(cron = "0/30 * * * * ?")
|
// @Scheduled(cron = "0/30 * * * * ?")
|
||||||
public void orderConfirmForPaypal() throws SerializeException {
|
public void orderConfirmForPaypal() throws SerializeException {
|
||||||
|
|
||||||
// log.info("PayPal orderConfirm 被执行......");
|
// log.info("PayPal orderConfirm 被执行......");
|
||||||
@@ -97,7 +97,7 @@ public class PaymentTask {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
@Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
|
||||||
public void updateAffiliateInfoWithPayment(){
|
public void updateAffiliateInfoWithPayment(){
|
||||||
// log.info("佣金计算定时器");
|
// log.info("佣金计算定时器");
|
||||||
affiliateService.updateAffiliateInfoWithPayment();
|
affiliateService.updateAffiliateInfoWithPayment();
|
||||||
@@ -109,7 +109,7 @@ public class PaymentTask {
|
|||||||
affiliateService.syncLinkViewCountToDB();
|
affiliateService.syncLinkViewCountToDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 8 28-31 * ?")
|
// @Scheduled(cron = "0 0 8 28-31 * ?")
|
||||||
public void commissionSummaryReminder(){
|
public void commissionSummaryReminder(){
|
||||||
// 每个月末的最后一天的早上八点执行
|
// 每个月末的最后一天的早上八点执行
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SubscriptionReminderTask {
|
|||||||
REMINDER_DAYS_CONFIG.put("year", 14);
|
REMINDER_DAYS_CONFIG.put("year", 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void subscriptionReminder() {
|
public void subscriptionReminder() {
|
||||||
// 获取所有需要通知的订阅
|
// 获取所有需要通知的订阅
|
||||||
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
|
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
|
||||||
@@ -97,7 +97,7 @@ public class SubscriptionReminderTask {
|
|||||||
return subscriptionInfoMapper.selectList(qw);
|
return subscriptionInfoMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 9 * * ?")
|
// @Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void trialReminder() {
|
public void trialReminder() {
|
||||||
// 今天的 00:00:00 和 23:59:59
|
// 今天的 00:00:00 和 23:59:59
|
||||||
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.ai.da.common.response.Response;
|
|||||||
import com.ai.da.model.dto.*;
|
import com.ai.da.model.dto.*;
|
||||||
import com.ai.da.model.dto.ContestantDTO;
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
import com.ai.da.model.vo.CheckOTPVO;
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
|
import com.ai.da.model.vo.ContestantCountVO;
|
||||||
import com.ai.da.service.GlobalAwardService;
|
import com.ai.da.service.GlobalAwardService;
|
||||||
import com.ai.da.service.upload.UploadService;
|
import com.ai.da.service.upload.UploadService;
|
||||||
import com.ai.da.service.upload.UploadTask;
|
import com.ai.da.service.upload.UploadTask;
|
||||||
@@ -176,10 +177,25 @@ public class GlobalAwardController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/contestants/export/files")
|
@PostMapping("/contestants/export/files")
|
||||||
@ApiOperation(value = "导出参赛者文件到本地", notes = "根据参赛者编号范围导出PDF和视频文件到本地temp/uploads/contestants目录")
|
@ApiOperation(value = "导出参赛者文件为ZIP", notes = "根据参赛者编号范围导出PDF、视频和信息文件为ZIP,直接响应给浏览器")
|
||||||
public Response<Integer> exportContestantFiles(@ApiParam(value = "参赛者文件导出请求", required = true) @RequestBody ContestantExportRequest request) throws Exception {
|
public void exportContestantFiles(@ApiParam(value = "参赛者文件导出请求", required = true) @RequestBody ContestantExportRequest request, HttpServletResponse response) throws Exception {
|
||||||
int exportedCount = globalAwardService.exportContestantFiles(request.getMinContestantNumber(), request.getMaxContestantNumber());
|
byte[] zipData = globalAwardService.exportContestantFilesAsZip(request.getMinContestantNumber(), request.getMaxContestantNumber());
|
||||||
return Response.success(exportedCount);
|
if (zipData.length == 0) {
|
||||||
|
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
response.getWriter().write("No contestants found in the specified range.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
response.setContentType("application/zip");
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"contestants.zip\"");
|
||||||
|
response.setContentLength(zipData.length);
|
||||||
|
response.getOutputStream().write(zipData);
|
||||||
|
response.getOutputStream().flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/contestants/count")
|
||||||
|
@ApiOperation(value = "查询参赛者总数", notes = "查询数据库中参赛者的总数量和最大参赛者编号")
|
||||||
|
public Response<ContestantCountVO> getContestantCount() {
|
||||||
|
return Response.success(globalAwardService.getContestantCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ public class Contestant {
|
|||||||
@TableField("pdf_size")
|
@TableField("pdf_size")
|
||||||
private Long pdfSize;
|
private Long pdfSize;
|
||||||
|
|
||||||
|
@TableField("portfolio_url")
|
||||||
|
private String portfolioUrl;
|
||||||
|
|
||||||
@TableField("created_at")
|
@TableField("created_at")
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
|||||||
17
src/main/java/com/ai/da/model/vo/ContestantCountVO.java
Normal file
17
src/main/java/com/ai/da/model/vo/ContestantCountVO.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ai.da.model.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ContestantCountVO {
|
||||||
|
|
||||||
|
private Long count;
|
||||||
|
|
||||||
|
private Integer maxContestantNumber;
|
||||||
|
}
|
||||||
@@ -34,4 +34,8 @@ public class QueryUserConditionsVO extends PageQueryBaseVo {
|
|||||||
|
|
||||||
private Integer systemUser;
|
private Integer systemUser;
|
||||||
|
|
||||||
|
private Long subscriptionPlanId;
|
||||||
|
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ai.da.service;
|
|||||||
|
|
||||||
import com.ai.da.model.dto.ContestantDTO;
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
import com.ai.da.model.vo.CheckOTPVO;
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
|
import com.ai.da.model.vo.ContestantCountVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -33,12 +34,18 @@ public interface GlobalAwardService {
|
|||||||
void saveContestantsToLocal() throws Exception;
|
void saveContestantsToLocal() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据参赛者编号范围导出参赛者文件到本地目录
|
* 将参赛者文件打包为 ZIP 并返回字节数组(不落盘,直接响应给浏览器)
|
||||||
* @param minContestantNumber 最小参赛者编号
|
* @param minContestantNumber 最小参赛者编号
|
||||||
* @param maxContestantNumber 最大参赛者编号
|
* @param maxContestantNumber 最大参赛者编号
|
||||||
* @return 导出的参赛者数量
|
* @return ZIP 文件的字节数组
|
||||||
*/
|
*/
|
||||||
int exportContestantFiles(Integer minContestantNumber, Integer maxContestantNumber) throws Exception;
|
byte[] exportContestantFilesAsZip(Integer minContestantNumber, Integer maxContestantNumber) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询参赛者总数和最大参赛者编号
|
||||||
|
* @return 参赛者数量和最大参赛者编号
|
||||||
|
*/
|
||||||
|
ContestantCountVO getContestantCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
elementVO.setPrintBoardElements(printBoardElements);
|
elementVO.setPrintBoardElements(printBoardElements);
|
||||||
if (!CollectionUtils.isEmpty(printBoardIds)) {
|
if (!CollectionUtils.isEmpty(printBoardIds)) {
|
||||||
// 从数据库批量查询printBoard元素
|
// 从数据库批量查询printBoard元素
|
||||||
printBoardElements = collectionElementMapper.selectBatchIds(printBoardIds);
|
printBoardElements.addAll(collectionElementMapper.selectBatchIds(printBoardIds));
|
||||||
// 验证查询结果的完整性
|
// 验证查询结果的完整性
|
||||||
if (CollectionUtil.isEmpty(printBoardElements) || printBoardElements.size() != printBoardIds.size()) {
|
if (CollectionUtil.isEmpty(printBoardElements) || printBoardElements.size() != printBoardIds.size()) {
|
||||||
throw new BusinessException("get.printBoards.data.is.mismatch");
|
throw new BusinessException("get.printBoards.data.is.mismatch");
|
||||||
|
|||||||
@@ -787,6 +787,14 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
queryWrapper.lt("create_date", queryUserConditionsVO.getEndTime());
|
queryWrapper.lt("create_date", queryUserConditionsVO.getEndTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Objects.isNull(queryUserConditionsVO.getSubscriptionPlanId())) {
|
||||||
|
queryWrapper.eq("subscription_plan_id", queryUserConditionsVO.getSubscriptionPlanId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.isNull(queryUserConditionsVO.getOrganizationId())) {
|
||||||
|
queryWrapper.eq("organization_id", queryUserConditionsVO.getOrganizationId());
|
||||||
|
}
|
||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
if (!StringUtils.isNullOrEmpty(queryUserConditionsVO.getOrder()) && !StringUtils.isNullOrEmpty(queryUserConditionsVO.getOrderBy())) {
|
if (!StringUtils.isNullOrEmpty(queryUserConditionsVO.getOrder()) && !StringUtils.isNullOrEmpty(queryUserConditionsVO.getOrderBy())) {
|
||||||
String orderBy = "id";
|
String orderBy = "id";
|
||||||
|
|||||||
@@ -756,7 +756,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
print.setPosition("[0.0,0.0]");
|
print.setPosition("[0.0,0.0]");
|
||||||
// print.setScale(1d);
|
// print.setScale(1d);
|
||||||
// todo mark 将print默认scale置为0.3
|
// todo mark 将print默认scale置为0.3
|
||||||
print.setScale(Arrays.toString(new Float[]{0.3f, 0.3f}));
|
print.setScale(Arrays.toString(new Float[]{1.0f, 1.0f}));
|
||||||
print.setAngle(0.0);
|
print.setAngle(0.0);
|
||||||
print.setPriority(1);
|
print.setPriority(1);
|
||||||
QueryWrapper<CollectionElement> getPrintboardLevel2TypeQw = new QueryWrapper<>();
|
QueryWrapper<CollectionElement> getPrintboardLevel2TypeQw = new QueryWrapper<>();
|
||||||
|
|||||||
@@ -3934,11 +3934,48 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] downloadVideoOrImage(String url) {
|
public byte[] downloadVideoOrImage(String url) {
|
||||||
try (CloseableHttpClient client = HttpClients.createDefault();
|
int maxRetries = 3;
|
||||||
InputStream in = client.execute(new HttpGet(url)).getEntity().getContent()) {
|
int retryDelayMs = 1000;
|
||||||
return IOUtils.toByteArray(in);
|
IOException lastException = null;
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
for (int attempt = 1; attempt <= maxRetries; attempt++) {
|
||||||
|
try {
|
||||||
|
return downloadWithTimeout(url, 30000, 60000);
|
||||||
|
} catch (IOException e) {
|
||||||
|
lastException = e;
|
||||||
|
log.warn("下载失败 (尝试 {}/{}): {}", attempt, maxRetries, e.getMessage());
|
||||||
|
|
||||||
|
if (attempt < maxRetries) {
|
||||||
|
try {
|
||||||
|
Thread.sleep((long) retryDelayMs * attempt); // 递增延迟
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new RuntimeException(ie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException("下载失败,已重试 " + maxRetries + " 次", lastException);
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] downloadWithTimeout(String url, int connectTimeout, int socketTimeout) throws IOException {
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setConnectTimeout(connectTimeout)
|
||||||
|
.setSocketTimeout(socketTimeout)
|
||||||
|
.setConnectionRequestTimeout(connectTimeout)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (CloseableHttpClient client = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
|
.build();
|
||||||
|
CloseableHttpResponse response = client.execute(new HttpGet(url))) {
|
||||||
|
|
||||||
|
int statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
if (statusCode != 200) {
|
||||||
|
throw new IOException("HTTP Error: " + statusCode);
|
||||||
|
}
|
||||||
|
return IOUtils.toByteArray(response.getEntity().getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ai.da.mapper.primary.entity.Notification;
|
|||||||
import com.ai.da.model.dto.ContestantDTO;
|
import com.ai.da.model.dto.ContestantDTO;
|
||||||
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||||
import com.ai.da.model.vo.CheckOTPVO;
|
import com.ai.da.model.vo.CheckOTPVO;
|
||||||
|
import com.ai.da.model.vo.ContestantCountVO;
|
||||||
import com.ai.da.service.GlobalAwardService;
|
import com.ai.da.service.GlobalAwardService;
|
||||||
import com.ai.da.service.MessageCenterService;
|
import com.ai.da.service.MessageCenterService;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@@ -26,24 +27,22 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.util.zip.ZipEntry;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -187,6 +186,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
.videoSize(request.getVideoSize())
|
.videoSize(request.getVideoSize())
|
||||||
.pdfSize(request.getPdfSize())
|
.pdfSize(request.getPdfSize())
|
||||||
.contestantNumber(nextNumber)
|
.contestantNumber(nextNumber)
|
||||||
|
.portfolioUrl(request.getPortfolioUrl())
|
||||||
.createdAt(now)
|
.createdAt(now)
|
||||||
.updatedAt(now)
|
.updatedAt(now)
|
||||||
.build();
|
.build();
|
||||||
@@ -227,6 +227,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
existing.setVideoDuration(request.getVideoDuration());
|
existing.setVideoDuration(request.getVideoDuration());
|
||||||
existing.setVideoSize(request.getVideoSize());
|
existing.setVideoSize(request.getVideoSize());
|
||||||
existing.setPdfSize(request.getPdfSize());
|
existing.setPdfSize(request.getPdfSize());
|
||||||
|
existing.setPortfolioUrl(request.getPortfolioUrl());
|
||||||
existing.setUpdatedAt(now);
|
existing.setUpdatedAt(now);
|
||||||
contestantMapper.updateById(existing);
|
contestantMapper.updateById(existing);
|
||||||
resp.put("success", true);
|
resp.put("success", true);
|
||||||
@@ -244,7 +245,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
String[] headers = new String[] {
|
String[] headers = new String[] {
|
||||||
"contestantNumber", "email", "firstName", "lastName", "gender", "occupation",
|
"contestantNumber", "email", "firstName", "lastName", "gender", "occupation",
|
||||||
"age", "countryRegionCity", "phoneNumber", "designTitle", "designDescription",
|
"age", "countryRegionCity", "phoneNumber", "designTitle", "designDescription",
|
||||||
"pdfPath", "videoPath", "videoDuration", "videoSizeMB", "pdfSizeMB", "createdAt", "updatedAt"
|
"pdfPath", "videoPath", "videoDuration", "videoSizeMB", "pdfSizeMB", "portfolioUrl", "createdAt", "updatedAt"
|
||||||
};
|
};
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (int i = 0; i < headers.length; i++) {
|
||||||
Cell c = header.createCell(i);
|
Cell c = header.createCell(i);
|
||||||
@@ -265,11 +266,9 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
r.createCell(ci++).setCellValue(cst.getPhoneNumber() == null ? "" : cst.getPhoneNumber());
|
r.createCell(ci++).setCellValue(cst.getPhoneNumber() == null ? "" : cst.getPhoneNumber());
|
||||||
r.createCell(ci++).setCellValue(cst.getDesignTitle() == null ? "" : cst.getDesignTitle());
|
r.createCell(ci++).setCellValue(cst.getDesignTitle() == null ? "" : cst.getDesignTitle());
|
||||||
r.createCell(ci++).setCellValue(cst.getDesignDescription() == null ? "" : cst.getDesignDescription());
|
r.createCell(ci++).setCellValue(cst.getDesignDescription() == null ? "" : cst.getDesignDescription());
|
||||||
// r.createCell(ci++).setCellValue(cst.getPdfPath() == null ? "" : cst.getPdfPath());
|
r.createCell(ci++).setCellValue(cst.getPdfPath() == null ? "" : cst.getPdfPath());
|
||||||
// r.createCell(ci++).setCellValue(cst.getVideoPath() == null ? "" : cst.getVideoPath());
|
r.createCell(ci++).setCellValue(cst.getVideoPath() == null ? "" : cst.getVideoPath());
|
||||||
// 视频时长(秒)
|
|
||||||
r.createCell(ci++).setCellValue(cst.getVideoDuration() == null ? "" : cst.getVideoDuration().toString());
|
r.createCell(ci++).setCellValue(cst.getVideoDuration() == null ? "" : cst.getVideoDuration().toString());
|
||||||
// 视频大小、PDF 大小:以 MB 导出,保留两位小数
|
|
||||||
if (cst.getVideoSize() == null) {
|
if (cst.getVideoSize() == null) {
|
||||||
r.createCell(ci++).setCellValue("");
|
r.createCell(ci++).setCellValue("");
|
||||||
} else {
|
} else {
|
||||||
@@ -282,6 +281,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
double pMb = cst.getPdfSize() / 1024.0 / 1024.0;
|
double pMb = cst.getPdfSize() / 1024.0 / 1024.0;
|
||||||
r.createCell(ci++).setCellValue(String.format("%.2f", pMb));
|
r.createCell(ci++).setCellValue(String.format("%.2f", pMb));
|
||||||
}
|
}
|
||||||
|
r.createCell(ci++).setCellValue(cst.getPortfolioUrl() == null ? "" : cst.getPortfolioUrl());
|
||||||
r.createCell(ci++).setCellValue(cst.getCreatedAt() == null ? "" : cst.getCreatedAt().toString());
|
r.createCell(ci++).setCellValue(cst.getCreatedAt() == null ? "" : cst.getCreatedAt().toString());
|
||||||
r.createCell(ci++).setCellValue(cst.getUpdatedAt() == null ? "" : cst.getUpdatedAt().toString());
|
r.createCell(ci++).setCellValue(cst.getUpdatedAt() == null ? "" : cst.getUpdatedAt().toString());
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
String[] headers = new String[] {
|
String[] headers = new String[] {
|
||||||
"contestantNumber", "email", "firstName", "lastName", "gender", "occupation",
|
"contestantNumber", "email", "firstName", "lastName", "gender", "occupation",
|
||||||
"age", "countryRegionCity", "phoneNumber", "designTitle", "designDescription",
|
"age", "countryRegionCity", "phoneNumber", "designTitle", "designDescription",
|
||||||
"pdfPath", "videoPath", "videoDuration", "videoSizeMB", "pdfSizeMB", "createdAt", "updatedAt"
|
"pdfPath", "videoPath", "videoDuration", "videoSizeMB", "pdfSizeMB", "portfolioUrl", "createdAt", "updatedAt"
|
||||||
};
|
};
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (int i = 0; i < headers.length; i++) {
|
||||||
Cell c = header.createCell(i);
|
Cell c = header.createCell(i);
|
||||||
@@ -332,11 +332,9 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
r.createCell(ci++).setCellValue(cst.getPhoneNumber() == null ? "" : cst.getPhoneNumber());
|
r.createCell(ci++).setCellValue(cst.getPhoneNumber() == null ? "" : cst.getPhoneNumber());
|
||||||
r.createCell(ci++).setCellValue(cst.getDesignTitle() == null ? "" : cst.getDesignTitle());
|
r.createCell(ci++).setCellValue(cst.getDesignTitle() == null ? "" : cst.getDesignTitle());
|
||||||
r.createCell(ci++).setCellValue(cst.getDesignDescription() == null ? "" : cst.getDesignDescription());
|
r.createCell(ci++).setCellValue(cst.getDesignDescription() == null ? "" : cst.getDesignDescription());
|
||||||
// r.createCell(ci++).setCellValue(cst.getPdfPath() == null ? "" : cst.getPdfPath());
|
r.createCell(ci++).setCellValue(cst.getPdfPath() == null ? "" : cst.getPdfPath());
|
||||||
// r.createCell(ci++).setCellValue(cst.getVideoPath() == null ? "" : cst.getVideoPath());
|
r.createCell(ci++).setCellValue(cst.getVideoPath() == null ? "" : cst.getVideoPath());
|
||||||
// 视频时长(秒)
|
|
||||||
r.createCell(ci++).setCellValue(cst.getVideoDuration() == null ? "" : cst.getVideoDuration().toString());
|
r.createCell(ci++).setCellValue(cst.getVideoDuration() == null ? "" : cst.getVideoDuration().toString());
|
||||||
// 视频大小、PDF 大小:以 MB 导出,保留两位小数
|
|
||||||
if (cst.getVideoSize() == null) {
|
if (cst.getVideoSize() == null) {
|
||||||
r.createCell(ci++).setCellValue("");
|
r.createCell(ci++).setCellValue("");
|
||||||
} else {
|
} else {
|
||||||
@@ -349,6 +347,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
double pMb = cst.getPdfSize() / 1024.0 / 1024.0;
|
double pMb = cst.getPdfSize() / 1024.0 / 1024.0;
|
||||||
r.createCell(ci++).setCellValue(String.format("%.2f", pMb));
|
r.createCell(ci++).setCellValue(String.format("%.2f", pMb));
|
||||||
}
|
}
|
||||||
|
r.createCell(ci++).setCellValue(cst.getPortfolioUrl() == null ? "" : cst.getPortfolioUrl());
|
||||||
r.createCell(ci++).setCellValue(cst.getCreatedAt() == null ? "" : cst.getCreatedAt().toString());
|
r.createCell(ci++).setCellValue(cst.getCreatedAt() == null ? "" : cst.getCreatedAt().toString());
|
||||||
r.createCell(ci++).setCellValue(cst.getUpdatedAt() == null ? "" : cst.getUpdatedAt().toString());
|
r.createCell(ci++).setCellValue(cst.getUpdatedAt() == null ? "" : cst.getUpdatedAt().toString());
|
||||||
}
|
}
|
||||||
@@ -387,6 +386,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
dto.setVideoDuration(existing.getVideoDuration());
|
dto.setVideoDuration(existing.getVideoDuration());
|
||||||
dto.setPdfSize(existing.getPdfSize());
|
dto.setPdfSize(existing.getPdfSize());
|
||||||
dto.setVideoSize(existing.getVideoSize());
|
dto.setVideoSize(existing.getVideoSize());
|
||||||
|
dto.setPortfolioUrl(existing.getPortfolioUrl());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int exportContestantFiles(Integer minContestantNumber, Integer maxContestantNumber) throws Exception {
|
public byte[] exportContestantFilesAsZip(Integer minContestantNumber, Integer maxContestantNumber) throws Exception {
|
||||||
if (minContestantNumber == null || maxContestantNumber == null) {
|
if (minContestantNumber == null || maxContestantNumber == null) {
|
||||||
throw new BusinessException("minContestantNumber and maxContestantNumber are required.");
|
throw new BusinessException("minContestantNumber and maxContestantNumber are required.");
|
||||||
}
|
}
|
||||||
@@ -488,7 +488,7 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
throw new BusinessException("minContestantNumber cannot be greater than maxContestantNumber.");
|
throw new BusinessException("minContestantNumber cannot be greater than maxContestantNumber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 根据contestantNumber范围查询参赛者
|
// 1. 根据 contestantNumber 范围查询参赛者
|
||||||
QueryWrapper<Contestant> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Contestant> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.lambda()
|
queryWrapper.lambda()
|
||||||
.ge(Contestant::getContestantNumber, minContestantNumber)
|
.ge(Contestant::getContestantNumber, minContestantNumber)
|
||||||
@@ -498,90 +498,126 @@ public class GlobalAwardServiceImpl implements GlobalAwardService {
|
|||||||
|
|
||||||
if (contestants.isEmpty()) {
|
if (contestants.isEmpty()) {
|
||||||
log.info("No contestants found in range [{}, {}]", minContestantNumber, maxContestantNumber);
|
log.info("No contestants found in range [{}, {}]", minContestantNumber, maxContestantNumber);
|
||||||
return 0;
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 创建基础目录
|
// 2. 在内存中构建 ZIP
|
||||||
String baseDir = uploadDir + "/contestants";
|
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
Path basePath = Paths.get(baseDir).toAbsolutePath();
|
java.util.zip.ZipOutputStream zos = new java.util.zip.ZipOutputStream(baos)) {
|
||||||
Files.createDirectories(basePath);
|
|
||||||
log.info("Base directory created: {}", basePath);
|
|
||||||
|
|
||||||
int exportedCount = 0;
|
for (Contestant contestant : contestants) {
|
||||||
|
Integer contestantNumber = contestant.getContestantNumber();
|
||||||
// 3. 遍历每个参赛者,下载文件
|
if (contestantNumber == null) {
|
||||||
for (Contestant contestant : contestants) {
|
log.warn("Contestant {} has no contestantNumber, skipping", contestant.getId());
|
||||||
Integer contestantNumber = contestant.getContestantNumber();
|
continue;
|
||||||
if (contestantNumber == null) {
|
|
||||||
log.warn("Contestant {} has no contestantNumber, skipping", contestant.getId());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建参赛者文件夹
|
|
||||||
String contestantDir = baseDir + "/" + contestantNumber;
|
|
||||||
Path contestantPath = Paths.get(contestantDir);
|
|
||||||
Files.createDirectories(contestantPath);
|
|
||||||
|
|
||||||
// 下载PDF文件
|
|
||||||
String pdfPath = contestant.getPdfPath();
|
|
||||||
if (StringUtils.isNotBlank(pdfPath)) {
|
|
||||||
try {
|
|
||||||
String fileName = pdfPath.contains("/") ?
|
|
||||||
pdfPath.substring(pdfPath.lastIndexOf("/") + 1) : "design.pdf";
|
|
||||||
downloadFileFromMinio(pdfPath, contestantPath.toString(), "design.pdf");
|
|
||||||
log.info("Downloaded PDF for contestant {}", fileName);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Failed to download PDF for contestant {}: {}", contestantNumber, e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 下载视频文件
|
String dirPrefix = contestantNumber + "/";
|
||||||
String videoPath = contestant.getVideoPath();
|
|
||||||
if (StringUtils.isNotBlank(videoPath)) {
|
// 添加 PDF 文件
|
||||||
try {
|
String pdfPath = contestant.getPdfPath();
|
||||||
// 根据路径判断视频格式
|
if (StringUtils.isNotBlank(pdfPath)) {
|
||||||
|
addMinioFileToZip(zos, pdfPath, dirPrefix + "design.pdf");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加视频文件
|
||||||
|
String videoPath = contestant.getVideoPath();
|
||||||
|
if (StringUtils.isNotBlank(videoPath)) {
|
||||||
String fileName = videoPath.contains("/") ?
|
String fileName = videoPath.contains("/") ?
|
||||||
videoPath.substring(videoPath.lastIndexOf("/") + 1) : "video.mp4";
|
videoPath.substring(videoPath.lastIndexOf("/") + 1) : "video.mp4";
|
||||||
downloadFileFromMinio(videoPath, contestantPath.toString(), fileName);
|
addMinioFileToZip(zos, videoPath, dirPrefix + fileName);
|
||||||
log.info("Downloaded video for contestant {}", contestantNumber);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Failed to download video for contestant {}: {}", contestantNumber, e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加参赛者信息 txt 文件
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("=== Contestant Information ===\n\n");
|
||||||
|
sb.append("ID: ").append(nullSafe(contestant.getId())).append("\n");
|
||||||
|
sb.append("Email: ").append(nullSafe(contestant.getEmail())).append("\n");
|
||||||
|
sb.append("Contestant Number: ").append(contestantNumber).append("\n");
|
||||||
|
sb.append("First Name: ").append(nullSafe(contestant.getFirstName())).append("\n");
|
||||||
|
sb.append("Last Name: ").append(nullSafe(contestant.getLastName())).append("\n");
|
||||||
|
sb.append("Gender: ").append(nullSafe(contestant.getGender())).append("\n");
|
||||||
|
sb.append("Occupation: ").append(nullSafe(contestant.getOccupation())).append("\n");
|
||||||
|
sb.append("Age: ").append(contestant.getAge() != null ? contestant.getAge() : "N/A").append("\n");
|
||||||
|
sb.append("Country/Region/City: ").append(nullSafe(contestant.getCountryRegionCity())).append("\n");
|
||||||
|
sb.append("Phone Number: ").append(nullSafe(contestant.getPhoneNumber())).append("\n");
|
||||||
|
sb.append("Design Title: ").append(nullSafe(contestant.getDesignTitle())).append("\n");
|
||||||
|
sb.append("Design Description: ").append(nullSafe(contestant.getDesignDescription())).append("\n");
|
||||||
|
sb.append("PDF Path: ").append(nullSafe(pdfPath)).append("\n");
|
||||||
|
sb.append("PDF Size (bytes): ").append(contestant.getPdfSize() != null ? contestant.getPdfSize() : "N/A").append("\n");
|
||||||
|
sb.append("Video Path: ").append(nullSafe(videoPath)).append("\n");
|
||||||
|
sb.append("Video Duration (seconds): ").append(contestant.getVideoDuration() != null ? contestant.getVideoDuration() : "N/A").append("\n");
|
||||||
|
sb.append("Video Size (bytes): ").append(contestant.getVideoSize() != null ? contestant.getVideoSize() : "N/A").append("\n");
|
||||||
|
sb.append("Portfolio URL: ").append(nullSafe(contestant.getPortfolioUrl())).append("\n");
|
||||||
|
sb.append("Created At: ").append(contestant.getCreatedAt() != null ? contestant.getCreatedAt() : "N/A").append("\n");
|
||||||
|
sb.append("Updated At: ").append(contestant.getUpdatedAt() != null ? contestant.getUpdatedAt() : "N/A").append("\n");
|
||||||
|
|
||||||
|
ZipEntry infoEntry = new ZipEntry(dirPrefix + "contestant_info.txt");
|
||||||
|
zos.putNextEntry(infoEntry);
|
||||||
|
zos.write(sb.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8));
|
||||||
|
zos.closeEntry();
|
||||||
|
log.info("Added contestant {} info to zip", contestantNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
exportedCount++;
|
zos.finish();
|
||||||
|
log.info("ZIP built for {} contestants, size: {} bytes", contestants.size(), baos.size());
|
||||||
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Exported {} contestants' files to {}", exportedCount, basePath);
|
|
||||||
return exportedCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从MinIO下载文件到本地
|
* 将 MinIO 文件流式写入 ZIP,不落盘
|
||||||
* @param minioPath MinIO路径 (格式: bucketName/objectPath)
|
* @param zos ZIP 输出流
|
||||||
* @param localDir 本地目录
|
* @param minioPath MinIO 路径(格式: bucketName/objectPath)
|
||||||
* @param fileName 本地文件名
|
* @param entryName ZIP 条目名称
|
||||||
*/
|
*/
|
||||||
private void downloadFileFromMinio(String minioPath, String localDir, String fileName) {
|
private void addMinioFileToZip(java.util.zip.ZipOutputStream zos, String minioPath, String entryName) {
|
||||||
if (StringUtils.isBlank(minioPath)) {
|
if (StringUtils.isBlank(minioPath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从路径中提取bucket名称和对象名称
|
|
||||||
int index = minioPath.indexOf("/");
|
int index = minioPath.indexOf("/");
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
log.warn("Invalid MinIO path: {}", minioPath);
|
log.warn("Invalid MinIO path: {}", minioPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String bucketName = minioPath.substring(0, index);
|
String bucketName = minioPath.substring(0, index);
|
||||||
String objectName = minioPath.substring(index + 1);
|
String objectName = minioPath.substring(index + 1);
|
||||||
|
|
||||||
// 构建本地文件完整路径
|
try (InputStream in = minioUtil.download(bucketName, objectName)) {
|
||||||
Path localFilePath = Paths.get(localDir, fileName);
|
ZipEntry entry = new ZipEntry(entryName);
|
||||||
|
zos.putNextEntry(entry);
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = in.read(buffer)) != -1) {
|
||||||
|
zos.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
zos.closeEntry();
|
||||||
|
log.info("Added {} to zip ({} bytes)", entryName, entry.getSize());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to add {} to zip: {}", entryName, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 下载文件
|
@Override
|
||||||
minioUtil.downloadMinioObjectToLocal(bucketName, objectName, localFilePath.toString());
|
public ContestantCountVO getContestantCount() {
|
||||||
|
long count = contestantMapper.selectCount(null);
|
||||||
|
Integer maxContestantNumber = null;
|
||||||
|
QueryWrapper<Contestant> qMax = new QueryWrapper<>();
|
||||||
|
qMax.isNotNull("contestant_number");
|
||||||
|
qMax.orderByDesc("contestant_number");
|
||||||
|
qMax.last("LIMIT 1");
|
||||||
|
Contestant last = contestantMapper.selectOne(qMax);
|
||||||
|
if (last != null) {
|
||||||
|
maxContestantNumber = last.getContestantNumber();
|
||||||
|
}
|
||||||
|
return ContestantCountVO.builder()
|
||||||
|
.count(count)
|
||||||
|
.maxContestantNumber(maxContestantNumber)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String nullSafe(String value) {
|
||||||
|
return value != null ? value : "N/A";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,11 +451,12 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
String periodEnd = DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_yyyy_MM_dd_HH_mm_ss);
|
String periodEnd = DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_yyyy_MM_dd_HH_mm_ss);
|
||||||
|
|
||||||
qwPI.lambda().eq(PaymentInfo::getOrderNo, subscriptionInfo.getOrderNo())
|
qwPI.lambda().eq(PaymentInfo::getOrderNo, subscriptionInfo.getOrderNo())
|
||||||
|
.eq(PaymentInfo::getTradeState, "paid")
|
||||||
.between(PaymentInfo::getCreateTime, periodStart, periodEnd)
|
.between(PaymentInfo::getCreateTime, periodStart, periodEnd)
|
||||||
.orderByDesc(PaymentInfo::getId);
|
.orderByDesc(PaymentInfo::getId);
|
||||||
List<PaymentInfo> paymentInfos = paymentInfoMapper.selectList(qwPI);
|
List<PaymentInfo> paymentInfos = paymentInfoMapper.selectList(qwPI);
|
||||||
if (paymentInfos.isEmpty()) {
|
if (paymentInfos.isEmpty()) {
|
||||||
log.info("不发送邮件,原因:【根据order_no:{},查询到的paymentInfos为空】", orderNo);
|
log.info("不发送邮件,原因:【根据order_no:{},查询到的成功的paymentInfos为空】", orderNo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PaymentInfo paymentInfo = paymentInfos.get(0);
|
PaymentInfo paymentInfo = paymentInfos.get(0);
|
||||||
|
|||||||
@@ -905,15 +905,15 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 将构建好的结果对象添加到返回列表
|
// 将构建好的结果对象添加到返回列表
|
||||||
results.add(magicToolResultVO);
|
// results.add(magicToolResultVO);
|
||||||
} else if (Objects.isNull(magicToolResultVO)) {
|
} else if (Objects.isNull(magicToolResultVO)) {
|
||||||
// 如果Redis中没有结果对象,创建执行中状态的结果对象
|
// 如果Redis中没有结果对象,创建执行中状态的结果对象
|
||||||
magicToolResultVO = new MagicToolResultVO(taskId, "Executing");
|
magicToolResultVO = new MagicToolResultVO(taskId, "Executing");
|
||||||
results.add(magicToolResultVO);
|
// results.add(magicToolResultVO);
|
||||||
} else {
|
}/* else {
|
||||||
// 如果Redis中有结果对象但URL为空,直接添加到返回列表
|
// 如果Redis中有结果对象但URL为空,直接添加到返回列表
|
||||||
results.add(magicToolResultVO);
|
results.add(magicToolResultVO);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 收集任务状态用于统计
|
// 收集任务状态用于统计
|
||||||
if (!StringUtil.isNullOrEmpty(magicToolResultVO.getStatus())) collect.add(magicToolResultVO.getStatus());
|
if (!StringUtil.isNullOrEmpty(magicToolResultVO.getStatus())) collect.add(magicToolResultVO.getStatus());
|
||||||
@@ -1461,12 +1461,16 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
if (StringUtil.isNullOrEmpty(fluxResult)) {
|
if (StringUtil.isNullOrEmpty(fluxResult)) {
|
||||||
toProductImageResult.setStatus("Fail");
|
toProductImageResult.setStatus("Fail");
|
||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
sortRank(toProductImageResult);
|
if (toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
||||||
|
sortRank(toProductImageResult);
|
||||||
|
}
|
||||||
results.add(new MagicToolResultVO(taskId, "Fail"));
|
results.add(new MagicToolResultVO(taskId, "Fail"));
|
||||||
} else if (fluxResult.equals("Fail") || fluxResult.equals("Pending")) {
|
} else if (fluxResult.equals("Fail") || fluxResult.equals("Pending")) {
|
||||||
toProductImageResult.setStatus(fluxResult);
|
toProductImageResult.setStatus(fluxResult);
|
||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
sortRank(toProductImageResult);
|
if (fluxResult.equals("Fail") && toProductImageResult.getIsLike() != null && toProductImageResult.getIsLike() == 1) {
|
||||||
|
sortRank(toProductImageResult);
|
||||||
|
}
|
||||||
results.add(new MagicToolResultVO(taskId, fluxResult));
|
results.add(new MagicToolResultVO(taskId, fluxResult));
|
||||||
} else {
|
} else {
|
||||||
results.add(processFluxResult(fluxResult, toProductImageResult, taskId, toProductImageRecord.getPrompt()));
|
results.add(processFluxResult(fluxResult, toProductImageResult, taskId, toProductImageRecord.getPrompt()));
|
||||||
@@ -2203,10 +2207,14 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
childCollectionQw.lambda().orderByAsc(CollectionSort::getSort);
|
childCollectionQw.lambda().orderByAsc(CollectionSort::getSort);
|
||||||
List<CollectionSort> childSortList = collectionSortMapper.selectList(childCollectionQw);
|
List<CollectionSort> childSortList = collectionSortMapper.selectList(childCollectionQw);
|
||||||
List<AllCollectionVO> childList = new ArrayList<>();
|
List<AllCollectionVO> childList = new ArrayList<>();
|
||||||
|
// 收集需要删除的失败记录ID,用于后续统一清理并重新排序
|
||||||
|
List<Long> failedSortIds = new ArrayList<>();
|
||||||
for (CollectionSort userLikeSort : childSortList) {
|
for (CollectionSort userLikeSort : childSortList) {
|
||||||
if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
|
if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
|
||||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||||
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
||||||
|
failedSortIds.add(userLikeSort.getId());
|
||||||
|
log.info("【获取内容】TO_PRODUCT_IMAGE结果失败,relationId={},即将从collection_sort中删除", userLikeSort.getRelationId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||||
@@ -2238,6 +2246,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
||||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||||
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
||||||
|
failedSortIds.add(userLikeSort.getId());
|
||||||
|
log.info("【获取内容】RELIGHT结果失败,relationId={},即将从collection_sort中删除", userLikeSort.getRelationId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||||
@@ -2269,6 +2279,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
||||||
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
|
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
|
||||||
if (isGenerateTaskFailed(item.getTaskStatus(), item.getCreateTime())) {
|
if (isGenerateTaskFailed(item.getTaskStatus(), item.getCreateTime())) {
|
||||||
|
failedSortIds.add(userLikeSort.getId());
|
||||||
|
log.info("【获取内容】POSE_TRANSFORM结果失败,relationId={},即将从collection_sort中删除", userLikeSort.getRelationId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
||||||
@@ -2293,6 +2305,114 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
childList.add(poseTransformationVO);
|
childList.add(poseTransformationVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 统一处理失败的记录:从collection_sort表中删除失败的记录,并重新排序
|
||||||
|
if (CollectionUtil.isNotEmpty(failedSortIds)) {
|
||||||
|
Long parentId = collectionSort.getId();
|
||||||
|
Long projectId = projectDTO.getId();
|
||||||
|
log.info("【获取内容】检测到{}条失败记录需要清理,parentId={}, projectId={}", failedSortIds.size(), parentId, projectId);
|
||||||
|
for (Long failedSortId : failedSortIds) {
|
||||||
|
CollectionSort failedRecord = collectionSortMapper.selectById(failedSortId);
|
||||||
|
if (failedRecord != null) {
|
||||||
|
String relationType = failedRecord.getRelationType();
|
||||||
|
Long relationId = failedRecord.getRelationId();
|
||||||
|
collectionSortService.deleteCollectionSort(relationId, relationType, projectId, parentId);
|
||||||
|
log.info("【获取内容】已删除失败记录,relationId={}, relationType={}", relationId, relationType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 重新查询子列表,获取更新后的排序
|
||||||
|
childSortList = collectionSortMapper.selectList(childCollectionQw);
|
||||||
|
// 重新构建childList,使用更新后的sort值
|
||||||
|
childList = new ArrayList<>();
|
||||||
|
for (CollectionSort userLikeSort : childSortList) {
|
||||||
|
if (userLikeSort.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue())) {
|
||||||
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||||
|
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||||
|
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
|
||||||
|
|
||||||
|
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
||||||
|
if (Objects.isNull(toProductImageRecord)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toProductImageResultVO.setPrompt(toProductImageRecord.getPrompt());
|
||||||
|
|
||||||
|
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||||
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||||
|
} else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||||
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||||
|
} else {
|
||||||
|
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||||
|
}
|
||||||
|
toProductImageResultVO.setCollectionType(CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||||
|
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||||
|
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
|
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
||||||
|
toProductImageResultVO.setParentId(userLikeSort.getParentId());
|
||||||
|
childList.add(toProductImageResultVO);
|
||||||
|
} else if (userLikeSort.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
||||||
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(userLikeSort.getRelationId());
|
||||||
|
if (isGenerateTaskFailed(toProductImageResult.getStatus(), toProductImageResult.getCreateTime())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toProductImageResult.setUrl(getMinioUrl(toProductImageResult.getUrl()));
|
||||||
|
ToProductImageResultVO toProductImageResultVO = CopyUtil.copyObject(toProductImageResult, ToProductImageResultVO.class);
|
||||||
|
|
||||||
|
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
||||||
|
if (Objects.isNull(toProductImageRecord)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toProductImageResultVO.setPrompt(toProductImageRecord.getPrompt());
|
||||||
|
|
||||||
|
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||||
|
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductElement.getUrl()));
|
||||||
|
} else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||||
|
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(tDesignPythonOutfit.getDesignUrl()));
|
||||||
|
} else {
|
||||||
|
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||||
|
toProductImageResultVO.setSourceUrl(getMinioUrl(toProductImageResult1.getUrl()));
|
||||||
|
}
|
||||||
|
toProductImageResultVO.setCollectionType(CollectionType.RELIGHT.getValue());
|
||||||
|
toProductImageResultVO.setSort(userLikeSort.getSort());
|
||||||
|
toProductImageResultVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
|
toProductImageResultVO.setRelationType(userLikeSort.getRelationType());
|
||||||
|
toProductImageResultVO.setParentId(userLikeSort.getParentId());
|
||||||
|
childList.add(toProductImageResultVO);
|
||||||
|
} else if (userLikeSort.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
||||||
|
PoseTransformation item = poseTransformationMapper.selectById(userLikeSort.getRelationId());
|
||||||
|
if (isGenerateTaskFailed(item.getTaskStatus(), item.getCreateTime())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PoseTransformationVO poseTransformationVO = new PoseTransformationVO();
|
||||||
|
poseTransformationVO.setId(item.getId());
|
||||||
|
poseTransformationVO.setTaskId(item.getUniqueId());
|
||||||
|
poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage()));
|
||||||
|
poseTransformationVO.setLastFrameProductImage(getMinioUrl(item.getLastFrameProductImage()));
|
||||||
|
poseTransformationVO.setPrompt(item.getPrompt());
|
||||||
|
poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl()));
|
||||||
|
poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl()));
|
||||||
|
poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl()));
|
||||||
|
poseTransformationVO.setIsLiked(item.getIsLiked());
|
||||||
|
poseTransformationVO.setCollectionType(CollectionType.POSE_TRANSFORM.getValue());
|
||||||
|
poseTransformationVO.setSort(userLikeSort.getSort());
|
||||||
|
poseTransformationVO.setUserLikeSortId(userLikeSort.getId());
|
||||||
|
poseTransformationVO.setRelationType(userLikeSort.getRelationType());
|
||||||
|
poseTransformationVO.setResultType(CollectionType.POSE_TRANSFORM.getValue());
|
||||||
|
poseTransformationVO.setParentId(userLikeSort.getParentId());
|
||||||
|
poseTransformationVO.setModelName(item.getModelName());
|
||||||
|
poseTransformationVO.setPoseId(item.getPoseId());
|
||||||
|
poseTransformationVO.setStatus(item.getTaskStatus());
|
||||||
|
childList.add(poseTransformationVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("【获取内容】失败记录清理完成,重新排序后childList.size={}", childList.size());
|
||||||
|
}
|
||||||
o.setChildList(childList);
|
o.setChildList(childList);
|
||||||
|
|
||||||
list.add(o);
|
list.add(o);
|
||||||
|
|||||||
@@ -11,18 +11,18 @@
|
|||||||
#paypal.webhook_id=51V87014T6406322F
|
#paypal.webhook_id=51V87014T6406322F
|
||||||
|
|
||||||
# aida-sandbox-kim
|
# aida-sandbox-kim
|
||||||
#paypal.client-id=AbDDH8jnTrKqjnWLFgEu6LogYzVz2ZLuirE4W54t1M4lrofrP5OzXfhbxqktLLFB-rAO9KeYQVYFJ_tO
|
paypal.client-id=AbDDH8jnTrKqjnWLFgEu6LogYzVz2ZLuirE4W54t1M4lrofrP5OzXfhbxqktLLFB-rAO9KeYQVYFJ_tO
|
||||||
#paypal.client-secret=EOOoiIAe_dyR2YhY7qCIqWipZvYXCDrmBlFYchphuvkPFms1spsBGTlStlrx580y4hN-EukWwF9m_LAs
|
paypal.client-secret=EOOoiIAe_dyR2YhY7qCIqWipZvYXCDrmBlFYchphuvkPFms1spsBGTlStlrx580y4hN-EukWwF9m_LAs
|
||||||
#paypal.receiver.email=sb-4xe8i29784722@business.example.com
|
paypal.receiver.email=sb-4xe8i29784722@business.example.com
|
||||||
#paypal.mode=sandbox
|
paypal.mode=sandbox
|
||||||
#paypal.webhook_id=1WH327112B602422N
|
paypal.webhook_id=1WH327112B602422N
|
||||||
|
|
||||||
# aida-live-kim
|
# aida-live-kim
|
||||||
paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
#paypal.client-id=ASWSIZ3MXJU5w5VOeOHeigWcSw6iinl30ZCipruziKpHclxP0ryf8-7VKG1Ba2VwZwa2DMvGEzTfCTgz
|
||||||
paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
#paypal.client-secret=EHQg_K5PSqmp4FJlzEcOEH_kFkmq4aBzaI7jridw53L6cOQRULBAnfv2KakRfrsqaU1PDSkO4Co9Vyxc
|
||||||
paypal.receiver.email=kimwong@code-create.com.hk
|
#paypal.receiver.email=kimwong@code-create.com.hk
|
||||||
paypal.mode=live
|
#paypal.mode=live
|
||||||
paypal.webhook_id=1D107312EX592781K
|
#paypal.webhook_id=1D107312EX592781K
|
||||||
|
|
||||||
##### Stripe
|
##### Stripe
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user