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

增加查询问卷反馈人员列表,问卷单选多选反馈统计,问卷问题反馈详情接口

parent 871d214c
......@@ -21,10 +21,10 @@ public interface FeedbackDao extends ICRUDDao<FeedbackEntity,Long>{
/***
* 问卷反馈人员列表
* @param feedbackId
* @param query
* @return
*/
List<FeedbackStaffInfoVo> getFeedbackStaffList(Long feedbackId);
Result<FeedbackStaffInfoVo> getFeedbackStaffList(FeedbackEntity query,PageInfo pageInfo);
/**
* 问卷单选多选反馈统计
......
......@@ -28,8 +28,29 @@ public class FeedbackDaoImpl extends BaseCRUDDaoMybatis<FeedbackEntity,Long> imp
@Override
public List<FeedbackStaffInfoVo> getFeedbackStaffList(Long feedbackId) {
return this.getSqlSession().selectList(this.getSqlId("getFeedbackStaffList"), feedbackId);
public Result<FeedbackStaffInfoVo> getFeedbackStaffList(FeedbackEntity query,PageInfo pageInfo) {
String sqlId = "getFeedbackStaffList";
Result result = new Result();
List list = null;
int count = this.getFeedbackStaffListCount(query);
if (count == 0) {
list = new ArrayList();
} else if (pageInfo.getPrePageResult() == -1) {
list = this.getSqlSession().selectList(this.getSqlId(sqlId), query);
} else {
if (pageInfo.getBeginIndex() > count) {
pageInfo.setCurrPage(1);
}
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
list = this.getSqlSession().selectList(this.getSqlId(sqlId), query, rowBounds);
}
pageInfo.setTotalResult(count);
result.setPageInfo(pageInfo);
result.setList((List)list);
return result;
}
@Override
......@@ -66,4 +87,8 @@ public class FeedbackDaoImpl extends BaseCRUDDaoMybatis<FeedbackEntity,Long> imp
private int getQuestionAnswerListCount(Long questionId) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getQuestionAnswerListCount"), questionId);
}
private int getFeedbackStaffListCount(FeedbackEntity query) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getFeedbackStaffListCount"), query);
}
}
......@@ -17,6 +17,10 @@ import java.util.Date;
public class FeedbackVo extends BaseEntityLong {
private List<Long> staffList;
/** 问题Id */
private Long questionId;
/** 反馈Id */
private Long feedbackId;
/** 反馈状态 */
private Integer backStatus;
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.mortals.xhx.module.feedback.model.vo;
import lombok.Data;
import java.util.List;
/**
* 问卷单选多选反馈统计视图
*/
......@@ -36,4 +38,6 @@ public class OptionSummaryVo {
* 选项统计
*/
private Integer optionCount;
List<OptionSummaryVo> optionList;
}
......@@ -25,10 +25,10 @@ public interface FeedbackService extends ICRUDService<FeedbackEntity,Long>{
/***
* 问卷反馈人员列表
* @param feedbackId
* @param query
* @return
*/
List<FeedbackStaffInfoVo> getFeedbackStaffList(Long feedbackId) throws AppException;
Result<FeedbackStaffInfoVo> getFeedbackStaffList(FeedbackEntity query,PageInfo pageInfo) throws AppException;
/**
* 问卷单选多选反馈统计
......
......@@ -110,11 +110,14 @@ public class FeedbackServiceImpl extends AbstractCRUDServiceImpl<FeedbackDao, Fe
}
@Override
public List<FeedbackStaffInfoVo> getFeedbackStaffList(Long feedbackId) throws AppException {
if(feedbackId==null){
public Result<FeedbackStaffInfoVo> getFeedbackStaffList(FeedbackEntity query,PageInfo pageInfo) throws AppException {
if(query.getFeedbackId()==null){
throw new AppException("绩效反馈记录Id不能为空");
}
return dao.getFeedbackStaffList(feedbackId);
if(pageInfo==null){
pageInfo = new PageInfo();
}
return dao.getFeedbackStaffList(query,pageInfo);
}
@Override
......
......@@ -23,12 +23,10 @@ import com.mortals.xhx.module.feedback.model.FeedbackEntity;
import com.mortals.xhx.module.feedback.service.FeedbackService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
......@@ -63,12 +61,12 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
/**
* 查询问卷反馈人员列表
* @param feedbackId
* @param query
* @return
*/
@RequestMapping(value = {"getStaffList"},method = {RequestMethod.POST, RequestMethod.GET})
@PostMapping({"getStaffList"})
@UnAuth
public Rest<Object> getFeedbackStaffList(Long feedbackId) {
public Rest<Object> getFeedbackStaffList(@RequestBody FeedbackEntity query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
......@@ -76,9 +74,10 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
int code=1;
try {
List<FeedbackStaffInfoVo> result = this.getService().getFeedbackStaffList(feedbackId);
if(CollectionUtils.isNotEmpty(result)) {
Map<Integer, List<FeedbackStaffInfoVo>> groupMap = result.stream().collect(Collectors.groupingBy(FeedbackStaffInfoVo::getBackStatus));
PageInfo pageInfo = this.buildPageInfo(query);
Result<FeedbackStaffInfoVo> result = this.getService().getFeedbackStaffList(query,pageInfo);
if(CollectionUtils.isNotEmpty(result.getList())) {
Map<Integer, List<FeedbackStaffInfoVo>> groupMap = result.getList().stream().collect(Collectors.groupingBy(FeedbackStaffInfoVo::getBackStatus));
if(groupMap.containsKey(1)) {
model.put("feedBack", groupMap.get(1).size());
}else {
......@@ -93,8 +92,9 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
model.put("feedBack", 0);
model.put("notBack", 0);
}
model.put("data", result);
model.put("message_info", busiDesc + "成功");
model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo());
this.parsePageInfo(model, result.getPageInfo());
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
......@@ -126,7 +126,21 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
int code=1;
try {
List<OptionSummaryVo> result = this.getService().getOptionSummaryList(feedbackId);
model.put("data", result);
List<OptionSummaryVo> list = new ArrayList<>();
if(CollectionUtils.isNotEmpty(result)) {
Map<Long, List<OptionSummaryVo>> groupMap = result.stream().collect(Collectors.groupingBy(OptionSummaryVo::getQuestionId));
for (Long key : groupMap.keySet()) {
OptionSummaryVo vo = new OptionSummaryVo();
OptionSummaryVo temp = groupMap.get(key).get(0);
vo.setQuestionId(key);
vo.setQuestion(temp.getQuestion());
vo.setFeedbackId(temp.getFeedbackId());
vo.setQuestionType(temp.getQuestionType());
vo.setOptionList(groupMap.get(key));
list.add(vo);
}
}
model.put("data", list);
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
......@@ -156,14 +170,13 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba
Context context = this.getContext();
String busiDesc = "查询问卷问题反馈详情";
int code=1;
int code = 1;
try {
PageInfo pageInfo = this.buildPageInfo(query);
Result<QuestionAnswerVo> result = this.getService().getQuestionAnswerList(query.getQuestionId(), pageInfo);
model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo());
this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, (Map)model, context);
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
......
......@@ -4,7 +4,8 @@
<mapper namespace="com.mortals.xhx.module.feedback.dao.ibatis.FeedbackDaoImpl">
<!-- 问卷反馈人员列表 -->
<select id="getFeedbackStaffList" parameterType="long" resultType="com.mortals.xhx.module.feedback.model.vo.FeedbackStaffInfoVo">
<select id="getFeedbackStaffList" parameterType="com.mortals.xhx.module.feedback.model.FeedbackEntity" resultType="com.mortals.xhx.module.feedback.model.vo.FeedbackStaffInfoVo">
SELECT * FROM (
SELECT
s.feedbackId,
s.staffId,
......@@ -21,7 +22,38 @@
WHERE
s.feedbackId = #{feedbackId}
GROUP BY
s.staffId;
s.staffId
) AS t WHERE 1=1
<if test="backStatus != null">
AND t.backStatus = #{backStatus}
</if>
</select>
<select id="getFeedbackStaffListCount" parameterType="com.mortals.xhx.module.feedback.model.FeedbackEntity" resultType="int">
select count(1) from (
SELECT * FROM (
SELECT
s.feedbackId,
s.staffId,
s1.`name`,
s1.deptId,
s1.deptName,
s1.positionName,
CASE IFNULL(a.id, 0) WHEN 0 THEN 0 ELSE 1 END AS backStatus,
MAX(a.createTime) AS backTime
FROM
mortals_xhx_feedback_staff s
LEFT JOIN mortals_xhx_feedback_answer a ON s.staffId = a.staffId AND s.feedbackId = a.feedbackId
LEFT JOIN mortals_xhx_staff s1 ON s.staffId = s1.id
WHERE
s.feedbackId = #{feedbackId}
GROUP BY
s.staffId
) AS t WHERE 1=1
<if test="backStatus != null">
AND t.backStatus = #{backStatus}
</if>
) as tt
</select>
<!-- 问卷单选多选反馈统计 -->
......
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