|
|
@@ -25,6 +25,7 @@ import com.xunmei.core.thread.ThreadPoolConfig;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import com.xunmei.system.api.vo.SysOrgVO;
|
|
|
+import io.netty.util.internal.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
@@ -89,6 +90,9 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
@Autowired
|
|
|
@Qualifier(ThreadPoolConfig.SOC_EXECUTOR)
|
|
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
+
|
|
|
+ public static final List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void countExceptionData(String date) {
|
|
|
@@ -100,17 +104,17 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
//获取安保履职的数据
|
|
|
doResumptionExceptionData(time);
|
|
|
- },threadPoolTaskExecutor);
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
//获取问题整改的异常数据
|
|
|
doQuestionExceptionData(null, time);
|
|
|
- },threadPoolTaskExecutor);
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
|
|
|
CompletableFuture.runAsync(() -> {
|
|
|
//获取监控调阅的异常数据
|
|
|
doMonitorExceptionData(time);
|
|
|
- },threadPoolTaskExecutor);
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -143,7 +147,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
//删除已有的计算数据
|
|
|
deleteOldData(year, month, null);
|
|
|
|
|
|
- List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+ // List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
//计算安保履职
|
|
|
calculateResumptionData(resumptionIndexList, resumptionExceptionDataList, year, month, orgList);
|
|
|
|
|
|
@@ -184,17 +188,17 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
//删除已有的计算数据
|
|
|
deleteOldData(year, month, orgIds);
|
|
|
|
|
|
- List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+ // List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
|
|
|
- orgList = orgList.stream().filter(org -> orgIds.contains(org.getId())).collect(Collectors.toList());
|
|
|
+ List<SysOrgVO> orgListData = orgList.stream().filter(org -> orgIds.contains(org.getId())).collect(Collectors.toList());
|
|
|
//计算安保履职
|
|
|
- calculateResumptionData(resumptionIndexList, resumptionExceptionDataList, year, month, orgList);
|
|
|
+ calculateResumptionData(resumptionIndexList, resumptionExceptionDataList, year, month, orgListData);
|
|
|
|
|
|
//计算问题整改
|
|
|
- calculateQuestionData(questionIndexList, questionExceptionDataList, year, month, orgList);
|
|
|
+ calculateQuestionData(questionIndexList, questionExceptionDataList, year, month, orgListData);
|
|
|
|
|
|
//计算监控调阅
|
|
|
- calculateMonitoringData(monitoringIndexList, monitoringExceptionDataList, year, month, orgList);
|
|
|
+ calculateMonitoringData(monitoringIndexList, monitoringExceptionDataList, year, month, orgListData);
|
|
|
|
|
|
|
|
|
reCalculateAll(year, month, orgIds);
|
|
|
@@ -256,7 +260,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
List<CoreSafetyDeductData> list = safetyDeductDataService.list(new LambdaQueryWrapper<CoreSafetyDeductData>()
|
|
|
.eq(CoreSafetyDeductData::getDataYear, year)
|
|
|
.eq(CoreSafetyDeductData::getDataMonth, month));
|
|
|
- List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+ //List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
List<SysOrgVO> orgLista = orgList.stream()
|
|
|
.filter(r -> ObjectUtil.isNotEmpty(r.getType()))
|
|
|
.filter(r -> ObjectUtil.equal(OrgTypeEnum.YINGYE_WANGDIAN.getCode(), r.getType()))
|
|
|
@@ -369,18 +373,17 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
//如果两个元素下标相减等于1,说明两个元素相邻,也就是连续逾期未登
|
|
|
if (nextDataIndex - curDataIndex == 1) {
|
|
|
continuousNum++;
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (continuousNum >= indicatorDays) {
|
|
|
- //说明已经达到了连续数的要求
|
|
|
- double deductScore = continuousNum * monitoringContinuousNum.getItemValue();
|
|
|
- //计算连续数
|
|
|
- CoreSafetySourceData safeSourceData = doNewSafetySourceData(monitoringContinuousNum, orgId, deductScore, year, month, continuousNum);
|
|
|
- sourceDataList.add(safeSourceData);
|
|
|
- continuousNum = 1;
|
|
|
- usedConfigList.add(monitoringContinuousNum);
|
|
|
- break;
|
|
|
+ if (continuousNum >= indicatorDays) {
|
|
|
+ //说明已经达到了连续数的要求
|
|
|
+ double deductScore = continuousNum * monitoringContinuousNum.getItemValue();
|
|
|
+ //计算连续数
|
|
|
+ CoreSafetySourceData safeSourceData = doNewSafetySourceData(monitoringContinuousNum, orgId, deductScore, year, month, continuousNum);
|
|
|
+ sourceDataList.add(safeSourceData);
|
|
|
+ continuousNum = 1;
|
|
|
+ usedConfigList.add(monitoringContinuousNum);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return sourceDataList;
|
|
|
@@ -653,6 +656,8 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
safeSourceData.setRuleId(indexConfigCountVo.getRuleId());
|
|
|
safeSourceData.setItemId(indexConfigCountVo.getItemId());
|
|
|
safeSourceData.setOrgId(orgId);
|
|
|
+ safeSourceData.setOrgName(getOrgName(orgId));
|
|
|
+ safeSourceData.setOrgPath(getOrgPath(orgId));
|
|
|
safeSourceData.setTimes(time);
|
|
|
safeSourceData.setScore(deductScore);
|
|
|
safeSourceData.setDataYear(year);
|
|
|
@@ -778,6 +783,8 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
safeDeductData.setId(IdWorker.getId());
|
|
|
safeDeductData.setRuleId(sourceData.getRuleId());
|
|
|
safeDeductData.setOrgId(sourceData.getOrgId());
|
|
|
+ safeDeductData.setOrgName(getOrgName(sourceData.getOrgId()));
|
|
|
+ safeDeductData.setOrgPath(getOrgPath(sourceData.getOrgId()));
|
|
|
safeDeductData.setScore(total);
|
|
|
if (total > indexConfigCountVo.getScore()) {
|
|
|
safeDeductData.setScoreReal((double) indexConfigCountVo.getScore());
|
|
|
@@ -822,4 +829,20 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private String getOrgName(Long orgId){
|
|
|
+ Optional<SysOrgVO> optional = orgList.stream().filter(org -> ObjectUtil.equal(org.getId(), orgId)).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ return optional.get().getShortName();
|
|
|
+ }
|
|
|
+ return StringUtil.EMPTY_STRING;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getOrgPath(Long orgId){
|
|
|
+ Optional<SysOrgVO> optional = orgList.stream().filter(org -> ObjectUtil.equal(org.getId(), orgId)).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ return optional.get().getPath();
|
|
|
+ }
|
|
|
+ return StringUtil.EMPTY_STRING;
|
|
|
+ }
|
|
|
+
|
|
|
}
|