Commit 3aeff8e0 authored by 王国存's avatar 王国存

问卷管理-绩效汇总列表优化

parent c870d6be
...@@ -374,24 +374,26 @@ public class QuestionnaireCtrl { ...@@ -374,24 +374,26 @@ public class QuestionnaireCtrl {
map.put("msg", ""); map.put("msg", "");
Map<String, Object> data = new HashMap(); Map<String, Object> data = new HashMap();
//列表排序
String sorting = "";
if(performanceSummary.getSorting().equals("desc")){
sorting = "tr.create_time desc";
}else{
sorting = "basicIndicators,guideIndicators,rewardIndicators desc";
}
performanceSummary.setSorting(sorting);
int totalScore = 0; int totalScore = 0;
//查询空间的不同指标的分数 //查询空间的不同指标的分数
List<PerformanceSummary> performanceSummaryList = questionnaireService.selectPerformanceSummaryList(performanceSummary); List<PerformanceSummary> performanceSummaryList = questionnaireService.selectPerformanceSummaryList(performanceSummary);
if(performanceSummaryList.size() > 0){ if(performanceSummaryList.size() > 0){
for(PerformanceSummary total : performanceSummaryList){ for(PerformanceSummary total : performanceSummaryList){
//基础指标最高30分,引导指标最高50分,奖励指标最高10分
if(total.getGuideIndicators() > 50){
total.setGuideIndicators(50);
}
if(total.getRewardIndicators() > 30){
total.setRewardIndicators(30);
}
//计算各个空间指标的总分 //计算各个空间指标的总分
totalScore = total.getBasicIndicators() + total.getGuideIndicators() + total.getRewardIndicators(); totalScore = total.getBasicIndicators() + total.getGuideIndicators() + total.getRewardIndicators();
total.setTotalScore(totalScore);
} }
data.put("performanceSummaryList",performanceSummaryList); data.put("performanceSummaryList",performanceSummaryList);
data.put("totalScore",totalScore);
} }
map.put("data",data); map.put("data",data);
......
...@@ -123,41 +123,36 @@ ...@@ -123,41 +123,36 @@
<select id="selectPerformanceSummaryList" resultType="com.tiptimes.model.PerformanceSummary"> <select id="selectPerformanceSummaryList" resultType="com.tiptimes.model.PerformanceSummary">
SELECT SELECT
ta.value as optinName, ta.value as optinName,
CASE WHEN tr.process_status = 2 THEN '0' CASE WHEN tr.process_status = 2 THEN '0' WHEN tr.process_status = 3 THEN '30' ELSE '0' END as basicIndicators,
WHEN tr.process_status = 3 THEN '30'
ELSE '0'
END as basicIndicators,
( (
SELECT SELECT
COUNT(ta.score) as score CASE WHEN COUNT(ta.score) > 50 THEN 50 WHEN COUNT(ta.score) THEN COUNT(ta.score) ELSE '0' END as score
FROM FROM t_questions AS tq
t_questions AS tq LEFT JOIN t_answer AS ta ON ta.`group` = tq.id
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1' LEFT JOIN t_record AS tr ON tr.id = ta.record_id
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` in('2','5','6','8','9','12','13','14','15','16') WHERE tq.`status` = 1 AND ta.`group` in('2','5','6','8','9','12','13','14','15','16')
LEFT JOIN t_record AS tr on tr.id = ta.record_id
WHERE o.`status` = 1 and tq.`status` = 1
) as guideIndicators, ) as guideIndicators,
( (
SELECT SELECT
COUNT(ta.score) as score CASE WHEN COUNT(ta.score) > 10 THEN 10 WHEN COUNT(ta.score) THEN COUNT(ta.score) ELSE '0' END as score
FROM FROM t_questions AS tq
t_questions AS tq LEFT JOIN t_answer AS ta ON ta.`group` = tq.id
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1' LEFT JOIN t_record AS tr ON tr.id = ta.record_id and ta.`group` BETWEEN 17 and 21
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` = '1' WHERE tq.`status` = 1
LEFT JOIN t_record AS tr on tr.id = ta.record_id and ta.`group` BETWEEN 17 and 21
WHERE o.`status` = 1 and tq.`status` = 1
) as rewardIndicators ) as rewardIndicators
FROM
t_questions AS tq FROM t_questions AS tq
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1' LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1'
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` = '1' LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` = '1'
LEFT JOIN t_record AS tr on tr.id = ta.record_id and ta.`group` BETWEEN 1 and 11 LEFT JOIN t_record AS tr ON tr.id = ta.record_id and ta.`group` BETWEEN 1 and 11
WHERE o.`status` = 1 and tq.`status` = 1 WHERE o.`status` = 1 and tq.`status` = 1
<if test=" optinName!= null and optinName !=''"> <if test=" optinName!= null and optinName !=''">
AND ta.value LIKE CONCAT('%', #{optinName}, '%') AND ta.value LIKE CONCAT('%', #{optinName}, '%')
</if> </if>
ORDER BY ta.value ${sorting} ORDER BY
<if test="sorting != null and sorting != ''">
${sorting}
</if>
</select> </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