Compare commits

..

No commits in common. "9e9d2b274ebf64b415ca9a789f4830412fb5d962" and "9d99754895f619ee8370e95c8c825fdf095b5ce1" have entirely different histories.

7 changed files with 5 additions and 138 deletions

View File

@ -1,70 +0,0 @@
package io.renren.modules.date_snapshot.entity;
import java.util.Arrays;
/**
* 快照任务 枚举
*/
public enum SnapshotType {
/**
* 运营数据每周快照
*/
DATA_WEEKLY(1, "运营数据每周快照"),
/**
* 运营数据每月快照
*/
DATA_MONTH(2, "运营数据每月快照"),
/**
* 能力使用周快照
*/
APPLY_WEEKLY(3, "能力使用周快照"),
/**
* 能力使用月快照
*/
APPLY_MONTH(4, "能力使用月快照"),
/**
* 能力上架周快照
*/
RESOURCE_WEEKLY(5, "能力上架周快照"),
/**
* 能力使用月快照
*/
RESOURCE_MONTH(6, "能力使用月快照"),
/**
* 未知
*/
UN(99, "未知");
private int flag;
private String tip;
SnapshotType(int flag, String tip) {
this.flag = flag;
this.tip = tip;
}
public static SnapshotType getByFlag(int flag) {
SnapshotType[] index = SnapshotType.values();
return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(SnapshotType.UN);
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public String getTip() {
return tip;
}
public void setTip(String tip) {
this.tip = tip;
}
}

View File

@ -24,7 +24,7 @@ public class SysDateSnapshotEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 数据快照类型1每周快照 2每月快照 3:能力使用周快照 4能力使用月快照 5能力上架周快照 6能力使用月快照
* 数据快照类型1每周快照 2每月快照
*/
private Integer type;
/**

View File

@ -12,20 +12,7 @@ import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
*/
public interface SysDateSnapshotService extends CrudService<SysDateSnapshotEntity, SysDateSnapshotDTO> {
/**
* 数据快照行为
* 数据快s照行为
*/
void snapshotAction(Integer type);
/**
* 能力申请快照行为
*
* @param type
*/
void snapshotApplyAction(Integer type);
/**
* 能力上架统计快照行为
* @param type
*/
void snapshotResourceAction(Integer type);
}

View File

@ -40,7 +40,7 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
/**
* 数据快照行为
* 数据快s照行为
*/
@Override
public void snapshotAction(Integer type) {
@ -66,40 +66,4 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
sysDateSnapshotDTO.setSnapshot(snapshot);
save(sysDateSnapshotDTO);
}
/**
* 能力申请快照行为
*
* @param type
*/
@Override
public void snapshotApplyAction(Integer type) {
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectApplyDeptDetailTypeCountList(new HashMap()); // 能力上架统计原始数据
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
addAll(resultList);
}};
sysDateSnapshotDTO.setCreateDate(new Date());
sysDateSnapshotDTO.setType(type);
sysDateSnapshotDTO.setSnapshot(snapshot);
save(sysDateSnapshotDTO);
}
/**
* 能力上架统计快照行为
*
* @param type
*/
@Override
public void snapshotResourceAction(Integer type) {
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectDeptDetailTypeCountList(new HashMap()); // 能力上架统计原始数据
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
addAll(resultList);
}};
sysDateSnapshotDTO.setCreateDate(new Date());
sysDateSnapshotDTO.setType(type);
sysDateSnapshotDTO.setSnapshot(snapshot);
save(sysDateSnapshotDTO);
}
}

View File

@ -1,6 +1,5 @@
package io.renren.modules.date_snapshot.task;
import io.renren.modules.date_snapshot.entity.SnapshotType;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.renren.modules.job.task.ITask;
import org.slf4j.Logger;
@ -24,8 +23,6 @@ public class MonthSnapshot implements ITask {
@Override
public void run(String params) {
logger.info("月快照计划");
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
sysDateSnapshotService.snapshotAction(2);
}
}

View File

@ -1,6 +1,5 @@
package io.renren.modules.date_snapshot.task;
import io.renren.modules.date_snapshot.entity.SnapshotType;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.renren.modules.job.task.ITask;
import org.slf4j.Logger;
@ -27,8 +26,6 @@ public class WeeklySnapshot implements ITask {
@Override
public void run(String params) {
logger.info("周快照计划");
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
sysDateSnapshotService.snapshotAction(1);
}
}

View File

@ -2627,13 +2627,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultList.addAll(temp);
}
resultList = resultList.stream().map(index -> {
if (!index.containsKey("hys")) {
index.put("hys", 0); // 填充会议室为0
}
return index;
}).collect(Collectors.toList());
Integer total = 0;
for (Integer count : countMap.values()) {
total += count;
@ -2641,7 +2634,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
countMap.put("count", total);
HashMap<String, Object> count = new HashMap<>();
count.put("name", "总计");
if (!cloud) { // 不统计云资源时
count.put("yzy", "0");
count.put("ysp", "0");