Compare commits
2 Commits
53816fae1f
...
790b9e98e5
Author | SHA1 | Date |
---|---|---|
wangliwen | 790b9e98e5 | |
wangliwen | 1b593637f3 |
|
@ -0,0 +1,70 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ public class SysDateSnapshotEntity extends BaseEntity implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 数据快照类型(1:每周快照 2:每月快照)
|
||||
* 数据快照类型(1:每周快照 2:每月快照 3:能力使用周快照 4:能力使用月快照 5:能力上架周快照 6:能力使用月快照)
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,20 @@ 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);
|
||||
}
|
|
@ -40,7 +40,7 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
|
|||
|
||||
|
||||
/**
|
||||
* 数据快s照行为
|
||||
* 数据快照行为
|
||||
*/
|
||||
@Override
|
||||
public void snapshotAction(Integer type) {
|
||||
|
@ -66,4 +66,40 @@ 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);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
@ -23,6 +24,8 @@ public class MonthSnapshot implements ITask {
|
|||
@Override
|
||||
public void run(String params) {
|
||||
logger.info("月快照计划");
|
||||
sysDateSnapshotService.snapshotAction(2);
|
||||
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
|
||||
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
|
||||
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
@ -26,6 +27,8 @@ public class WeeklySnapshot implements ITask {
|
|||
@Override
|
||||
public void run(String params) {
|
||||
logger.info("周快照计划");
|
||||
sysDateSnapshotService.snapshotAction(1);
|
||||
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
|
||||
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
|
||||
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2627,6 +2627,13 @@ 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;
|
||||
|
@ -2634,6 +2641,7 @@ 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");
|
||||
|
|
Loading…
Reference in New Issue