Commit bfdb7bfc by 梅存智

Merge branch 'dev' into 'master'

投票次数根据投票状态设置

See merge request !4
parents 721486a8 6c1f05ee
...@@ -34,9 +34,9 @@ public interface ResearchMapper extends BaseMapper<Research> { ...@@ -34,9 +34,9 @@ public interface ResearchMapper extends BaseMapper<Research> {
* @param rowBounds * @param rowBounds
* @return * @return
*/ */
List<Research> listPage(@Param("date") String date, @Param("state") Integer state, @Param("name") String name, @Param("range") DataRangeModel dataRangeModel, RowBounds rowBounds); List<Research> listPage(@Param("date") String date, @Param("state") Integer state, @Param("name") String name, @Param("bizType") Integer bizType, @Param("range") DataRangeModel dataRangeModel, RowBounds rowBounds);
Integer listPageCount(@Param("date") String date,@Param("state") Integer state, @Param("name") String name, @Param("range") DataRangeModel dataRangeModel); Integer listPageCount(@Param("date") String date,@Param("state") Integer state, @Param("name") String name, @Param("bizType") Integer bizType, @Param("range") DataRangeModel dataRangeModel);
/** /**
* 查询所有 * 查询所有
......
...@@ -300,7 +300,9 @@ ...@@ -300,7 +300,9 @@
<if test="name != null"> <if test="name != null">
and (tb.name like concat('%', #{name}, '%') or tb.keywords like concat('%', #{name}, '%') ) and (tb.name like concat('%', #{name}, '%') or tb.keywords like concat('%', #{name}, '%') )
</if> </if>
<if test="bizType != null">
and tb.biz_type = #{bizType}
</if>
<!-- <!--
<if test="range.admin == false and range.orgIds != null and range.orgIds.size > 0"> <if test="range.admin == false and range.orgIds != null and range.orgIds.size > 0">
...@@ -329,7 +331,9 @@ ...@@ -329,7 +331,9 @@
<if test="name != null"> <if test="name != null">
and (tb.name like concat('%', #{name}, '%') or tb.keywords like concat('%', #{name}, '%') ) and (tb.name like concat('%', #{name}, '%') or tb.keywords like concat('%', #{name}, '%') )
</if> </if>
<if test="bizType != null">
and tb.biz_type = #{bizType}
</if>
<!-- <!--
<if test="range.admin == false and range.orgIds != null and range.orgIds.size > 0"> <if test="range.admin == false and range.orgIds != null and range.orgIds.size > 0">
......
...@@ -56,4 +56,6 @@ public interface TrResearchAnswerMapper extends BaseMapper<TrResearchAnswer> { ...@@ -56,4 +56,6 @@ public interface TrResearchAnswerMapper extends BaseMapper<TrResearchAnswer> {
List<ResearchGroupViewVo> queryAnswerRecord(@Param("researchId") Long researchId, @Param("siteId")Long siteId); List<ResearchGroupViewVo> queryAnswerRecord(@Param("researchId") Long researchId, @Param("siteId")Long siteId);
List<Long> getFinshIdsByIds(@Param("ids")List<Long> ids, @Param("accountId")Long accountId,@Param("siteId") Long siteId); List<Long> getFinshIdsByIds(@Param("ids")List<Long> ids, @Param("accountId")Long accountId,@Param("siteId") Long siteId);
Integer getResearchAnsweFinish(@Param("accountId")Long accountId,@Param("researchId") Long researchId);
} }
...@@ -115,4 +115,8 @@ ...@@ -115,4 +115,8 @@
</if> </if>
</select> </select>
<select id="getResearchAnsweFinish" resultType="Integer">
SELECT MAX(a.finish) AS finish FROM tr_research_answer a
where a.research_id = #{researchId} and a.account_id = #{accountId} and a.finish = 1
</select>
</mapper> </mapper>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<resultMap id="getVoteResultMap" type="com.yizhi.research.application.vo.domain.VoteRankingVo"> <resultMap id="getVoteResultMap" type="com.yizhi.research.application.vo.domain.VoteRankingVo">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="voteNum" column="vote_num"/>
<collection property="rankingList" ofType="com.yizhi.research.application.vo.domain.VoteRankingListVo"> <collection property="rankingList" ofType="com.yizhi.research.application.vo.domain.VoteRankingListVo">
<result property="id" column="questionId"/> <result property="id" column="questionId"/>
<result property="no" column="no"/> <result property="no" column="no"/>
...@@ -179,6 +180,7 @@ ...@@ -179,6 +180,7 @@
<if test="isTop == null or isTop == false" > <if test="isTop == null or isTop == false" >
,IFNULL(myanswer.answerState,0) AS answerState ,IFNULL(myanswer.answerState,0) AS answerState
</if> </if>
,r.vote_num
FROM tr_research_question a FROM tr_research_question a
INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0 INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0
LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id
......
...@@ -126,6 +126,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i ...@@ -126,6 +126,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
HQueryUtil.startHQ(Research.class); HQueryUtil.startHQ(Research.class);
Integer state = null; Integer state = null;
String name = null; String name = null;
Integer bizType = null;
if (!StringUtils.isEmpty(map.get("state"))) { if (!StringUtils.isEmpty(map.get("state"))) {
state = (Integer) map.get("state"); state = (Integer) map.get("state");
...@@ -133,6 +134,9 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i ...@@ -133,6 +134,9 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
if (!StringUtils.isEmpty(map.get("name"))) { if (!StringUtils.isEmpty(map.get("name"))) {
name = (String) map.get("name"); name = (String) map.get("name");
} }
if (!StringUtils.isEmpty(map.get("bizType"))) {
bizType = (Integer) map.get("bizType");
}
//为过滤过期调研准备 //为过滤过期调研准备
String date=null; String date=null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -155,8 +159,8 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i ...@@ -155,8 +159,8 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
} }
Page<Research> page = new Page<>(pageNo, pageSize); Page<Research> page = new Page<>(pageNo, pageSize);
page.setTotal(researchMapper.listPageCount(date,state, name, dataRangeModel)); page.setTotal(researchMapper.listPageCount(date,state, name, bizType, dataRangeModel));
page.setRecords(researchMapper.listPage(date,state, name, dataRangeModel, new RowBounds(page.getOffset(), page.getLimit()))); page.setRecords(researchMapper.listPage(date,state, name, bizType, dataRangeModel, new RowBounds(page.getOffset(), page.getLimit())));
return page; return page;
} }
...@@ -870,7 +874,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i ...@@ -870,7 +874,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
ResearchVo research = researchMapper.selectResearchDetails(id, requestContext.getAccountId(), requestContext.getSiteId()); ResearchVo research = researchMapper.selectResearchDetails(id, requestContext.getAccountId(), requestContext.getSiteId());
//投票完成或过期选择次数0 //投票完成或过期选择次数0
if(research.getFinishState() == 1 || research.getFinishState() == 2){ if(research.getFinishState() == 1 || research.getFinishState() == 3){
research.setVoteNum(0); research.setVoteNum(0);
} }
......
...@@ -1019,7 +1019,14 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio ...@@ -1019,7 +1019,14 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
RequestContext context = ContextHolder.get(); RequestContext context = ContextHolder.get();
Long companyId = context.getCompanyId(); Long companyId = context.getCompanyId();
Long siteId = context.getSiteId(); Long siteId = context.getSiteId();
return researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false); VoteRankingVo voteRankingVo = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false);
if(voteRankingVo != null){
Integer finish = trResearchAnswerMapper.getResearchAnsweFinish(context.getAccountId(), researchId);
if(finish != null && finish == 1){
voteRankingVo.setVoteNum(0);
}
}
return voteRankingVo;
} }
@Override @Override
......
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