|
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -96,7 +97,10 @@ public class QualityAnalyseController {
|
|
|
sql.append(" AND mu.subject = mt.subject ");
|
|
|
sql.append(" AND mu.id = mt.marker_id ");
|
|
|
sql.append(" WHERE ");
|
|
|
- sql.append(" mu.work_id = " + workId + " AND mu.subject = '" + subject.toString() + "' ");
|
|
|
+ sql.append(" mu.work_id = " + workId);
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ sql.append(" AND mu.subject = '" + subject.toString() + "' ");
|
|
|
+ }
|
|
|
sql.append(" AND mu.role = 'MARKER' ");
|
|
|
sql.append(" GROUP BY mu.id , mu.name ");
|
|
|
sql.append(" ORDER BY mu.id ");
|
|
@@ -151,7 +155,6 @@ public class QualityAnalyseController {
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
// @ApiParam(value = "结束时间", required = false)
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
- List fList = new ArrayList();
|
|
|
List list = null;
|
|
|
Specification<MarkTask> specification = (root, query, builder) -> {
|
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
@@ -166,9 +169,10 @@ public class QualityAnalyseController {
|
|
|
};
|
|
|
List<MarkTask> markTasks = markTaskRepo.findAll(specification);
|
|
|
if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
- Set<Long> markerIdSet = markTasks.stream().map(o -> o.getMarkerId()).collect(Collectors.toSet());
|
|
|
- Object o = StringUtils.join(markerIdSet.toArray(), ",");
|
|
|
- String sql = new StringBuffer("select t.create_user_name as userName, count(t.create_user_id) as sumCount from mark_log t where t.oper_type BETWEEN ").append(MarkLogOperType.SYSTEM_CALLBACK_LEVEl.getId()).append(" and ").append(MarkLogOperType.HANDLE_LEVEl.getId()).append(" and t.create_user_id in (").append(o).append(")").toString();
|
|
|
+ Map<Long, MarkTask> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTask::getMarkerId, Function.identity()));
|
|
|
+ List<Long> markerIdList = markerMap.values().stream().map(i -> i.getMarkerId()).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select t.create_user_name as userName, count(t.create_user_id) as sumCount,t.create_user_id as userId from mark_log t where t.oper_type BETWEEN ").append(MarkLogOperType.SYSTEM_CALLBACK_LEVEl.getId()).append(" and ").append(MarkLogOperType.HANDLE_LEVEl.getId()).append(" and t.create_user_id in (").append(o).append(")").toString();
|
|
|
if (Objects.nonNull(startTime)) {
|
|
|
sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{startTime}, new String[]{">="});
|
|
|
}
|
|
@@ -177,14 +181,35 @@ public class QualityAnalyseController {
|
|
|
}
|
|
|
sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
list = sqlUtil.execSqlForMap(sql);
|
|
|
+ if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
+ List<Long> dataIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Map map = (Map) list.get(i);
|
|
|
+ dataIdList.add(Long.parseLong(String.valueOf(map.get("userId"))));
|
|
|
+ }
|
|
|
+ //求差值id集合
|
|
|
+ List<Long> distinctIdList = markerIdList.stream().filter(item -> !dataIdList.contains(item)).collect(Collectors.toList());
|
|
|
+ if (Objects.nonNull(distinctIdList) && distinctIdList.size() > 0) {
|
|
|
+ for (Long l : distinctIdList) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("userName", markerMap.get(l).getMarkerName());
|
|
|
+ map.put("sumCount", 0);
|
|
|
+ map.put("userId", l);
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if (Objects.nonNull(list)) {
|
|
|
- Map map = new HashMap();
|
|
|
- map.put("data", list);
|
|
|
- map.put("size", list.size());
|
|
|
- fList.add(map);
|
|
|
- }
|
|
|
- return fList;
|
|
|
+ //排序
|
|
|
+ Collections.sort(list, new Comparator<Map<String, Object>>() {
|
|
|
+ @Override
|
|
|
+ public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
+ String o1Value = String.valueOf(o1.get("userName"));
|
|
|
+ String o2Value = String.valueOf(o2.get("userName"));
|
|
|
+ return o1Value.compareTo(o2Value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -209,7 +234,6 @@ public class QualityAnalyseController {
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
// @ApiParam(value = "结束时间", required = false)
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
- List fList = new ArrayList();
|
|
|
List list = null;
|
|
|
Specification<MarkTask> specification = (root, query, builder) -> {
|
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
@@ -236,12 +260,6 @@ public class QualityAnalyseController {
|
|
|
sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
list = sqlUtil.execSqlForMap(sql);
|
|
|
}
|
|
|
- if (Objects.nonNull(list)) {
|
|
|
- Map map = new HashMap();
|
|
|
- map.put("data", list);
|
|
|
- map.put("size", list.size());
|
|
|
- fList.add(map);
|
|
|
- }
|
|
|
- return fList;
|
|
|
+ return list;
|
|
|
}
|
|
|
}
|