|
@@ -51,60 +51,68 @@ public class ScoreCalculationSchedule {
|
|
|
private CalculateIndicatorItemInfoMapper calculateIndicatorItemInfoMapper;
|
|
|
|
|
|
|
|
|
- public boolean doTask(){
|
|
|
+ public boolean doTask(String id){
|
|
|
|
|
|
boolean save = true;
|
|
|
try {
|
|
|
|
|
|
+
|
|
|
+ QueryWrapper<EvaluationScoreCount> qw1 = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ qw1.lambda().eq(EvaluationScoreCount::getOrganizationEvaluationId, id);
|
|
|
+ }
|
|
|
+ List<EvaluationScoreCount> evaluationScoreCountList = iEvaluatioinScoreCountService.list(qw1);
|
|
|
+ if (evaluationScoreCountList.size() >0){
|
|
|
+ List<String> idList = evaluationScoreCountList.stream().map(EvaluationScoreCount::getId).collect(Collectors.toList());
|
|
|
+ iEvaluatioinScoreCountService.removeByIds(idList);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
- QueryWrapper<OrganizationEvaluation> or = new QueryWrapper<>();
|
|
|
- List<OrganizationEvaluation> organizationEvaluations = organizationEvaluationMapper.selectList(or);
|
|
|
- if (organizationEvaluations.size() <= 0){
|
|
|
+ OrganizationEvaluation organizationEvaluation = organizationEvaluationMapper.selectById(id);
|
|
|
+ if (organizationEvaluation == null){
|
|
|
throw new Exception("考评记录为空!!!");
|
|
|
}
|
|
|
- for (OrganizationEvaluation organizationEvaluation : organizationEvaluations){
|
|
|
-
|
|
|
- List<String> list = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
+
|
|
|
+ List<String> list = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
|
|
|
- QueryWrapper<OrganizationEvaluationInfo> qw = new QueryWrapper<>();
|
|
|
- if (StringUtils.isNotEmpty(organizationEvaluation.getOrganizationEvaluationRuleId())) {
|
|
|
- qw.lambda().in(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId,list);
|
|
|
- }
|
|
|
- List<OrganizationEvaluationInfo> organizationEvaluationInfos= organizationEvaluationInfoMapper.selectList(qw);
|
|
|
- if (organizationEvaluationInfos.size() > 0){
|
|
|
-
|
|
|
- Map<String, List<OrganizationEvaluationInfo>> collect = organizationEvaluationInfos.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId));
|
|
|
- for (Map.Entry<String, List<OrganizationEvaluationInfo>> entry : collect.entrySet()){
|
|
|
-
|
|
|
- if (entry.getValue().size() > 0){
|
|
|
- Map<String, List<OrganizationEvaluationInfo>> collectIn = entry.getValue().stream().collect(Collectors.groupingBy(OrganizationEvaluationInfo::getIndicatorId));
|
|
|
- for (Map.Entry<String, List<OrganizationEvaluationInfo>> listEntry : collectIn.entrySet()){
|
|
|
- Indicator indicator = indicatorMapper.selectById(listEntry.getKey());
|
|
|
- QueryWrapper<EvaluationScoringRule> e = new QueryWrapper<>();
|
|
|
- if (StringUtils.isNotEmpty(indicator.getIndicatorCode())) {
|
|
|
- e.lambda().eq(EvaluationScoringRule::getIndicatorId,indicator.getIndicatorCode());
|
|
|
- }
|
|
|
- EvaluationScoringRule evaluationScoringRule = evaluationScoringRuleMapper.selectOne(e);
|
|
|
- if (evaluationScoringRule != null){
|
|
|
- String calculation = replace(listEntry.getValue(), evaluationScoringRule);
|
|
|
- log.info(indicator.getIndicatorCode()+"得分为" + calculation);
|
|
|
-
|
|
|
- EvaluationScoreCount evaluationScoreCount = EvaluationScoreCount.builder()
|
|
|
- .indicatorId(listEntry.getKey())
|
|
|
- .organizationEvaluationRuleId(entry.getKey())
|
|
|
- .organizationEvaluationId(organizationEvaluation.getId())
|
|
|
- .score(Double.parseDouble(calculation))
|
|
|
- .build();
|
|
|
- save = iEvaluatioinScoreCountService.save(evaluationScoreCount);
|
|
|
- }
|
|
|
+ QueryWrapper<OrganizationEvaluationInfo> qw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(organizationEvaluation.getOrganizationEvaluationRuleId())) {
|
|
|
+ qw.lambda().in(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId,list);
|
|
|
+ }
|
|
|
+ List<OrganizationEvaluationInfo> organizationEvaluationInfos= organizationEvaluationInfoMapper.selectList(qw);
|
|
|
+ if (organizationEvaluationInfos.size() > 0){
|
|
|
+
|
|
|
+ Map<String, List<OrganizationEvaluationInfo>> collect = organizationEvaluationInfos.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfo::getOrganizationEvaluationRuleId));
|
|
|
+ for (Map.Entry<String, List<OrganizationEvaluationInfo>> entry : collect.entrySet()){
|
|
|
+
|
|
|
+ if (entry.getValue().size() > 0){
|
|
|
+ Map<String, List<OrganizationEvaluationInfo>> collectIn = entry.getValue().stream().collect(Collectors.groupingBy(OrganizationEvaluationInfo::getIndicatorId));
|
|
|
+ for (Map.Entry<String, List<OrganizationEvaluationInfo>> listEntry : collectIn.entrySet()){
|
|
|
+ Indicator indicator = indicatorMapper.selectById(listEntry.getKey());
|
|
|
+ QueryWrapper<EvaluationScoringRule> e = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(indicator.getIndicatorCode())) {
|
|
|
+ e.lambda().eq(EvaluationScoringRule::getIndicatorId,indicator.getIndicatorCode());
|
|
|
+ }
|
|
|
+ EvaluationScoringRule evaluationScoringRule = evaluationScoringRuleMapper.selectOne(e);
|
|
|
+ if (evaluationScoringRule != null){
|
|
|
+ String calculation = replace(listEntry.getValue(), evaluationScoringRule);
|
|
|
+ log.info(indicator.getIndicatorCode()+"得分为" + calculation);
|
|
|
+
|
|
|
+ EvaluationScoreCount evaluationScoreCount = EvaluationScoreCount.builder()
|
|
|
+ .indicatorId(listEntry.getKey())
|
|
|
+ .organizationEvaluationRuleId(entry.getKey())
|
|
|
+ .organizationEvaluationId(organizationEvaluation.getId())
|
|
|
+ .score(Double.parseDouble(calculation))
|
|
|
+ .build();
|
|
|
+ save = iEvaluatioinScoreCountService.save(evaluationScoreCount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }else {
|
|
|
- throw new Exception("考评指标明细数据为空!!");
|
|
|
}
|
|
|
+
|
|
|
+ }else {
|
|
|
+ throw new Exception("考评指标明细数据为空!!");
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
@@ -180,6 +188,9 @@ public class ScoreCalculationSchedule {
|
|
|
String range = intervalScoringTable.getRange();
|
|
|
if (rangeHandle(range)){
|
|
|
score = MathCalculatorUtil.handle(intervalScoringTable.getRegularExpression().trim());
|
|
|
+ if (!StringUtils.isNotEmpty(score)){
|
|
|
+ score = "0";
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|