npe
This commit is contained in:
parent
1b593637f3
commit
4286d50872
|
@ -25,6 +25,7 @@ public interface SysDateSnapshotService extends CrudService<SysDateSnapshotEntit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 能力上架统计快照行为
|
* 能力上架统计快照行为
|
||||||
|
*
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
void snapshotResourceAction(Integer type);
|
void snapshotResourceAction(Integer type);
|
||||||
|
|
|
@ -75,7 +75,9 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
|
||||||
@Override
|
@Override
|
||||||
public void snapshotApplyAction(Integer type) {
|
public void snapshotApplyAction(Integer type) {
|
||||||
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
|
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
|
||||||
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectApplyDeptDetailTypeCountList(new HashMap()); // 能力上架统计原始数据
|
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectApplyDeptDetailTypeCountList(new HashMap() {{
|
||||||
|
put("snapshot", true);
|
||||||
|
}}); // 能力上架统计原始数据
|
||||||
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
|
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
|
||||||
addAll(resultList);
|
addAll(resultList);
|
||||||
}};
|
}};
|
||||||
|
@ -93,7 +95,9 @@ public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotD
|
||||||
@Override
|
@Override
|
||||||
public void snapshotResourceAction(Integer type) {
|
public void snapshotResourceAction(Integer type) {
|
||||||
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
|
SysDateSnapshotDTO sysDateSnapshotDTO = new SysDateSnapshotDTO();
|
||||||
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectDeptDetailTypeCountList(new HashMap()); // 能力上架统计原始数据
|
List<HashMap<String, Object>> resultList = (List<HashMap<String, Object>>) resourceService.selectDeptDetailTypeCountList(new HashMap() {{
|
||||||
|
put("snapshot", true);
|
||||||
|
}}); // 能力上架统计原始数据
|
||||||
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
|
List<Map<String, Object>> snapshot = new ArrayList<Map<String, Object>>() {{
|
||||||
addAll(resultList);
|
addAll(resultList);
|
||||||
}};
|
}};
|
||||||
|
|
|
@ -8,11 +8,18 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
|
||||||
@Component("monthSnapshot")
|
@Component("monthSnapshot")
|
||||||
public class MonthSnapshot implements ITask {
|
public class MonthSnapshot implements ITask {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MonthSnapshot.class);
|
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
|
@Autowired
|
||||||
private SysDateSnapshotService sysDateSnapshotService;
|
private SysDateSnapshotService sysDateSnapshotService;
|
||||||
|
|
||||||
|
@ -24,8 +31,14 @@ public class MonthSnapshot implements ITask {
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
logger.info("月快照计划");
|
logger.info("月快照计划");
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
|
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_MONTH.getFlag());
|
||||||
|
});
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
|
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_MONTH.getFlag());
|
||||||
|
});
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
|
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_MONTH.getFlag());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 周快照计划任务
|
* 周快照计划任务
|
||||||
|
@ -15,6 +18,9 @@ import org.springframework.stereotype.Component;
|
||||||
@Component("weeklySnapshot")
|
@Component("weeklySnapshot")
|
||||||
public class WeeklySnapshot implements ITask {
|
public class WeeklySnapshot implements ITask {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(WeeklySnapshot.class);
|
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
|
@Autowired
|
||||||
private SysDateSnapshotService sysDateSnapshotService;
|
private SysDateSnapshotService sysDateSnapshotService;
|
||||||
|
@ -27,8 +33,14 @@ public class WeeklySnapshot implements ITask {
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
logger.info("周快照计划");
|
logger.info("周快照计划");
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
|
sysDateSnapshotService.snapshotAction(SnapshotType.DATA_WEEKLY.getFlag());
|
||||||
|
});
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
|
sysDateSnapshotService.snapshotApplyAction(SnapshotType.APPLY_WEEKLY.getFlag());
|
||||||
|
});
|
||||||
|
executor.execute(() -> {
|
||||||
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
|
sysDateSnapshotService.snapshotResourceAction(SnapshotType.RESOURCE_WEEKLY.getFlag());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2328,6 +2328,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectApplyDeptDetailTypeCountList(Map params) {
|
public Object selectApplyDeptDetailTypeCountList(Map params) {
|
||||||
|
if (params.containsKey("snapshot")) {
|
||||||
|
logger.info("快照获取");
|
||||||
|
} else {
|
||||||
UserDetail user = SecurityUser.getUser();
|
UserDetail user = SecurityUser.getUser();
|
||||||
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
|
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
|
||||||
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
|
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
|
||||||
|
@ -2336,6 +2339,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
||||||
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
|
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
|
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
|
||||||
|
|
||||||
|
@ -2654,6 +2658,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectDeptDetailTypeCountList(Map params) {
|
public Object selectDeptDetailTypeCountList(Map params) {
|
||||||
|
if (params.containsKey("snapshot")) {
|
||||||
|
logger.info("快照获取");
|
||||||
|
} else {
|
||||||
UserDetail user = SecurityUser.getUser();
|
UserDetail user = SecurityUser.getUser();
|
||||||
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
|
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
|
||||||
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
|
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
|
||||||
|
@ -2662,6 +2669,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
||||||
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
|
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())
|
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())
|
|| params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue