|
|
@@ -3,6 +3,7 @@ package com.xunmei.core.evaluate.service.impl;
|
|
|
|
|
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
@@ -36,10 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -67,6 +65,18 @@ public class CoreEvaluateTaskServiceImpl extends ServiceImpl<CoreEvaluateTaskMap
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<CoreEvaluateTaskVO> selectPage(EvaluateTaskDTO evaluateTaskDTO) {
|
|
|
+/* TableDataInfo<Map> statistics = statistics(evaluateTaskDTO);
|
|
|
+ List<Map> rows = statistics.getRows();
|
|
|
+ for (int i = 0; i < rows.size(); i++) {
|
|
|
+ Object taskId = rows.get(i).get("taskId");
|
|
|
+ List<Map> contentByTaskId = baseMapper.getContentByTaskId((Long) taskId);
|
|
|
+ if (CollectionUtils.isNotEmpty(contentByTaskId)) {
|
|
|
+ for (int l = 0; l < contentByTaskId.size(); l++) {
|
|
|
+ rows.get(i).put(contentByTaskId.get(l).get("content"), contentByTaskId.get(l).get("score"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ statistics(evaluateTaskDTO);
|
|
|
Page<CoreEvaluateTaskVO> page;
|
|
|
//分页
|
|
|
if (evaluateTaskDTO.getPageNum() != null && evaluateTaskDTO.getPageSize() != null) {
|
|
|
@@ -102,9 +112,30 @@ public class CoreEvaluateTaskServiceImpl extends ServiceImpl<CoreEvaluateTaskMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TableDataInfo statistics(EvaluateTaskDTO evaluateTaskDTO) {
|
|
|
-
|
|
|
- return null;
|
|
|
+ public TableDataInfo<Map> statistics(EvaluateTaskDTO evaluateTaskDTO) {
|
|
|
+ Page<Map> page;
|
|
|
+ //分页
|
|
|
+ if (evaluateTaskDTO.getPageNum() != null && evaluateTaskDTO.getPageSize() != null) {
|
|
|
+ page = new Page<>(evaluateTaskDTO.getPageNum(), evaluateTaskDTO.getPageSize());
|
|
|
+ } else {
|
|
|
+ page = new Page<>();
|
|
|
+ }
|
|
|
+ Page<Map> statistics = baseMapper.statistics(page, evaluateTaskDTO);
|
|
|
+ List<Map> rows = statistics.getRecords();
|
|
|
+ for (int i = 0; i < rows.size(); i++) {
|
|
|
+ Object taskId = rows.get(i).get("taskId");
|
|
|
+ List<Map> contentByTaskId = baseMapper.getContentByTaskId((Long) taskId);
|
|
|
+ if (CollectionUtils.isNotEmpty(contentByTaskId)) {
|
|
|
+ int total = 0;
|
|
|
+ for (int l = 0; l < contentByTaskId.size(); l++) {
|
|
|
+ Integer score = Integer.valueOf(contentByTaskId.get(l).get("score").toString());
|
|
|
+ rows.get(i).put(contentByTaskId.get(l).get("content"), score);
|
|
|
+ total += score;
|
|
|
+ }
|
|
|
+ rows.get(i).put("合计", total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return TableDataInfo.build(statistics);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -141,7 +172,7 @@ public class CoreEvaluateTaskServiceImpl extends ServiceImpl<CoreEvaluateTaskMap
|
|
|
CoreEvaluateTaskVO coreEvaluateTaskVO = new CoreEvaluateTaskVO();
|
|
|
CoreEvaluateTask coreEvaluateTask = coreEvaluateTaskMapper.selectById(id);
|
|
|
BeanUtils.copyProperties(coreEvaluateTask, coreEvaluateTaskVO);
|
|
|
- switch ( coreEvaluateTaskVO.getEvaluateCycle()){
|
|
|
+ switch (coreEvaluateTaskVO.getEvaluateCycle()) {
|
|
|
case "0":
|
|
|
coreEvaluateTaskVO.setEvaluateCycle("每月");
|
|
|
break;
|