|
|
@@ -9,10 +9,12 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
import com.xunmei.common.core.constant.Constants;
|
|
|
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafeMonthScore;
|
|
|
import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyDeductData;
|
|
|
import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData;
|
|
|
import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetySourceData;
|
|
|
import com.xunmei.common.core.domain.safetyindex.vo.SafeIndexRuleCountVo;
|
|
|
+import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
import com.xunmei.core.question.service.IQuestionService;
|
|
|
import com.xunmei.core.resumption.service.ResumptionService;
|
|
|
@@ -129,19 +131,21 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
}
|
|
|
|
|
|
private void calculateAll(int year, int month) {
|
|
|
- /*List<CoreSafetyDeductData> list =safetyDeductDataService.list((new QueryWrapper<CoreSafetyDeductData>()).lambda().eq(CoreSafetyDeductData::getDataYear,year).eq(CoreSafetyDeductData::getDataMonth,month));
|
|
|
+ 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> orgLista = orgList.stream().filter(r->r.getType()!=null).filter(r->ObjectUtil.equal(OrgTypeEnum.YINGYE_WANGDIAN.getCode(),r.getType())).collect(Collectors.toList());
|
|
|
- List<SafeLevel> levels =safeLevelService.list();
|
|
|
+ //List<SafeLevel> levels =safeLevelService.list();
|
|
|
Map<Long, List<CoreSafetyDeductData>> safeSourceDataList = list.stream().collect(Collectors.groupingBy(CoreSafetyDeductData::getOrgId));
|
|
|
List<CoreSafeMonthScore> listSafeMonthScore = new ArrayList<>();
|
|
|
for(SysOrgVO o:orgLista){
|
|
|
CoreSafeMonthScore monthScore = new CoreSafeMonthScore();
|
|
|
monthScore.setDataMonth(month);
|
|
|
monthScore.setDataYear(year);
|
|
|
- monthScore.setId(IDHelper.id());
|
|
|
+ monthScore.setId(IdWorker.getId());
|
|
|
monthScore.setOrgId(o.getId());
|
|
|
- monthScore.setReleaseStatus(true);
|
|
|
+ monthScore.setReleaseStatus(1);
|
|
|
List<CoreSafetyDeductData> listdata = safeSourceDataList.get(o.getId());
|
|
|
double deduct = 0;
|
|
|
if(listdata!=null){
|
|
|
@@ -150,7 +154,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
}
|
|
|
}
|
|
|
double orgscore = 100-deduct;
|
|
|
- List<SafeLevel> levelList = levels.stream().sorted(Comparator.comparing(r->r.getId())).collect(Collectors.toList());
|
|
|
+ /* List<SafeLevel> levelList = levels.stream().sorted(Comparator.comparing(r->r.getId())).collect(Collectors.toList());
|
|
|
if(orgscore>levelList.get(0).getMinValue()){
|
|
|
monthScore.setLevelId(Long.valueOf(levelList.get(0).getId()));
|
|
|
}else if(orgscore>levelList.get(1).getMinValue()&&orgscore<=levelList.get(1).getMaxValue()){
|
|
|
@@ -159,17 +163,17 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
monthScore.setLevelId(Long.valueOf(levelList.get(2).getId()));
|
|
|
}else {
|
|
|
monthScore.setLevelId(Long.valueOf(levelList.get(3).getId()));
|
|
|
- }
|
|
|
+ }*/
|
|
|
monthScore.setOrgScore(orgscore);
|
|
|
listSafeMonthScore.add(monthScore);
|
|
|
}
|
|
|
- *//* QueryWrapper<SafeMonthScore> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(SafeMonthScore::getDataYear,year);
|
|
|
- qw.lambda().eq(SafeMonthScore::getDataMonth,month);
|
|
|
- safeMonthScoreService.remove(qw);*//*
|
|
|
+ LambdaQueryWrapper<CoreSafeMonthScore> qw = new LambdaQueryWrapper<>();
|
|
|
+ qw.eq(CoreSafeMonthScore::getDataYear,year);
|
|
|
+ qw.eq(CoreSafeMonthScore::getDataMonth,month);
|
|
|
+ safeMonthScoreService.remove(qw);
|
|
|
//safeMonthScoreService.saveBatch(listSafeMonthScore);
|
|
|
// 根据机构id+年+月判断重复 存在则更新 不存在则新增
|
|
|
- safeMonthScoreService.checkAndSaveBatchData(listSafeMonthScore);*/
|
|
|
+ safeMonthScoreService.checkAndSaveBatchData(listSafeMonthScore);
|
|
|
}
|
|
|
|
|
|
private void calculateMonitoringData(List<SafeIndexRuleCountVo> monitoringIndexList, List<CoreSafetyExceptionData> dataList, int year, int month, List<SysOrgVO> orgList) {
|
|
|
@@ -182,18 +186,18 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
if (orgMonitoringIndexList.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- calculateMonitorContinuousCumulativeCount(orgMonitoringIndexList, monitoringExceptionDataList.get(orgId), orgId, year, month);
|
|
|
-
|
|
|
+ List<CoreSafetySourceData> sourceDataList = calculateMonitorContinuousCumulativeCount(orgMonitoringIndexList, monitoringExceptionDataList.get(orgId), orgId, year, month);
|
|
|
+ saveSourceData(sourceDataList, orgMonitoringIndexList.get(0));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void calculateMonitorContinuousCumulativeCount(List<SafeIndexRuleCountVo> orgMonitoringIndexList, List<CoreSafetyExceptionData> dataList, Long orgId, int year, int month) {
|
|
|
+ private List<CoreSafetySourceData> calculateMonitorContinuousCumulativeCount(List<SafeIndexRuleCountVo> orgMonitoringIndexList, List<CoreSafetyExceptionData> dataList, Long orgId, int year, int month) {
|
|
|
List<CoreSafetyExceptionData> errorDataList = dataList.stream().filter(data -> ObjectUtil.equal(3, data.getExtraField1())).collect(Collectors.toList());
|
|
|
int count = errorDataList.size();
|
|
|
if (count == 0) {
|
|
|
- return;
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
List<CoreSafetySourceData> sourceDataList = new ArrayList<>();
|
|
|
@@ -253,14 +257,9 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
|
|
|
usedConfigList.add(monitoringContinuousNum);
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ return sourceDataList;
|
|
|
}
|
|
|
|
|
|
|