|
@@ -180,36 +180,9 @@ public class QualityAnalyseController {
|
|
|
sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
}
|
|
|
sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
-// sql = sqlUtil.sqlOrderBy(sql, "t.create_user_name");
|
|
|
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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- //排序
|
|
|
- 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;
|
|
|
}
|
|
|
|
|
@@ -249,9 +222,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, sum(t.oper_data_after) as sumCount from mark_log t where t.oper_type = ").append(MarkLogOperType.LEVEl_DIFFERENCE.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(), (dto1, dto2) -> dto1));
|
|
|
+ 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, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t where t.oper_type = ").append(MarkLogOperType.LEVEl_DIFFERENCE.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[]{">="});
|
|
|
}
|
|
@@ -259,9 +233,48 @@ public class QualityAnalyseController {
|
|
|
sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
}
|
|
|
sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
- sql = sqlUtil.sqlOrderBy(sql, "t.create_user_name");
|
|
|
list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 求差值公用
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @param markerIdList
|
|
|
+ * @param markerMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List distinctCommon(List list, List<Long> markerIdList, Map<Long, MarkTask> markerMap) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //排序
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|