|
@@ -22,6 +22,7 @@ import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
@@ -122,8 +123,29 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
|
|
|
}
|
|
|
List<TCStatisticsDto> tcStatisticsDtoList = this.findByBatchNoCount(sysUser.getSchoolId(), batchNo, orgIds);
|
|
|
if (Objects.nonNull(tcStatisticsDtoList) && tcStatisticsDtoList.size() > 0) {
|
|
|
+ //进行过滤
|
|
|
+ Map<String, TCStatisticsDto> map = new LinkedHashMap<>();
|
|
|
+ for (TCStatisticsDto t : tcStatisticsDtoList) {
|
|
|
+ String key = t.getCollegeId() + ":" +
|
|
|
+ t.getTeachingRoomId() + ":" +
|
|
|
+ t.getCourseCode() + ":" +
|
|
|
+ t.getPaperNumber() + ":" +
|
|
|
+ t.getPrintPlanId() + ":" +
|
|
|
+ t.getClazzId();
|
|
|
+ if (!map.containsKey(key)) {
|
|
|
+ map.computeIfAbsent(key, v -> t);
|
|
|
+ } else {
|
|
|
+ TCStatisticsDto temp = map.get(key);
|
|
|
+ if (t.getPrintSum().intValue() > temp.getPrintSum().intValue()) {
|
|
|
+ map.put(key, t);
|
|
|
+ } else if (t.getPrintSum().intValue() == temp.getPrintSum().intValue()) {
|
|
|
+ temp.setExamDetailId(null);
|
|
|
+ temp.setStatus(StatisticsStatusEnum.UN_JOIN);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Gson gson = new Gson();
|
|
|
- List<TCStatistics> tcStatisticsList = gson.fromJson(JacksonUtil.parseJson(tcStatisticsDtoList), new TypeToken<List<TCStatistics>>() {
|
|
|
+ List<TCStatistics> tcStatisticsList = gson.fromJson(JacksonUtil.parseJson(map.values()), new TypeToken<List<TCStatistics>>() {
|
|
|
}.getType());
|
|
|
for (TCStatistics t : tcStatisticsList) {
|
|
|
t.insertInfo(sysUser.getId());
|
|
@@ -197,8 +219,29 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
|
|
|
tcStatisticsQueryWrapper.lambda().eq(TCStatistics::getBatchNo, batchNo);
|
|
|
tcStatisticsService.remove(tcStatisticsQueryWrapper);
|
|
|
|
|
|
+ //进行过滤
|
|
|
+ Map<String, TCStatisticsDto> map = new LinkedHashMap<>();
|
|
|
+ for (TCStatisticsDto t : tcStatisticsDtoList) {
|
|
|
+ String key = t.getCollegeId() + ":" +
|
|
|
+ t.getTeachingRoomId() + ":" +
|
|
|
+ t.getCourseCode() + ":" +
|
|
|
+ t.getPaperNumber() + ":" +
|
|
|
+ t.getPrintPlanId() + ":" +
|
|
|
+ t.getClazzId();
|
|
|
+ if (!map.containsKey(key)) {
|
|
|
+ map.computeIfAbsent(key, v -> t);
|
|
|
+ } else {
|
|
|
+ TCStatisticsDto temp = map.get(key);
|
|
|
+ if (t.getPrintSum().intValue() > temp.getPrintSum().intValue()) {
|
|
|
+ map.put(key, t);
|
|
|
+ } else if (t.getPrintSum().intValue() == temp.getPrintSum().intValue()) {
|
|
|
+ temp.setExamDetailId(null);
|
|
|
+ temp.setStatus(StatisticsStatusEnum.UN_JOIN);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Gson gson = new Gson();
|
|
|
- List<TCStatistics> tcStatisticsList = gson.fromJson(JacksonUtil.parseJson(tcStatisticsDtoList), new TypeToken<List<TCStatistics>>() {
|
|
|
+ List<TCStatistics> tcStatisticsList = gson.fromJson(JacksonUtil.parseJson(map.values()), new TypeToken<List<TCStatistics>>() {
|
|
|
}.getType());
|
|
|
for (TCStatistics t : tcStatisticsList) {
|
|
|
t.insertInfo(sysUser.getId());
|