Compare commits

..

No commits in common. "66d62817670df9d080d3fa60f3c5a176653c7af5" and "c53e1ca8ce6a2129c90e9e0a466c405e0e213143" have entirely different histories.

4 changed files with 2 additions and 91 deletions

View File

@ -11,8 +11,5 @@ import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
* @since 1.0 2023-01-03
*/
public interface SysDateSnapshotService extends CrudService<SysDateSnapshotEntity, SysDateSnapshotDTO> {
/**
* 数据快s照行为
*/
void snapshotAction(Integer type);
}

View File

@ -6,12 +6,9 @@ import io.renren.modules.date_snapshot.dao.SysDateSnapshotDao;
import io.renren.modules.date_snapshot.dto.SysDateSnapshotDTO;
import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.Map;
/**
* 运行数据快照资源数量申请数量
@ -21,10 +18,6 @@ import java.util.*;
*/
@Service
public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotDao, SysDateSnapshotEntity, SysDateSnapshotDTO> implements SysDateSnapshotService {
@Autowired
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ResourceService resourceService;
@Override
public QueryWrapper<SysDateSnapshotEntity> getWrapper(Map<String, Object> params) {
@ -35,24 +28,4 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
}
/**
* 数据快s照行为
*/
@Override
public void snapshotAction(Integer type) {
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
long countApply = tAbilityApplicationService.countApplyAll(); // 资源申请量
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
add(new LinkedHashMap<String, Object>() {{
put("count", countApply);
put("type", "资源申请量");
}});
addAll((Collection<? extends Map<String, Object>>) resourceService.selectTotal()); // 资源汇聚量
}};
sysDateSnapshotDTO.setCreateDate(new Date());
sysDateSnapshotDTO.setType(type);
sysDateSnapshotDTO.setSnapshot(snapshot);
save(sysDateSnapshotDTO);
}
}

View File

@ -1,28 +0,0 @@
package io.renren.modules.date_snapshot.task;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.renren.modules.job.task.ITask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("monthSnapshot")
public class MonthSnapshot implements ITask {
private static final Logger logger = LoggerFactory.getLogger(MonthSnapshot.class);
@Autowired
private SysDateSnapshotService sysDateSnapshotService;
/**
* 执行定时任务接口
*
* @param params 参数多参数使用JSON数据
*/
@Override
public void run(String params) {
logger.info("月快照计划");
sysDateSnapshotService.snapshotAction(2);
}
}

View File

@ -1,31 +0,0 @@
package io.renren.modules.date_snapshot.task;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.renren.modules.job.task.ITask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 周快照计划任务
*/
@Component("weeklySnapshot")
public class WeeklySnapshot implements ITask {
private static final Logger logger = LoggerFactory.getLogger(WeeklySnapshot.class);
@Autowired
private SysDateSnapshotService sysDateSnapshotService;
/**
* 执行定时任务接口
*
* @param params 参数多参数使用JSON数据
*/
@Override
public void run(String params) {
logger.info("周快照计划");
sysDateSnapshotService.snapshotAction(1);
}
}