Commit fb9f9950 authored by 廖旭伟's avatar 廖旭伟

反馈记录整体情况统计

parent 52e4cec5
......@@ -10,6 +10,7 @@ import com.mortals.xhx.module.feedback.model.vo.OptionSummaryVo;
import com.mortals.xhx.module.feedback.model.vo.QuestionAnswerVo;
import java.util.List;
import java.util.Map;
/**
* FeedbackService
......@@ -44,4 +45,11 @@ public interface FeedbackService extends ICRUDService<FeedbackEntity,Long>{
* @return
*/
Result<QuestionAnswerVo> getQuestionAnswerList(Long questionId, PageInfo pageInfo) throws AppException;
/**
* 问卷反馈统计
* @return
* @throws AppException
*/
Map<String,Integer> summaryFeedback() throws AppException;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.mortals.xhx.module.feedback.model.vo.FeedbackStaffInfoVo;
import com.mortals.xhx.module.feedback.model.vo.OptionSummaryVo;
import com.mortals.xhx.module.feedback.model.vo.QuestionAnswerVo;
import com.mortals.xhx.module.feedback.service.FeedbackStaffService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -16,10 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.mortals.xhx.module.feedback.service.FeedbackQuestionService;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* FeedbackService
......@@ -142,4 +143,30 @@ public class FeedbackServiceImpl extends AbstractCRUDServiceImpl<FeedbackDao, Fe
}
return dao.getQuestionAnswerList(questionId,pageInfo);
}
@Override
public Map<String, Integer> summaryFeedback() throws AppException {
Map<String,Integer> resultMap = new HashMap<>();
resultMap.put("total",0);
resultMap.put("notStart",0);
resultMap.put("progress",0);
resultMap.put("ended",0);
List<FeedbackEntity> allList = this.getAllList();
if(CollectionUtils.isNotEmpty(allList)) {
resultMap.put("total", allList.size());
Map<Integer, List<FeedbackEntity>> groupMap = allList.stream().collect(Collectors.groupingBy(FeedbackEntity::getProcessStatus));
for (Map.Entry<Integer, List<FeedbackEntity>> entry : groupMap.entrySet()) {
if (entry.getKey() == 0) {
resultMap.put("notStart", entry.getValue().size());
}
if (entry.getKey() == 1) {
resultMap.put("progress", entry.getValue().size());
}
if (entry.getKey() == 2) {
resultMap.put("ended", entry.getValue().size());
}
}
}
return resultMap;
}
}
\ No newline at end of file
......@@ -209,4 +209,36 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
return ret;
}
/**
* 反馈记录整体情况统计
* @return
*/
@PostMapping({"summary"})
@UnAuth
public Rest<Object> summary() {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询反馈记录整体情况统计";
int code = 1;
try {
Map<String,Integer> result = this.getService().summaryFeedback();
model.put("data", result);
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model.get("data"));
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment