|
@@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.assertj.core.util.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -63,6 +64,8 @@ public class BackgroundUserBalanceServiceImpl extends ServiceImpl<BackgroundUser
|
|
|
|
|
|
private final BackgroundUserService userService;
|
|
|
private final BackgroundUserRemainService backgroundUserRemainService;
|
|
|
+ @Value("${free-100-tenantId}")
|
|
|
+ private Integer FREE_100_TENANT_ID;
|
|
|
|
|
|
public BackgroundUserBalanceServiceImpl(StringRedisTemplate redisTemplate, BackgroundUserService userService, BackgroundUserRemainService backgroundUserRemainService) {
|
|
|
this.redisTemplate = redisTemplate;
|
|
@@ -251,14 +254,25 @@ public class BackgroundUserBalanceServiceImpl extends ServiceImpl<BackgroundUser
|
|
|
this.save(userBalance);
|
|
|
|
|
|
newestPlanRemainingFiles = getNewestPlanRemainingFiles(asset.getTenantId());
|
|
|
- userBalance.setId(null);
|
|
|
- userBalance.setDate(userBalance.getDate().plusSeconds(1L));
|
|
|
- userBalance.setDescriptionType(3);
|
|
|
- userBalance.setDescription(UserBalanceConstant.DESCRIPTION_FREE); // TODO 枚举值
|
|
|
- userBalance.setRemainingFiles(newestPlanRemainingFiles + freeAsset);
|
|
|
- userBalance.setBalanceChange(freeAsset);
|
|
|
- userBalance.setChangeType(1);
|
|
|
- this.save(userBalance);
|
|
|
+ if (asset.getTenantId() >= FREE_100_TENANT_ID) {
|
|
|
+ userBalance.setId(null);
|
|
|
+ userBalance.setDate(userBalance.getDate().plusSeconds(1L));
|
|
|
+ userBalance.setDescriptionType(3);
|
|
|
+ userBalance.setDescription(UserBalanceConstant.DESCRIPTION_FREE); // TODO 枚举值
|
|
|
+ userBalance.setRemainingFiles(newestPlanRemainingFiles + 1000);
|
|
|
+ userBalance.setBalanceChange(1000);
|
|
|
+ userBalance.setChangeType(1);
|
|
|
+ this.save(userBalance);
|
|
|
+ }else {
|
|
|
+ userBalance.setId(null);
|
|
|
+ userBalance.setDate(userBalance.getDate().plusSeconds(1L));
|
|
|
+ userBalance.setDescriptionType(3);
|
|
|
+ userBalance.setDescription(UserBalanceConstant.DESCRIPTION_FREE); // TODO 枚举值
|
|
|
+ userBalance.setRemainingFiles(newestPlanRemainingFiles + freeAsset);
|
|
|
+ userBalance.setBalanceChange(freeAsset);
|
|
|
+ userBalance.setChangeType(1);
|
|
|
+ this.save(userBalance);
|
|
|
+ }
|
|
|
}
|
|
|
List<Asset> cleanFreeAssets = freePlanDTO.getCleanFreeAssets();
|
|
|
for (Asset cleanFreeAsset : cleanFreeAssets) {
|