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

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

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