|
@@ -1,9 +1,6 @@
|
|
|
package cn.com.qmth.stmms.biz.exam.service.impl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
@@ -11,6 +8,8 @@ import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
@@ -36,6 +35,8 @@ import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
|
@Service("markerService")
|
|
|
public class MarkerServiceImpl extends BaseQueryService<Marker> implements MarkerService {
|
|
|
|
|
|
+ protected static Logger log = LoggerFactory.getLogger(MarkerService.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkerDao markerDao;
|
|
|
|
|
@@ -88,16 +89,30 @@ public class MarkerServiceImpl extends BaseQueryService<Marker> implements Marke
|
|
|
@Override
|
|
|
public List<Marker> getMarkCount(int examId) {
|
|
|
List<Marker> list = new LinkedList<Marker>();
|
|
|
- List<Object[]> result = libraryDao.countMarkerAndStatus(examId, LibraryStatus.MARKED, LibraryStatus.INSPECTED, LibraryStatus.WAIT_ARBITRATE, LibraryStatus.ARBITRATED);
|
|
|
- if (result != null) {
|
|
|
- for (Object[] array : result) {
|
|
|
- try {
|
|
|
+ List<Object[]> resultNa = libraryDao.countMarkerAndStatus(examId, LibraryStatus.MARKED,
|
|
|
+ LibraryStatus.INSPECTED);
|
|
|
+ List<Object[]> result = libraryDao.countMarkerAndStatus(examId, LibraryStatus.MARKED, LibraryStatus.INSPECTED,
|
|
|
+ LibraryStatus.WAIT_ARBITRATE, LibraryStatus.ARBITRATED);
|
|
|
+ try {
|
|
|
+ Map<Integer, Integer> markerMap = new HashMap<>();
|
|
|
+ if (resultNa != null) {
|
|
|
+ for (int i = 0; i < resultNa.size(); i++) {
|
|
|
+ Object[] array = resultNa.get(i);
|
|
|
+ markerMap.put((int) array[0], (int) array[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (result != null) {
|
|
|
+ for (int i = 0; i < result.size(); i++) {
|
|
|
+ Object[] array = result.get(i);
|
|
|
Marker marker = findById((int) array[0]);
|
|
|
- marker.setMarkedCount((long) array[1]);
|
|
|
+ marker.setFinishCount((int) result.get(i)[1]);
|
|
|
+ marker.setFinishCountNa(markerMap.get((int) array[0]));
|
|
|
list.add(marker);
|
|
|
- } catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("export-marker", e);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -105,17 +120,30 @@ public class MarkerServiceImpl extends BaseQueryService<Marker> implements Marke
|
|
|
@Override
|
|
|
public List<Marker> getMarkCount(int examId, Set<String> subjectCodes) {
|
|
|
List<Marker> list = new LinkedList<Marker>();
|
|
|
+ List<Object[]> resultNa = libraryDao.countMarkerAndStatusAndSubjectCodeIn(examId, subjectCodes,
|
|
|
+ LibraryStatus.MARKED, LibraryStatus.INSPECTED);
|
|
|
List<Object[]> result = libraryDao.countMarkerAndStatusAndSubjectCodeIn(examId, subjectCodes,
|
|
|
LibraryStatus.MARKED, LibraryStatus.INSPECTED, LibraryStatus.WAIT_ARBITRATE, LibraryStatus.ARBITRATED);
|
|
|
- if (result != null) {
|
|
|
- for (Object[] array : result) {
|
|
|
- try {
|
|
|
+ try {
|
|
|
+ Map<Integer, Integer> markerMap = new HashMap<>();
|
|
|
+ if (resultNa != null) {
|
|
|
+ for (int i = 0; i < resultNa.size(); i++) {
|
|
|
+ Object[] array = resultNa.get(i);
|
|
|
+ markerMap.put((int) array[0], (int) array[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (result != null) {
|
|
|
+ for (int i = 0; i < result.size(); i++) {
|
|
|
+ Object[] array = result.get(i);
|
|
|
Marker marker = findById((int) array[0]);
|
|
|
- marker.setMarkedCount((long) array[1]);
|
|
|
+ marker.setFinishCount((int) result.get(i)[1]);
|
|
|
+ marker.setFinishCountNa(markerMap.get((int) array[0]));
|
|
|
list.add(marker);
|
|
|
- } catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("export-marker", e);
|
|
|
}
|
|
|
return list;
|
|
|
}
|