Compare commits

..

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

5 changed files with 22 additions and 61 deletions

View File

@ -25,7 +25,6 @@ public interface SysDateSnapshotService extends CrudService<SysDateSnapshotEntit
/**
* 能力上架统计快照行为
*
* @param type
*/
void snapshotResourceAction(Integer type);

View File

@ -75,9 +75,7 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
@Override
public void snapshotApplyAction(Integer type) {
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectApplyDeptDetailTypeCountList(new HashMap() {{
put("snapshot", true);
}}); // 能力上架统计原始数据
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);
}};
@ -95,9 +93,7 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
@Override
public void snapshotResourceAction(Integer type) {
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectDeptDetailTypeCountList(new HashMap() {{
put("snapshot", true);
}}); // 能力上架统计原始数据
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);
}};

View File

@ -8,18 +8,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Component("monthSnapshot")
public class MonthSnapshot implements ITask {
private static final Logger logger = LoggerFactory.getLogger(MonthSnapshot.class);
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
@Autowired
private SysDateSnapshotService sysDateSnapshotService;
@ -31,14 +24,8 @@ public class MonthSnapshot implements ITask {
@Override
public void run(String params) {
logger.info("月快照计划");
executor.execute(() -> {
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
});
executor.execute(() -> {
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
});
executor.execute(() -> {
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
});
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
}
}

View File

@ -8,9 +8,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 周快照计划任务
@ -18,9 +15,6 @@ import java.util.concurrent.Executors;
@Component("weeklySnapshot")
public class WeeklySnapshot implements ITask {
private static final Logger logger = LoggerFactory.getLogger(WeeklySnapshot.class);
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM);
@Autowired
private SysDateSnapshotService sysDateSnapshotService;
@ -33,14 +27,8 @@ public class WeeklySnapshot implements ITask {
@Override
public void run(String params) {
logger.info("周快照计划");
executor.execute(() -> {
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
});
executor.execute(() -> {
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
});
executor.execute(() -> {
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
});
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
}
}

View File

@ -2328,17 +2328,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectApplyDeptDetailTypeCountList(Map params) {
if (params.containsKey("snapshot")) {
logger.info("快照获取");
} else {
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
@ -2658,19 +2654,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectDeptDetailTypeCountList(Map params) {
if (params.containsKey("snapshot")) {
logger.info("快照获取");
} else {
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
logger.info("管理员区域");
} else if (user.getDeptId() != null) {
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
}
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())
|| params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())
) {