提交 95e8088f 编写于 作者: minghao.wu's avatar minghao.wu

fix: 日期显示 回复为空时userid为空异常

上级 1bea4744
...@@ -640,10 +640,10 @@ public class AnalysisController { ...@@ -640,10 +640,10 @@ public class AnalysisController {
System.out.println("myStar: user == null, token=" + token); System.out.println("myStar: user == null, token=" + token);
return ReturnUtil.getPicaResponse(PicaResultCode.LOGIN_FAILE); return ReturnUtil.getPicaResponse(PicaResultCode.LOGIN_FAILE);
} }
if (!rankingListService.isRankingInTop200(user.getId())) { /*if (!rankingListService.isRankingInTop200(user.getId())) {
return ReturnUtil.getPicaResponse(PicaResultCode.PERMISSION_NO_ACCESS); return ReturnUtil.getPicaResponse(PicaResultCode.PERMISSION_NO_ACCESS);
} }
*/
if (roundId != null) if (roundId != null)
System.out.println("myStar: roundId=" + roundId.toString() + " token=" + token); System.out.println("myStar: roundId=" + roundId.toString() + " token=" + token);
...@@ -668,19 +668,21 @@ public class AnalysisController { ...@@ -668,19 +668,21 @@ public class AnalysisController {
*/ */
if ((new Date()).getTime() > analysisRound.getEndTime().getTime()) { if ((new Date()).getTime() > analysisRound.getEndTime().getTime()) {
myStarDto.setIsFinished(1); myStarDto.setIsFinished(1);
/**
* 设置我是否当选
*/
Integer electedDoctorId = analysisService.getElectedDoctorIdByRoundId(roundId);
myStarDto.setIsElected(electedDoctorId.intValue() == user.getId().intValue() ? 1 : 0);
} else { } else {
myStarDto.setIsFinished(0); myStarDto.setIsFinished(0);
myStarDto.setIsElected(0);
} }
/** /**
* 设置我的得赞数 * 设置我的得赞数
*/ */
myStarDto.setMyStarCount(analysisService.getStarCountByRoundIdAndDoctorId(roundId, user.getId())); myStarDto.setMyStarCount(analysisService.getStarCountByRoundIdAndDoctorId(roundId, user.getId()));
/**
* 设置我是否当选
*/
Integer electedDoctorId = analysisService.getElectedDoctorIdByRoundId(roundId);
myStarDto.setIsElected(electedDoctorId.intValue() == user.getId().intValue() ? 1 : 0);
/** /**
* 我的解析得赞记录 * 我的解析得赞记录
......
...@@ -613,6 +613,8 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService { ...@@ -613,6 +613,8 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
} }
userExamTitleDto.setIsReplied(isReplied ? 1 : 0); userExamTitleDto.setIsReplied(isReplied ? 1 : 0);
userExamTitleDto.setStarCount(starCount); userExamTitleDto.setStarCount(starCount);
userExamTitleDtos.add(userExamTitleDto);
} }
return userExamTitleDtos; return userExamTitleDtos;
......
...@@ -40,7 +40,7 @@ public class DateUtils { ...@@ -40,7 +40,7 @@ public class DateUtils {
public static String remainingTime(Date date) { public static String remainingTime(Date date) {
long time = date.getTime() / 1000; long time = date.getTime() / 1000;
long now = (new Date()).getTime() / 1000; long now = (new Date()).getTime() / 1000;
long interval = now - time; long interval = time - now;
if (interval < 0) if (interval < 0)
return ""; return "";
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<select id="selectElectedDoctorIdByExamTitleIdList" resultType="java.lang.Integer"> <select id="selectElectedDoctorIdByExamTitleIdList" resultType="java.lang.Integer">
select select
user_id ifnull(user_id,0)
from p_reply from p_reply
where analysis_round_exam_title_id in where analysis_round_exam_title_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")"> <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<select id="selectStarCountByParam" resultType="java.lang.Integer"> <select id="selectStarCountByParam" resultType="java.lang.Integer">
select select
sum(star_count) ifnull(sum(star_count),0)
from p_reply from p_reply
where analysis_round_exam_title_id in where analysis_round_exam_title_id in
<foreach item="item" index="index" collection="examTitleList" open="(" separator="," close=")"> <foreach item="item" index="index" collection="examTitleList" open="(" separator="," close=")">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册