|
|
|
@ -5,17 +5,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.constant.CacheNames;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.scale.constant.ScaleDimensionEnum;
|
|
|
|
|
import org.dromara.scale.constant.ScoreRuleTypeEnum;
|
|
|
|
|
import org.dromara.scale.constant.StatusEnum;
|
|
|
|
|
import org.dromara.scale.domain.*;
|
|
|
|
|
import org.dromara.scale.domain.bo.SysEvaluationAnswerBo;
|
|
|
|
|
import org.dromara.scale.domain.bo.SysEvaluationConclusionBo;
|
|
|
|
|
import org.dromara.scale.domain.vo.*;
|
|
|
|
|
import org.dromara.scale.mapper.*;
|
|
|
|
|
import org.dromara.scale.service.ISysEvaluationConclusionService;
|
|
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
@ -119,8 +122,8 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
Long riskLevel = -1L;
|
|
|
|
|
String riskName = "";
|
|
|
|
|
//选择风险等级最高
|
|
|
|
|
for(SysEvaluationConclusionVo ec: list){
|
|
|
|
|
if(ec.getSituation() > riskLevel){
|
|
|
|
|
for (SysEvaluationConclusionVo ec : list) {
|
|
|
|
|
if (ec.getSituation() > riskLevel) {
|
|
|
|
|
riskLevel = ec.getSituation();
|
|
|
|
|
//riskName = ec.getSituationName();
|
|
|
|
|
}
|
|
|
|
@ -137,7 +140,7 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
// warnRecordDAO.evalWarn(wre);
|
|
|
|
|
// }
|
|
|
|
|
//不允许查看考核结果
|
|
|
|
|
if(!allowQueryResult){
|
|
|
|
|
if (!allowQueryResult) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -146,11 +149,11 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
.map(SysEvaluationConclusionVo::getScore)
|
|
|
|
|
// 使用reduce()聚合函数,得到金额总和
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
return new HashMap<String,Object>(){{
|
|
|
|
|
return new HashMap<String, Object>() {{
|
|
|
|
|
//put("evalRecordId",evalRecord.getId());
|
|
|
|
|
//put("scaleName",scaleInfo.getName());
|
|
|
|
|
put("totalScore",totalScore.doubleValue());
|
|
|
|
|
put("list", list.stream().filter(item -> item.getStatus().equals(1)).collect(
|
|
|
|
|
put("totalScore", totalScore.doubleValue());
|
|
|
|
|
put("list", list.stream().filter(item -> item.getStatus().equals(StatusEnum.IN_USE.getValue())).collect(
|
|
|
|
|
Collectors.toList()));
|
|
|
|
|
}};
|
|
|
|
|
}
|
|
|
|
@ -160,15 +163,8 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
SysEvaluationRecordVo recordVo = recordMapper.selectVoById(recordId);
|
|
|
|
|
Long scaleId = recordVo.getScaleId();
|
|
|
|
|
|
|
|
|
|
List<SysScaleQuestionVo> sysScaleQuestionVos = scaleQuestionMapper.selectVoList(
|
|
|
|
|
new LambdaQueryWrapper<SysScaleQuestion>().eq(SysScaleQuestion::getScaleId, scaleId));
|
|
|
|
|
Map<Long, List<SysScaleQuestionVo>> questionMapByFactor = sysScaleQuestionVos.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(SysScaleQuestionVo::getFactorId));
|
|
|
|
|
|
|
|
|
|
List<SysScaleAnswerVo> scaleAnswerVos = scaleAnswerMapper.selectVoList(
|
|
|
|
|
new LambdaQueryWrapper<SysScaleAnswer>().eq(SysScaleAnswer::getScaleId, scaleId));
|
|
|
|
|
Map<Long, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerVos.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(SysScaleAnswerVo::getQuestionId));
|
|
|
|
|
Map<Long, List<SysScaleQuestionVo>> questionMapByFactor = getScaleQuestionMap(scaleId);
|
|
|
|
|
Map<Long, List<SysScaleAnswerVo>> answerMapByQuestion = getScaleAnswerMap(scaleId);
|
|
|
|
|
|
|
|
|
|
List<SysScaleFactorVo> scaleFactorList = getScaleEvalItemList(scaleId);
|
|
|
|
|
List<SysEvaluationConclusionVo> list = new ArrayList<>(scaleFactorList.size());
|
|
|
|
@ -179,8 +175,7 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
SysEvaluationConclusionVo evalConclusion = new SysEvaluationConclusionVo();
|
|
|
|
|
evalConclusion.setFactorId(factorId);
|
|
|
|
|
evalConclusion.setRecordId(recordId);
|
|
|
|
|
//未命中
|
|
|
|
|
evalConclusion.setStatus(0);
|
|
|
|
|
evalConclusion.setStatus(StatusEnum.DISABLED.getValue());
|
|
|
|
|
list.add(evalConclusion);
|
|
|
|
|
|
|
|
|
|
List<SysScaleQuestionVo> questionNum = questionMapByFactor.get(factorId);
|
|
|
|
@ -268,8 +263,20 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
//保存结果
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SysScaleFactorVo> getScaleEvalItemList(Long scaleId) {
|
|
|
|
|
@Cacheable(cacheNames = CacheNames.MAP_SCALE_QUESTION, key = "#scaleId")
|
|
|
|
|
public Map<Long, List<SysScaleQuestionVo>> getScaleQuestionMap(Long scaleId) {
|
|
|
|
|
List<SysScaleQuestionVo> scaleQuestionVos = scaleQuestionMapper.selectVoList(
|
|
|
|
|
new LambdaQueryWrapper<SysScaleQuestion>().eq(SysScaleQuestion::getScaleId, scaleId));
|
|
|
|
|
return scaleQuestionVos.stream().collect(Collectors.groupingBy(SysScaleQuestionVo::getFactorId));
|
|
|
|
|
}
|
|
|
|
|
@Cacheable(cacheNames = CacheNames.MAP_SCALE_ANSWER, key = "#scaleId")
|
|
|
|
|
public Map<Long, List<SysScaleAnswerVo>> getScaleAnswerMap(Long scaleId) {
|
|
|
|
|
List<SysScaleAnswerVo> scaleAnswerVos = scaleAnswerMapper.selectVoList(
|
|
|
|
|
new LambdaQueryWrapper<SysScaleAnswer>().eq(SysScaleAnswer::getScaleId, scaleId));
|
|
|
|
|
return scaleAnswerVos.stream().collect(Collectors.groupingBy(SysScaleAnswerVo::getQuestionId));
|
|
|
|
|
}
|
|
|
|
|
@Cacheable(cacheNames = CacheNames.SYS_SCALE_FACTOR, key = "#scaleId")
|
|
|
|
|
public List<SysScaleFactorVo> getScaleEvalItemList(Long scaleId) {
|
|
|
|
|
List<SysScaleFactorVo> scaleFactorVos = scaleFactorMapper.selectVoList(
|
|
|
|
|
new LambdaQueryWrapper<SysScaleFactor>().eq(SysScaleFactor::getScaleId, scaleId));
|
|
|
|
|
List<SysScaleFactorRangeVo> scaleFactorRangeVos = scaleFactorRangeMapper.selectVoList(
|
|
|
|
@ -321,15 +328,15 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
|
|
|
|
//throw new EdfRuntimeException(String.format("%s 量表配置有误!,请联系管理员!",scaleInfo.getName()));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
evalConclusions.forEach(item -> item.setStatus(1));
|
|
|
|
|
evalConclusions.forEach(item -> item.setStatus(StatusEnum.IN_USE.getValue()));
|
|
|
|
|
break;
|
|
|
|
|
case MULTIPE_SINGL:
|
|
|
|
|
//择低录取
|
|
|
|
|
if (scaleInfo.getSelectDirection() == 1) {
|
|
|
|
|
evalConclusions.stream().min(Comparator.comparing(SysEvaluationConclusionVo::getScore)).get().setStatus(1);
|
|
|
|
|
evalConclusions.stream().min(Comparator.comparing(SysEvaluationConclusionVo::getScore)).get().setStatus(StatusEnum.IN_USE.getValue());
|
|
|
|
|
} else {
|
|
|
|
|
//高分录取
|
|
|
|
|
evalConclusions.stream().max(Comparator.comparing(SysEvaluationConclusionVo::getScore)).get().setStatus(1);
|
|
|
|
|
evalConclusions.stream().max(Comparator.comparing(SysEvaluationConclusionVo::getScore)).get().setStatus(StatusEnum.IN_USE.getValue());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case MULTIPE_MULTIPE:
|
|
|
|
|