Compare commits
3 Commits
b277479e73
...
dev/3.1_re
| Author | SHA1 | Date | |
|---|---|---|---|
| 11073690e5 | |||
|
|
921d2d956e | ||
|
|
d700f94f9d |
@@ -52,6 +52,18 @@ public class MinioUtil {
|
||||
return minioClient;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* Redis缓存key前缀,用于Minio签名URL缓存
|
||||
*/
|
||||
private static final String REDIS_MINIO_URL_PREFIX = "minio:url:";
|
||||
|
||||
/**
|
||||
* 签名URL缓存过期时间(秒),默认1天
|
||||
*/
|
||||
private static final long URL_CACHE_EXPIRE_SECONDS = 24 * 60 * 60;
|
||||
/**
|
||||
* description: 判断bucket是否存在,不存在则创建
|
||||
*
|
||||
@@ -392,6 +404,11 @@ public class MinioUtil {
|
||||
* @return 文件的临时URL,如果出现异常则返回null
|
||||
*/
|
||||
public String getPreSignedUrl(String bucketName, String fileName, int expiry) {
|
||||
String cacheKey = REDIS_MINIO_URL_PREFIX + bucketName + "/" + fileName;
|
||||
Object cachedUrl = redisUtil.getFromString(cacheKey);
|
||||
if (cachedUrl != null) {
|
||||
return cachedUrl.toString();
|
||||
}
|
||||
try {
|
||||
|
||||
String lowerName = fileName.toLowerCase();
|
||||
@@ -419,8 +436,9 @@ public class MinioUtil {
|
||||
|
||||
builder.extraQueryParams(queryParams);
|
||||
}
|
||||
|
||||
return minioClient.getPresignedObjectUrl(builder.build());
|
||||
String presignedObjectUrl = minioClient.getPresignedObjectUrl(builder.build());
|
||||
redisUtil.addToString(cacheKey, presignedObjectUrl, URL_CACHE_EXPIRE_SECONDS);
|
||||
return presignedObjectUrl;
|
||||
} catch (MinioException | InvalidKeyException
|
||||
| IOException | NoSuchAlgorithmException | IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -4225,8 +4225,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
// 发送POST请求到Flux API
|
||||
long start = System.currentTimeMillis();
|
||||
String resp = sendRequestUtil.sendFluxPost(fluxRequestUrl, requestBody.toString());
|
||||
JSONObject respObj = JSONUtil.parseObj(resp);
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("flux 耗时:{}ms", end - start);
|
||||
log.info("flux 发起生成请求返回结果: {}", respObj);
|
||||
|
||||
// 从响应中提取任务ID
|
||||
|
||||
@@ -169,7 +169,7 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理结束时间(只能延长)
|
||||
* 处理结束时间,不允许订阅结束时间早于当前时间和订阅开始时间
|
||||
*/
|
||||
private void handlePeriodEnd(UpdateSubscriptionPlanDTO dto, SubscriptionPlan plan) {
|
||||
Long newEnd = dto.getCurrentPeriodEnd();
|
||||
@@ -177,9 +177,20 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
|
||||
return;
|
||||
}
|
||||
|
||||
if (newEnd < plan.getCurrentPeriodEnd()) {
|
||||
long currentTimeSec = System.currentTimeMillis() / 1000;
|
||||
long startTime = plan.getCurrentPeriodStart();
|
||||
|
||||
// 检查是否早于开始时间(不能等于,否则周期长度为0)
|
||||
if (newEnd <= startTime) {
|
||||
throw new BusinessException(
|
||||
"the.subscription.end.date.can.be.extended.only.not.reduced"
|
||||
"end.time.cannot.be.earlier.than.or.equal.to.start.time"
|
||||
);
|
||||
}
|
||||
|
||||
// 检查是否早于当前时间(不能等于,否则立即过期)
|
||||
if (newEnd <= currentTimeSec) {
|
||||
throw new BusinessException(
|
||||
"end.time.cannot.be.earlier.than.or.equal.to.the.current.time"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,8 @@ please.specify.the.organizationId=Please specify the organizationId.
|
||||
switch.failed.sub-account.not.under.your.active.subscription=Switch failed. Sub-account not under your active subscription.
|
||||
Sub-accounts.cannot.be.admins=Sub-accounts in a subscription cannot be designated as admins.
|
||||
only.subscription.plans.with.a.PENDING.status.can.have.their.start.time.modified=Only subscription plans with a PENDING status can have their start time modified.
|
||||
end.time.cannot.be.earlier.than.or.equal.to.start.time=End time cannot be earlier than or equal to start time.
|
||||
end.time.cannot.be.earlier.than.or.equal.to.the.current.time=End time cannot be earlier than or equal to the current time.
|
||||
the.subscription.end.date.can.be.extended.only.not.reduced=The subscription end date can be extended only, not reduced.
|
||||
total.sub-account.quota.cannot.be.lower.than.existing.sub-accounts=Total sub-account quota cannot be lower than existing sub-accounts.
|
||||
the.credit.limit.set.cannot.be.lower.than.the.amount.of.credits.already.used=The credit limit set cannot be lower than the amount of credits already used.
|
||||
|
||||
@@ -207,6 +207,8 @@ please.specify.the.organizationId=请指定organizationId
|
||||
switch.failed.sub-account.not.under.your.active.subscription=切换失败,该子账号不属于您当前管理的订阅计划
|
||||
Sub-accounts.cannot.be.admins=在订阅中的子账号不能被指定为管理员
|
||||
only.subscription.plans.with.a.PENDING.status.can.have.their.start.time.modified=只有PENDING状态的订阅计划可以修改订阅开始时间
|
||||
end.time.cannot.be.earlier.than.or.equal.to.start.time=订阅结束时间不能早于或等于开始时间
|
||||
end.time.cannot.be.earlier.than.or.equal.to.the.current.time=订阅结束时间不能早于或等于当前时间
|
||||
the.subscription.end.date.can.be.extended.only.not.reduced=订阅的到期时间不能缩短,只能延长
|
||||
total.sub-account.quota.cannot.be.lower.than.existing.sub-accounts=设置的子账号总数量不能低于现存已添加的子账号数量
|
||||
the.credit.limit.set.cannot.be.lower.than.the.amount.of.credits.already.used=设置的积分上限不能低于已使用的积分量
|
||||
|
||||
Reference in New Issue
Block a user