Commit 2f9dd4b3 by “Kongxiangkun”

投票增加分页,工作台面板优化

parent 0be14024
......@@ -103,7 +103,9 @@ public interface ResearchQuestionClient {
* @return
*/
@GetMapping("/researchQuestion/getVoteResult")
VoteRankingVo getVoteResult(@RequestParam("researchId") Long researchId);
VoteRankingVo getVoteResult(@RequestParam("researchId") Long researchId,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "pageNo", required = false) Integer pageNo);
/**
* 获取投票排行榜
......
......@@ -244,4 +244,7 @@ public class ResearchVo {
@ApiModelProperty(value = "投票选择次数:0无限制")
private Integer voteNum;
@ApiModelProperty(value = "展示样式")
private Integer styleType;
}
......@@ -186,6 +186,9 @@ public class TrResearchQuestionVo extends Model<TrResearchQuestionVo> {
@ApiModelProperty(value = "所有题型有效:存放附件路径,附件格式:音频、视频、图片(存放多个)")
private List<String> attachmentUrl;
@ApiModelProperty(value = "展示样式")
private Integer styleType;
@Override
protected Serializable pkVal() {
......
......@@ -76,4 +76,7 @@ public class ResearchVo {
@ApiModelProperty(value = "投票选择次数:0无限制")
private Integer voteNum;
@ApiModelProperty(value = "展示样式")
private Integer styleType;
}
......@@ -192,8 +192,10 @@ public class TrResearchQuestionController {
* @return
*/
@GetMapping("/getVoteResult")
VoteRankingVo getVoteResult(@RequestParam("researchId") Long researchId) {
return researchQuestionService.getVoteResult(researchId);
VoteRankingVo getVoteResult(@RequestParam("researchId") Long researchId,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "pageNo", required = false) Integer pageNo) {
return researchQuestionService.getVoteResult(researchId, pageNo, pageSize);
}
/**
......
......@@ -102,7 +102,9 @@ public interface TrResearchQuestionMapper extends BaseMapper<TrResearchQuestion>
* @param isTop
* @return
*/
VoteRankingVo getVoteResult(@Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("researchId") Long researchId, @Param("accountId") Long accountId, @Param("isTop") boolean isTop);
VoteRankingVo getVoteResult(@Param("companyId") Long companyId, @Param("siteId") Long siteId,
@Param("researchId") Long researchId, @Param("accountId") Long accountId, @Param("isTop") boolean isTop,
@Param("pageStart") Integer pageStart,@Param("pageEnd") Integer pageEnd);
/**
* 刪除投票中的指定問題
......
......@@ -216,6 +216,6 @@
<if test="isTop != null and isTop == false" >
ORDER BY a.no
</if>
limit #{pageStart}, #{pageEnd}
</select>
</mapper>
......@@ -83,7 +83,7 @@ public interface ITrResearchQuestionService extends IService<TrResearchQuestion>
* @param researchId
* @return
*/
VoteRankingVo getVoteResult(Long researchId);
VoteRankingVo getVoteResult(Long researchId, Integer pageNo, Integer pageSize);
/**
* 获取投票排行榜
......
......@@ -24,7 +24,6 @@ import com.yizhi.research.application.vo.manage.OtherOptionVo;
import com.yizhi.util.application.constant.QueueConstant;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.util.application.event.TrainingProjectEvent;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -444,6 +443,12 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
if (!CollectionUtils.isEmpty(records)) {
Integer maxNo = getMaxNo(researchId);
for (TrResearchQuestion question : records) {
Research research = researchMapper.selectById(question.getResearchId());
if(research != null) {
question.setStyleType(research.getStyleType());
}
Integer has = checkJump(question.getId(), example.getResearchId());
question.setHas(has);
if (question.getJumpType() == 2 && (question.getJumpNum() == null || question.getJumpNum() == -1)) {
......@@ -1145,11 +1150,17 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
}
@Override
public VoteRankingVo getVoteResult(Long researchId) {
public VoteRankingVo getVoteResult(Long researchId, Integer pageNo, Integer pageSize) {
if(pageNo == null) {
pageNo = 1;
}
if(pageSize == null) {
pageSize = Integer.MAX_VALUE;
}
RequestContext context = ContextHolder.get();
Long companyId = context.getCompanyId();
Long siteId = context.getSiteId();
VoteRankingVo voteRankingVo = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false);
VoteRankingVo voteRankingVo = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), false, (pageNo - 1) * pageSize , pageSize);
if(voteRankingVo != null){
Integer finish = trResearchAnswerMapper.getResearchAnsweFinish(context.getAccountId(), researchId);
if(finish != null && finish == 1){
......@@ -1161,10 +1172,12 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
@Override
public VoteRankingVo getVoteTop(Long researchId) {
Integer pageNo = 1;
Integer pageSize = Integer.MAX_VALUE;
RequestContext context = ContextHolder.get();
Long companyId = context.getCompanyId();
Long siteId = context.getSiteId();
VoteRankingVo result = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), true);
VoteRankingVo result = researchQuestionMapper.getVoteResult(companyId, siteId, researchId, context.getAccountId(), true, pageNo, pageSize);
if(result != null && !CollectionUtils.isEmpty(result.getRankingList())){
int no = 1;
for(VoteRankingListVo item : result.getRankingList()){
......
......@@ -243,6 +243,9 @@ public class Research extends Model<Research> {
@ApiModelProperty(value = "投票选择次数:0无限制")
private Integer voteNum;
@ApiModelProperty(value = "展示样式")
private Integer styleType;
@Override
protected Serializable pkVal() {
......
......@@ -188,6 +188,10 @@ public class TrResearchQuestion extends Model<TrResearchQuestion> {
@ApiModelProperty(value = "所有题型有效:存放附件路径,附件格式:音频、视频、图片(存放多个)")
@TableField(exist = false)
private List<String> attachmentUrl;
@ApiModelProperty(value = "展示样式")
@TableField(exist = false)
private Integer styleType;
@Override
protected Serializable pkVal() {
......
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