|
@@ -2,6 +2,7 @@ package com.ims.eval.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ims.common.utils.DateUtils;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.dao.BinSectionMapper;
|
|
|
import com.ims.eval.dao.EvaluationScoreCountMapper;
|
|
@@ -13,8 +14,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -34,9 +35,53 @@ public class EvaluatioinScoreCountServiceImpl extends ServiceImpl<EvaluationScor
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> evaluationList(String binSection, String binStage, String type, String year, String season, String month) {
|
|
|
- List<Map<String, Object>> list = baseMapper.selectEvaluationList(binSection, binStage, type, year, season, month);
|
|
|
- return list;
|
|
|
+ public Map<String, Object> evaluationList(String binSection, String binStage, String type, String condition, String date) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ String month = null;
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(DateUtils.strToDate(date, DateUtils.format3));
|
|
|
+ String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
+ if (condition.equals("JDKP")){
|
|
|
+ month = String.valueOf(DateUtils.getSeason(cal.getTime()));
|
|
|
+ }
|
|
|
+ if (condition.equals("YDKP")){
|
|
|
+ month = String.valueOf(cal.get(Calendar.MONTH) + 1);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ list.addAll(baseMapper.selectEvaluationList(binSection, binStage, type, condition, year, month));
|
|
|
+ } catch (Exception e) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Object, List<Map<String, Object>>> collect = list.stream().collect(Collectors.groupingBy(c -> c.get("organization_name"), Collectors.toList()));
|
|
|
+ boolean flag = true;
|
|
|
+ List<Object> value = new ArrayList<>();
|
|
|
+ List<Object> title = new ArrayList<>();
|
|
|
+ for (Map.Entry<Object, List<Map<String, Object>>> entry : collect.entrySet()) {
|
|
|
+ List<Map<String, Object>> v = entry.getValue();
|
|
|
+ Map<String, Object> mp = new HashMap<>();
|
|
|
+ for (int i = 0; i < v.size(); i++) {
|
|
|
+ Map<String, Object> item = v.get(i);
|
|
|
+ mp.put(item.get("indicator_code").toString() + "_score", item.get("score"));
|
|
|
+ mp.put("organization_name", item.get("organization_name"));
|
|
|
+ mp.put("flag", item.get("score") == item.get("standard_score") ? "0" : (int) item.get("score") > (int)item.get("standard_score") ? "1" : "-1");
|
|
|
+
|
|
|
+ if (flag) {
|
|
|
+ Map<String, Object> tl = new HashMap<>();
|
|
|
+ tl.put("key", item.get("indicator_name"));
|
|
|
+ tl.put("code", item.get("indicator_code").toString() + "_score");
|
|
|
+ title.add(tl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ flag = false;
|
|
|
+ value.add(mp);
|
|
|
+ }
|
|
|
+
|
|
|
+ result.put("title", title);
|
|
|
+ result.put("value", value);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|