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

fix: chc单独调用sql和普通的活动区分开

上级 4b557400
...@@ -152,35 +152,13 @@ public class AnalysisController { ...@@ -152,35 +152,13 @@ public class AnalysisController {
examTitleReplyDto.setReplyStatus(0); examTitleReplyDto.setReplyStatus(0);
if (user != null && user.getId() != 0) { if (user != null && user.getId() != 0) {
Doctor doctor = doctorService.getDoctorById(user.getId()); examTitleReplyDto.setReplyStatus(getReplyStatus(examTitleId, user.getId()));
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
if (doctor != null) {
CHCAnalysis analysis = analysisService.getAnalysisById(analysisRoundExamTitle.getAnalysisId());
if (analysis.getType() == 1) {
/**
* CHC 获取考试前两百名
*/
if (rankingListService.isRankingInTop200(doctor.getId())) {
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
}
} else if (analysis.getType() == 2) {
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if (doctorService.isAuth(doctor.getId())) {
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
}
}
}
} }
/** /**
* TODO: 测试用 * TODO: 测试用
*/ */
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId())); examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user != null ? user.getId() : 0));
builder.setData(examTitleReplyDto); builder.setData(examTitleReplyDto);
} catch (Exception e) { } catch (Exception e) {
...@@ -223,29 +201,7 @@ public class AnalysisController { ...@@ -223,29 +201,7 @@ public class AnalysisController {
examTitleReplyDetailDto.setReplyStatus(0); examTitleReplyDetailDto.setReplyStatus(0);
if (user != null && user.getId() != 0) { if (user != null && user.getId() != 0) {
Doctor doctor = doctorService.getDoctorById(user.getId()); examTitleReplyDetailDto.setReplyStatus(getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
if (doctor != null) {
CHCAnalysis analysis = analysisService.getAnalysisById(analysisRoundExamTitle.getAnalysisId());
if (analysis.getType() == 1) {
/**
* CHC 获取考试前两百名
*/
if (rankingListService.isRankingInTop200(doctor.getId())) {
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
}
} else if (analysis.getType() == 2) {
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if (doctorService.isAuth(doctor.getId())) {
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
}
}
}
} }
builder.setData(examTitleReplyDetailDto); builder.setData(examTitleReplyDetailDto);
...@@ -391,31 +347,8 @@ public class AnalysisController { ...@@ -391,31 +347,8 @@ public class AnalysisController {
* 设置回复状态 * 设置回复状态
*/ */
examTitleReplyDto.setReplyStatus(0); examTitleReplyDto.setReplyStatus(0);
if (user != null && user.getId() != 0) { if (user != null && user.getId() != 0) {
Doctor doctor = doctorService.getDoctorById(user.getId()); examTitleReplyDto.setReplyStatus(getReplyStatus(examTitleId, user.getId()));
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
if (doctor != null) {
CHCAnalysis analysis = analysisService.getAnalysisById(analysisRoundExamTitle.getAnalysisId());
if (analysis.getType() == 1) {
/**
* CHC 获取考试前两百名
*/
if (rankingListService.isRankingInTop200(doctor.getId())) {
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
}
} else if (analysis.getType() == 2) {
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if (doctorService.isAuth(doctor.getId())) {
examTitleReplyDto.setReplyStatus(analysisService.getReplyStatus(examTitleId, user.getId()));
}
}
}
} }
builder.setData(examTitleReplyDto); builder.setData(examTitleReplyDto);
...@@ -460,29 +393,7 @@ public class AnalysisController { ...@@ -460,29 +393,7 @@ public class AnalysisController {
examTitleReplyDetailDto.setReplyStatus(0); examTitleReplyDetailDto.setReplyStatus(0);
if (user != null && user.getId() != 0) { if (user != null && user.getId() != 0) {
Doctor doctor = doctorService.getDoctorById(user.getId()); examTitleReplyDetailDto.setReplyStatus(getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
if (doctor != null) {
CHCAnalysis analysis = analysisService.getAnalysisById(analysisRoundExamTitle.getAnalysisId());
if (analysis.getType() == 1) {
/**
* CHC 获取考试前两百名
*/
if (rankingListService.isRankingInTop200(doctor.getId())) {
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
}
} else if (analysis.getType() == 2) {
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if (doctorService.isAuth(doctor.getId())) {
examTitleReplyDetailDto.setReplyStatus(analysisService.getReplyStatus(reply.getAnalysisRoundExamTitleId(), user.getId()));
}
}
}
} }
builder.setData(examTitleReplyDetailDto); builder.setData(examTitleReplyDetailDto);
...@@ -545,4 +456,30 @@ public class AnalysisController { ...@@ -545,4 +456,30 @@ public class AnalysisController {
picaResponse.setData(""); picaResponse.setData("");
return picaResponse; return picaResponse;
} }
Integer getReplyStatus(Integer examTitleId, Integer userId) {
Doctor doctor = doctorService.getDoctorById(userId);
if (doctor != null) {
CHCAnalysis analysis = analysisService.getAnalysisById(examTitleId);
if (analysis.getType() == 1) {
/**
* CHC 获取考试前两百名
*/
if (rankingListService.isRankingInTop200(doctor.getId())) {
return analysisService.getReplyStatus(examTitleId, userId);
}
} else if (analysis.getType() == 2) {
/**
* PSA 职务职称主任/副主任 院长/副院长 科长/副科长 管理人数100以上
*/
if (doctorService.isAuth(doctor.getId())) {
return analysisService.getReplyStatus(examTitleId, userId);
}
}
}
return 0;
}
} }
...@@ -11,6 +11,8 @@ public interface CHCAnalysisMapper { ...@@ -11,6 +11,8 @@ public interface CHCAnalysisMapper {
CHCAnalysis selectByPrimaryKey(Integer id); CHCAnalysis selectByPrimaryKey(Integer id);
CHCAnalysis selectCHCByPrimaryKey(Integer id);
CHCAnalysis selectPSAByPrimaryKey(Integer id); CHCAnalysis selectPSAByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CHCAnalysis record); int updateByPrimaryKeySelective(CHCAnalysis record);
......
...@@ -53,7 +53,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService { ...@@ -53,7 +53,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
@Override @Override
public CHCAnalysisDto getCHCAnalysisDtoById(Integer analysisId) { public CHCAnalysisDto getCHCAnalysisDtoById(Integer analysisId) {
CHCAnalysis analysis = analysisMapper.selectByPrimaryKey(analysisId); CHCAnalysis analysis = analysisMapper.selectCHCByPrimaryKey(analysisId);
if (null == analysis) { if (null == analysis) {
return null; return null;
} }
...@@ -189,30 +189,33 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService { ...@@ -189,30 +189,33 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
/** /**
* 设置选项 * 设置选项
*/ */
if (analysisRoundExamTitle.getConfig() != null) {
List<String> configList = new ArrayList<>(); List<String> configList = new ArrayList<>();
String[] configArr = analysisRoundExamTitle.getConfig().split("\\$\\{answer\\}"); String[] configArr = analysisRoundExamTitle.getConfig().split("\\$\\{answer\\}");
for (int idx = 0; idx < configArr.length; ++ idx) { for (int idx = 0; idx < configArr.length; ++idx) {
configList.add(OPTIONS[idx] + "." + configArr[idx]); configList.add(OPTIONS[idx] + "." + configArr[idx]);
} }
examTitleDto.setConfig(configList); examTitleDto.setConfig(configList);
}
/** /**
* 设置答案 * 设置答案
*/ */
if (analysisRoundExamTitle.getAnswer() != null) {
examTitleDto.setAnswer(analysisRoundExamTitle.getAnswer()); examTitleDto.setAnswer(analysisRoundExamTitle.getAnswer());
String[] answerArr = analysisRoundExamTitle.getAnswer().split(","); String[] answerArr = analysisRoundExamTitle.getAnswer().split(",");
List<Integer> idxList = new ArrayList<>(); List<Integer> idxList = new ArrayList<>();
for (String sa : answerArr) { for (String sa : answerArr) {
for (int i = 0; i < 8; ++ i) { for (int i = 0; i < 8; ++i) {
if (sa.equals(OPTIONS[i])) { if (sa.equals(OPTIONS[i])) {
idxList.add(i); idxList.add(i);
} }
} }
} }
examTitleDto.setAnswerIdx(StringUtils.join(idxList, ",")); examTitleDto.setAnswerIdx(StringUtils.join(idxList, ","));
}
examTitleDto.setErrorRate(analysisRoundExamTitle.getErrorRate()); examTitleDto.setErrorRate(analysisRoundExamTitle.getErrorRate());
examTitleDto.setStarCount(starRecordMapper.selectStarCountByRoundExamTitleId(analysisRoundExamTitle.getId())); examTitleDto.setStarCount(starRecordMapper.selectStarCountByRoundExamTitleId(analysisRoundExamTitle.getId()));
examTitleDto.setReplyCount(replyMapper.selectReplyCountByAnalysisRoundExamTitleId(analysisRoundExamTitle.getId())); examTitleDto.setReplyCount(replyMapper.selectReplyCountByAnalysisRoundExamTitleId(analysisRoundExamTitle.getId()));
...@@ -424,6 +427,13 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService { ...@@ -424,6 +427,13 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
@Override @Override
public Integer getReplyStatus(Integer examTitleId, Integer userId) { public Integer getReplyStatus(Integer examTitleId, Integer userId) {
/**
* 用户不存在
*/
if (userId == 0) {
return 0;
}
Reply reply = new Reply(); Reply reply = new Reply();
reply.setAnalysisRoundExamTitleId(examTitleId); reply.setAnalysisRoundExamTitleId(examTitleId);
reply.setUserId(userId); reply.setUserId(userId);
......
...@@ -27,6 +27,14 @@ ...@@ -27,6 +27,14 @@
is_deleted is_deleted
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from p_chc_analysis
where id = #{id,jdbcType=INTEGER}
and is_deleted = 0
</select>
<select id="selectCHCByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from p_chc_analysis from p_chc_analysis
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册