|
|
|
@@ -1,14 +1,15 @@ |
|
|
|
package com.ruoyi.platform.scheduling; |
|
|
|
|
|
|
|
import com.ruoyi.system.api.constant.Constant; |
|
|
|
import com.ruoyi.platform.domain.DevEnvironment; |
|
|
|
import com.ruoyi.platform.domain.ServiceVersion; |
|
|
|
import com.ruoyi.platform.mapper.DevEnvironmentDao; |
|
|
|
import com.ruoyi.platform.mapper.ResourceOccupyDao; |
|
|
|
import com.ruoyi.platform.mapper.ServiceDao; |
|
|
|
import com.ruoyi.platform.service.JupyterService; |
|
|
|
import com.ruoyi.platform.service.ResourceOccupyService; |
|
|
|
import com.ruoyi.platform.service.ServiceService; |
|
|
|
import com.ruoyi.platform.vo.PodStatusVo; |
|
|
|
import com.ruoyi.system.api.constant.Constant; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@@ -23,6 +24,9 @@ public class ResourceOccupyTask { |
|
|
|
@Resource |
|
|
|
private ResourceOccupyService resourceOccupyService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ResourceOccupyDao resourceOccupyDao; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private DevEnvironmentDao devEnvironmentDao; |
|
|
|
|
|
|
|
@@ -46,7 +50,10 @@ public class ResourceOccupyTask { |
|
|
|
devEnv.setUrl(podStatusVo.getUrl()); |
|
|
|
this.devEnvironmentDao.update(devEnv); |
|
|
|
} |
|
|
|
if (Constant.Running.equals(devEnv.getStatus())) { |
|
|
|
Long userId = resourceOccupyDao.getResourceOccupyByTask(Constant.TaskType_Dev, Long.valueOf(devEnv.getId()), null, null).get(0).getUserId(); |
|
|
|
if (resourceOccupyDao.getUserCredit(userId) <= 0) { |
|
|
|
jupyterService.stopJupyterService(devEnv.getId()); |
|
|
|
} else if (Constant.Running.equals(devEnv.getStatus())) { |
|
|
|
resourceOccupyService.deducing(Constant.TaskType_Dev, Long.valueOf(devEnv.getId()), null, null, null); |
|
|
|
} |
|
|
|
} |
|
|
|
|