|
@@ -5,9 +5,10 @@ import cn.com.qmth.stmms.ms.core.domain.Level;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkLogOperType;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkStage;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.task.MarkTaskLevel;
|
|
|
-import cn.com.qmth.stmms.ms.core.domain.user.MarkUser;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.task.MarkTaskRoughLevel;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.LevelRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkTaskLevelRepo;
|
|
|
+import cn.com.qmth.stmms.ms.core.repository.MarkTaskRoughLevelRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkUserRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.vo.Subject;
|
|
|
import cn.com.qmth.stmms.ms.marking.service.MarkerGroupLeaderService;
|
|
@@ -24,7 +25,6 @@ import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -44,6 +44,9 @@ public class QualityAnalyseController {
|
|
|
@Autowired
|
|
|
private SqlUtil sqlUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ MarkTaskRoughLevelRepo markTaskRoughLevelRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
MarkTaskLevelRepo markTaskLevelRepo;
|
|
|
|
|
@@ -65,19 +68,22 @@ public class QualityAnalyseController {
|
|
|
@RequestMapping(value = "levelsPropReport", method = RequestMethod.GET)
|
|
|
public Object levelsPropReport(
|
|
|
@RequestParam Long workId,
|
|
|
+ @RequestParam(required = false) MarkStage stage,
|
|
|
@RequestParam(required = false) Subject subject,
|
|
|
@RequestParam(required = false) String areaCode,
|
|
|
@RequestParam(required = false) Long groupId,
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
+ stage = Objects.isNull(stage) ? MarkStage.LEVEL : stage;
|
|
|
List fList = new ArrayList();
|
|
|
List<Level> levels = levelRepo.findByWorkId(workId);
|
|
|
- List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, MarkStage.LEVEL, groupId);
|
|
|
+ List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, stage, groupId);
|
|
|
String markerId = null;
|
|
|
if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
markerId = markerIds.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
}
|
|
|
String finalMarkerId = markerId;
|
|
|
+ MarkStage finalStage = stage;
|
|
|
levels.forEach(l -> {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append(" SELECT ");
|
|
@@ -91,10 +97,14 @@ public class QualityAnalyseController {
|
|
|
sql.append(" (SELECT ");
|
|
|
sql.append(" m.* ");
|
|
|
sql.append(" FROM ");
|
|
|
- sql.append(" mark_task m ");
|
|
|
- sql.append(" left join paper p on m.paper_id = p.id ");
|
|
|
+ if (MarkStage.ROUGH_LEVEL.equals(finalStage)) {
|
|
|
+ sql.append("mark_task_rough_level");
|
|
|
+ } else if (MarkStage.LEVEL.equals(finalStage)) {
|
|
|
+ sql.append("mark_task_level");
|
|
|
+ }
|
|
|
+ sql.append(" m left join paper p on m.paper_id = p.id ");
|
|
|
sql.append(" WHERE ");
|
|
|
- sql.append(" stage = " + MarkStage.LEVEL.ordinal() + " ");
|
|
|
+ sql.append(" m.stage = " + finalStage.ordinal() + " ");
|
|
|
if (!Objects.isNull(areaCode)) {
|
|
|
sql.append(" and p.area_code = " + areaCode);
|
|
|
}
|
|
@@ -113,7 +123,7 @@ public class QualityAnalyseController {
|
|
|
sql.append(" WHERE ");
|
|
|
sql.append(" mu.work_id = " + workId);
|
|
|
if (Objects.nonNull(subject)) {
|
|
|
- sql.append(" AND mu.subject = '" + subject.toString() + "' ");
|
|
|
+ sql.append(" AND mu.subject = '" + subject + "' ");
|
|
|
}
|
|
|
sql.append(" AND mu.role = 'MARKER' ");
|
|
|
sql.append(" GROUP BY mu.id , mu.name ");
|
|
@@ -158,46 +168,87 @@ public class QualityAnalyseController {
|
|
|
@RequestMapping(value = "callbackReport", method = RequestMethod.GET)
|
|
|
public List callbackReport(
|
|
|
@RequestParam Long workId,
|
|
|
+ @RequestParam(required = false) MarkStage stage,
|
|
|
@RequestParam(required = false) Subject subject,
|
|
|
@RequestParam(required = false) String areaCode,
|
|
|
@RequestParam(required = false) Long groupId,
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
+ stage = Objects.isNull(stage) ? MarkStage.LEVEL : stage;
|
|
|
List list = new ArrayList();
|
|
|
- List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, MarkStage.LEVEL, groupId);
|
|
|
- Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
- if (Objects.nonNull(subject)) {
|
|
|
- predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
- }
|
|
|
- if (Objects.nonNull(areaCode)) {
|
|
|
- predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
- CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
- for (Long id : markerIds) {
|
|
|
- in.value(id);
|
|
|
+ List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, stage, groupId);
|
|
|
+ if (MarkStage.ROUGH_LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskRoughLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
}
|
|
|
- predicates.add(builder.and(builder.and(in)));
|
|
|
- }
|
|
|
- return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
- };
|
|
|
- List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
- if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
- Map<Long, MarkTaskLevel> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
- List<Long> markerIdList = markerMap.values().stream().map(MarkTaskLevel::getMarkerId).collect(Collectors.toList());
|
|
|
- Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
- String sql = new StringBuffer("select mu.login_name as userName, count(t.create_user_id) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id 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[]{">="});
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskRoughLevel> markTasks = markTaskRoughLevelRepo.findAll(specification);
|
|
|
+
|
|
|
+ if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskRoughLevel::getMarkerId, MarkTaskRoughLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, count(t.create_user_id) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and 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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- if (Objects.nonNull(endTime)) {
|
|
|
- sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ } else if (MarkStage.LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
+
|
|
|
+ if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, MarkTaskLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, count(t.create_user_id) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and 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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
- list = sqlUtil.execSqlForMap(sql);
|
|
|
- list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -214,47 +265,85 @@ public class QualityAnalyseController {
|
|
|
@RequestMapping(value = "distanceReport", method = RequestMethod.GET)
|
|
|
public List distanceReport(
|
|
|
@RequestParam Long workId,
|
|
|
+ @RequestParam(required = false) MarkStage stage,
|
|
|
@RequestParam(required = false) Subject subject,
|
|
|
@RequestParam(required = false) String areaCode,
|
|
|
@RequestParam(required = false) Long groupId,
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
+ stage = Objects.isNull(stage) ? MarkStage.LEVEL : stage;
|
|
|
List list = new ArrayList();
|
|
|
- List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, MarkStage.LEVEL, groupId);
|
|
|
- ;
|
|
|
- Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
- if (Objects.nonNull(subject)) {
|
|
|
- predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
- }
|
|
|
- if (Objects.nonNull(areaCode)) {
|
|
|
- predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
- CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
- for (Long id : markerIds) {
|
|
|
- in.value(id);
|
|
|
+ List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, stage, groupId);
|
|
|
+ if (MarkStage.ROUGH_LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskRoughLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
}
|
|
|
- predicates.add(builder.and(builder.and(in)));
|
|
|
- }
|
|
|
- return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
- };
|
|
|
- List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
- if (Objects.nonNull(markTasks) && !markTasks.isEmpty()) {
|
|
|
- Map<Long, MarkTaskLevel> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
- List<Long> markerIdList = markerMap.values().stream().map(MarkTaskLevel::getMarkerId).collect(Collectors.toList());
|
|
|
- Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
- String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id 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[]{">="});
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskRoughLevel> markTasks = markTaskRoughLevelRepo.findAll(specification);
|
|
|
+ if (Objects.nonNull(markTasks) && !markTasks.isEmpty()) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskRoughLevel::getMarkerId, MarkTaskRoughLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and 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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- if (Objects.nonNull(endTime)) {
|
|
|
- sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ } else if (MarkStage.LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
+ if (Objects.nonNull(markTasks) && !markTasks.isEmpty()) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, MarkTaskLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and 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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
- list = sqlUtil.execSqlForMap(sql);
|
|
|
- list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -271,47 +360,85 @@ public class QualityAnalyseController {
|
|
|
@RequestMapping(value = "deviationReport", method = RequestMethod.GET)
|
|
|
public List cumulativeReport(
|
|
|
@RequestParam Long workId,
|
|
|
+ @RequestParam(required = false) MarkStage stage,
|
|
|
@RequestParam(required = false) Subject subject,
|
|
|
@RequestParam(required = false) String areaCode,
|
|
|
@RequestParam(required = false) Long groupId,
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
@RequestParam(required = false) String endTime) {
|
|
|
+ stage = Objects.isNull(stage) ? MarkStage.LEVEL : stage;
|
|
|
List list = new ArrayList();
|
|
|
- List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, MarkStage.LEVEL, groupId);
|
|
|
- ;
|
|
|
- Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
- if (Objects.nonNull(subject)) {
|
|
|
- predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
- }
|
|
|
- if (Objects.nonNull(areaCode)) {
|
|
|
- predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
- CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
- for (Long id : markerIds) {
|
|
|
- in.value(id);
|
|
|
+ List<Long> markerIds = markerGroupLeaderService.listByWorkIdAndSubjectAndStageAndGroupId(workId, subject, stage, groupId);
|
|
|
+ if (MarkStage.ROUGH_LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskRoughLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
}
|
|
|
- predicates.add(builder.and(builder.and(in)));
|
|
|
- }
|
|
|
- return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
- };
|
|
|
- List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
- if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
- Map<Long, MarkTaskLevel> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
- List<Long> markerIdList = markerMap.values().stream().map(MarkTaskLevel::getMarkerId).collect(Collectors.toList());
|
|
|
- Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
- String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.oper_type = ").append(MarkLogOperType.LEVEl_DEVIATION.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[]{">="});
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskRoughLevel> markTasks = markTaskRoughLevelRepo.findAll(specification);
|
|
|
+ if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskRoughLevel::getMarkerId, MarkTaskRoughLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and t.oper_type = ").append(MarkLogOperType.LEVEl_DEVIATION.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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- if (Objects.nonNull(endTime)) {
|
|
|
- sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ } else if (MarkStage.LEVEL.equals(stage)) {
|
|
|
+ Specification<MarkTaskLevel> specification = (root, query, builder) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(builder.equal(root.get("workId"), workId));
|
|
|
+ if (Objects.nonNull(subject)) {
|
|
|
+ predicates.add(builder.equal(root.get("subject"), subject));
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(areaCode)) {
|
|
|
+ predicates.add(builder.equal(root.get("paper").get("areaCode"), areaCode));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(markerIds)) {
|
|
|
+ CriteriaBuilder.In<Object> in = builder.in(root.get("markerId"));
|
|
|
+ for (Long id : markerIds) {
|
|
|
+ in.value(id);
|
|
|
+ }
|
|
|
+ predicates.add(builder.and(builder.and(in)));
|
|
|
+ }
|
|
|
+ return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+ List<MarkTaskLevel> markTasks = markTaskLevelRepo.findAll(specification);
|
|
|
+ if (Objects.nonNull(markTasks) && markTasks.size() > 0) {
|
|
|
+ Map<Long, String> markerMap = markTasks.stream().collect(Collectors.toMap(MarkTaskLevel::getMarkerId, MarkTaskLevel::getMarkerName, (dto1, dto2) -> dto1));
|
|
|
+ List<Long> markerIdList = markerMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
|
|
+ Object o = StringUtils.join(markerIdList.toArray(), ",");
|
|
|
+ String sql = new StringBuffer("select mu.login_name as userName, sum(t.oper_data_after) as sumCount,t.create_user_id as userId from mark_log t left join mark_user mu on t.create_user_id = mu.id where t.stage = ").append(stage.ordinal()).append(" and t.oper_type = ").append(MarkLogOperType.LEVEl_DEVIATION.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[]{">="});
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(endTime)) {
|
|
|
+ sql = sqlUtil.sqlConditionAnd(sql, new String[]{"t.create_time"}, new String[]{endTime}, new String[]{"<="});
|
|
|
+ }
|
|
|
+ sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
+ list = sqlUtil.execSqlForMap(sql);
|
|
|
+ list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
- sql = sqlUtil.sqlGroupBy(sql, "t.create_user_id");
|
|
|
- list = sqlUtil.execSqlForMap(sql);
|
|
|
- list = distinctCommon(list, markerIdList, markerMap);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -324,7 +451,7 @@ public class QualityAnalyseController {
|
|
|
* @param markerMap
|
|
|
* @return
|
|
|
*/
|
|
|
- public List distinctCommon(List list, List<Long> markerIdList, Map<Long, MarkTaskLevel> markerMap) {
|
|
|
+ public List distinctCommon(List list, List<Long> markerIdList, Map<Long, String> markerMap) {
|
|
|
if (Objects.nonNull(list) && list.size() > 0) {
|
|
|
List<Long> dataIdList = new ArrayList<>();
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
@@ -336,8 +463,7 @@ public class QualityAnalyseController {
|
|
|
if (distinctIdList.size() > 0) {
|
|
|
for (Long l : distinctIdList) {
|
|
|
Map map = new HashMap();
|
|
|
- MarkUser markUser = markUserRepo.findOne(markerMap.get(l).getMarkerId());
|
|
|
- map.put("userName", markUser.getLoginName());
|
|
|
+ map.put("userName", markerMap.get(l));
|
|
|
map.put("sumCount", 0);
|
|
|
map.put("userId", l);
|
|
|
list.add(map);
|