|
@@ -1,5 +1,6 @@
|
|
|
package com.cyksj.service.mange.impl;
|
|
package com.cyksj.service.mange.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -63,6 +64,8 @@ public class MirrorUserCleatServiceImpl implements MirrorUserCleatService {
|
|
|
|
|
|
|
|
private final ClaudeCodeService claudeCodeService;
|
|
private final ClaudeCodeService claudeCodeService;
|
|
|
|
|
|
|
|
|
|
+ private final OrderDonMapper orderDonMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 删除镜像User
|
|
* 删除镜像User
|
|
|
*/
|
|
*/
|
|
@@ -152,20 +155,31 @@ public class MirrorUserCleatServiceImpl implements MirrorUserCleatService {
|
|
|
ClaudeCodeUserRenewExpiryRecord renewExpiryRecord = claudeCodeUserRenewExpiryRecordMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUserRenewExpiryRecord.class).eq(ClaudeCodeUserRenewExpiryRecord::getOrderId, orderId).eq(ClaudeCodeUserRenewExpiryRecord::getIsValid, Boolean.FALSE).last("limit 1"));
|
|
ClaudeCodeUserRenewExpiryRecord renewExpiryRecord = claudeCodeUserRenewExpiryRecordMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUserRenewExpiryRecord.class).eq(ClaudeCodeUserRenewExpiryRecord::getOrderId, orderId).eq(ClaudeCodeUserRenewExpiryRecord::getIsValid, Boolean.FALSE).last("limit 1"));
|
|
|
Date renewExpiryTime = null;
|
|
Date renewExpiryTime = null;
|
|
|
Integer oriCodePoints = claudeCodeUser.getCodePoints();
|
|
Integer oriCodePoints = claudeCodeUser.getCodePoints();
|
|
|
|
|
+ Long renewOrderId = renewExpiryRecord.getOrderId();
|
|
|
claudeCodeUser.setOriCodePoints(oriCodePoints);
|
|
claudeCodeUser.setOriCodePoints(oriCodePoints);
|
|
|
claudeCodeUser.setRenewSkuId(null);
|
|
claudeCodeUser.setRenewSkuId(null);
|
|
|
claudeCodeUser.setRenewOrderId(null);
|
|
claudeCodeUser.setRenewOrderId(null);
|
|
|
if (renewExpiryRecord != null) {
|
|
if (renewExpiryRecord != null) {
|
|
|
|
|
+ //当前续费
|
|
|
|
|
+ OrderDon presentRenewOrderDon = orderDonMapper.selectById(renewOrderId);
|
|
|
//是否存在其他续费升级
|
|
//是否存在其他续费升级
|
|
|
ClaudeCodeUserRenewExpiryRecord otherRenewRecord = claudeCodeUserRenewExpiryRecordMapper.getOtherRenewSku(orderDon.getId(), relation.getId(), userIdList);
|
|
ClaudeCodeUserRenewExpiryRecord otherRenewRecord = claudeCodeUserRenewExpiryRecordMapper.getOtherRenewSku(orderDon.getId(), relation.getId(), userIdList);
|
|
|
GoodsDonSku otherRenewSku = null;
|
|
GoodsDonSku otherRenewSku = null;
|
|
|
if (otherRenewRecord != null) {
|
|
if (otherRenewRecord != null) {
|
|
|
otherRenewSku = skuMapper.selectById(otherRenewRecord.getRenewSkuId());
|
|
otherRenewSku = skuMapper.selectById(otherRenewRecord.getRenewSkuId());
|
|
|
- renewExpiryTime = otherRenewRecord.getExpiryTime();
|
|
|
|
|
}
|
|
}
|
|
|
//续费升级
|
|
//续费升级
|
|
|
if (otherRenewSku != null) {
|
|
if (otherRenewSku != null) {
|
|
|
finalSku = otherRenewSku;
|
|
finalSku = otherRenewSku;
|
|
|
|
|
+ if (otherRenewSku.getDays() != null && otherRenewSku.getDays() > 0) {
|
|
|
|
|
+ renewExpiryTime = DateUtil.offsetDay(DateTime.now(), otherRenewSku.getDays());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ renewExpiryTime = DateUtil.offsetMonth(DateTime.now(), otherRenewSku.getMonths());
|
|
|
|
|
+ }
|
|
|
|
|
+ //相差多少天
|
|
|
|
|
+ Long betDay = DateUtil.betweenDay(otherRenewRecord.getCreatedTime(), presentRenewOrderDon.getCreatedTime(), false);
|
|
|
|
|
+ renewExpiryTime = DateUtil.offsetDay(renewExpiryTime, -betDay.intValue());
|
|
|
|
|
+
|
|
|
claudeCodeUser.setRenewOrderId(otherRenewRecord.getOrderId());
|
|
claudeCodeUser.setRenewOrderId(otherRenewRecord.getOrderId());
|
|
|
claudeCodeUser.setRenewSkuId(otherRenewRecord.getRenewSkuId());
|
|
claudeCodeUser.setRenewSkuId(otherRenewRecord.getRenewSkuId());
|
|
|
}
|
|
}
|