Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-analysis
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.online.exam
pica-cloud-analysis
提交
246c607a
提交
246c607a
编写于
9月 05, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: 在轮列表中加入本期状态和获奖人的信息
上级
7f89021e
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
125 行增加
和
11 行删除
+125
-11
pom.xml
server/pom.xml
+1
-1
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+15
-2
ReplyMapper.java
...cloud/online/exam/analysis/server/mapper/ReplyMapper.java
+14
-0
CHCAnalysisService.java
...line/exam/analysis/server/service/CHCAnalysisService.java
+14
-0
DoctorService.java
...ud/online/exam/analysis/server/service/DoctorService.java
+7
-0
CHCAnalysisServiceImpl.java
.../analysis/server/service/impl/CHCAnalysisServiceImpl.java
+25
-8
DoctorServiceImpl.java
.../exam/analysis/server/service/impl/DoctorServiceImpl.java
+21
-0
ReplyMapper.xml
server/src/main/resources/mybatis/ReplyMapper.xml
+28
-0
未找到文件。
server/pom.xml
浏览文件 @
246c607a
...
...
@@ -138,7 +138,7 @@
<dependency>
<groupId>
com.pica.cloud.online.exam
</groupId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<version>
1.0.
3
</version>
<version>
1.0.
4
</version>
<scope>
compile
</scope>
</dependency>
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
246c607a
...
...
@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cloud.client.loadbalancer.LoadBalancerClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -597,11 +598,23 @@ public class AnalysisController {
*/
roundExamTitleV2Dto
.
setAnalysisId
(
roundExamTitleDto
.
getAnalysisId
());
roundExamTitleV2Dto
.
setRoundId
(
roundExamTitleDto
.
getRoundId
());
roundExamTitleV2Dto
.
setStartTime
(
roundExamTitle
V2
Dto
.
getStartTime
());
roundExamTitleV2Dto
.
setEndTime
(
roundExamTitle
V2
Dto
.
getEndTime
());
roundExamTitleV2Dto
.
setStartTime
(
roundExamTitleDto
.
getStartTime
());
roundExamTitleV2Dto
.
setEndTime
(
roundExamTitleDto
.
getEndTime
());
roundExamTitleV2Dto
.
setTotalCount
(
roundExamTitleDto
.
getTotalCount
());
roundExamTitleV2Dto
.
setPublished
(
roundExamTitleDto
.
getPublished
());
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
((
new
Date
()).
getTime
()
>
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
()).
getTime
())
{
roundExamTitleV2Dto
.
setIsFinished
(
1
);
roundExamTitleV2Dto
.
setElectedStarCount
(
analysisService
.
getElectedStarCountByRoundId
(
roundId
));
Integer
doctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setElectedDoctor
(
doctorService
.
getDoctorDtoById
(
doctorId
));
}
else
{
roundExamTitleV2Dto
.
setIsFinished
(
0
);
roundExamTitleV2Dto
.
setElectedDoctor
(
new
DoctorDto
());
}
List
<
ExamTitleDto
>
examTitleDtoList
=
analysisService
.
getExamTitleListByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setExamTitleList
(
examTitleDtoList
);
builder
.
setData
(
roundExamTitleV2Dto
);
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/mapper/ReplyMapper.java
浏览文件 @
246c607a
...
...
@@ -38,4 +38,18 @@ public interface ReplyMapper {
* @return
*/
List
<
Reply
>
selectFiveHottestReplyList
(
Integer
analysisRoundExamTitleId
);
/**
* 根据话题id获取当选的票数
* @param examTitleIds
* @return
*/
Integer
selectElectedStarCountByExamTitleIdList
(
List
<
Integer
>
examTitleIds
);
/**
* 根据话题id获取当选的医生id
* @param examTitleIds
* @return
*/
Integer
selectElectedDoctorIdByExamTitleIdList
(
List
<
Integer
>
examTitleIds
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/CHCAnalysisService.java
浏览文件 @
246c607a
...
...
@@ -170,4 +170,18 @@ public interface CHCAnalysisService {
* @return
*/
List
<
AnalysisRoundDto
>
getCHCHistoryRound
();
/**
* 获取某一轮的最多得票数
* @param roundId
* @return
*/
Integer
getElectedStarCountByRoundId
(
Integer
roundId
);
/**
* 获取被选中的医生id
* @param roundId
* @return
*/
Integer
getElectedDoctorIdByRoundId
(
Integer
roundId
);
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/DoctorService.java
浏览文件 @
246c607a
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
;
import
com.pica.cloud.online.exam.analysis.common.dto.DoctorDto
;
import
com.pica.cloud.online.exam.analysis.server.entity.Doctor
;
/**
...
...
@@ -14,6 +15,12 @@ public interface DoctorService {
*/
Doctor
getDoctorById
(
Integer
doctorId
);
/**
* 根据医生id获取医生dtp
* @return
*/
DoctorDto
getDoctorDtoById
(
Integer
doctorId
);
/**
* 根据医生的id获取医生的权限
* @param doctorId
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/CHCAnalysisServiceImpl.java
浏览文件 @
246c607a
...
...
@@ -59,7 +59,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
CHCAnalysisDto
analysisDto
=
new
CHCAnalysisDto
();
analysisDto
.
setId
(
analysis
.
getId
());
...
...
@@ -84,7 +84,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
CHCAnalysisDto
analysisDto
=
new
CHCAnalysisDto
();
analysisDto
.
setId
(
analysis
.
getId
());
...
...
@@ -118,7 +118,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
}
List
<
AnalysisRoundDto
>
roundDtoList
=
new
ArrayList
<>();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
for
(
AnalysisRound
round
:
roundList
)
{
AnalysisRoundDto
roundDto
=
new
AnalysisRoundDto
();
...
...
@@ -153,7 +153,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
RoundExamTitleDto
roundExamTitleDto
=
new
RoundExamTitleDto
();
...
...
@@ -255,7 +255,6 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
List
<
Reply
>
replyList
=
getReplyList
(
analysisRoundExamTitleId
);
List
<
ReplyDto
>
replyDtoList
=
new
ArrayList
<>();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
for
(
Reply
reply
:
replyList
)
{
try
{
...
...
@@ -303,8 +302,6 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
@Override
public
ReplyDto
getReplyDtoByReply
(
Reply
reply
,
Integer
userId
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
ReplyDto
replyDto
=
new
ReplyDto
();
Doctor
doctor
=
doctorMapper
.
selectByPrimaryKey
(
reply
.
getUserId
());
...
...
@@ -527,7 +524,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
roundList
=
analysisRoundMapper
.
selectHistoryRoundListById
(
1
);
List
<
AnalysisRoundDto
>
roundDtoList
=
new
ArrayList
<>();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
for
(
AnalysisRound
round
:
roundList
)
{
AnalysisRoundDto
roundDto
=
new
AnalysisRoundDto
();
...
...
@@ -554,4 +551,24 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return
roundDtoList
;
}
@Override
public
Integer
getElectedStarCountByRoundId
(
Integer
roundId
)
{
List
<
AnalysisRoundExamTitle
>
examTitleList
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
roundId
);
List
<
Integer
>
examTitleIdList
=
new
ArrayList
<>();
for
(
AnalysisRoundExamTitle
examTitle
:
examTitleList
)
{
examTitleIdList
.
add
(
examTitle
.
getId
());
}
return
replyMapper
.
selectElectedStarCountByExamTitleIdList
(
examTitleIdList
);
}
@Override
public
Integer
getElectedDoctorIdByRoundId
(
Integer
roundId
)
{
List
<
AnalysisRoundExamTitle
>
examTitleList
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
roundId
);
List
<
Integer
>
examTitleIdList
=
new
ArrayList
<>();
for
(
AnalysisRoundExamTitle
examTitle
:
examTitleList
)
{
examTitleIdList
.
add
(
examTitle
.
getId
());
}
return
replyMapper
.
selectElectedDoctorIdByExamTitleIdList
(
examTitleIdList
);
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/DoctorServiceImpl.java
浏览文件 @
246c607a
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
.
impl
;
import
com.pica.cloud.online.exam.analysis.common.dto.DoctorDto
;
import
com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfiguration
;
import
com.pica.cloud.online.exam.analysis.server.entity.Doctor
;
import
com.pica.cloud.online.exam.analysis.server.mapper.DoctorMapper
;
import
com.pica.cloud.online.exam.analysis.server.service.DoctorService
;
...
...
@@ -15,11 +17,30 @@ public class DoctorServiceImpl implements DoctorService {
@Autowired
DoctorMapper
doctorMapper
;
@Autowired
private
PropertiesConfiguration
properties
;
@Override
public
Doctor
getDoctorById
(
Integer
doctorId
)
{
return
doctorMapper
.
selectByPrimaryKey
(
doctorId
);
}
@Override
public
DoctorDto
getDoctorDtoById
(
Integer
doctorId
)
{
Doctor
doctor
=
doctorMapper
.
selectByPrimaryKey
(
doctorId
);
DoctorDto
doctorDto
=
new
DoctorDto
();
doctorDto
.
setId
(
doctor
.
getId
());
doctorDto
.
setName
(
doctor
.
getName
());
doctorDto
.
setHospital
(
doctor
.
getHospital
());
doctorDto
.
setTitle
(
doctor
.
getTitle
());
doctorDto
.
setAvatarImageUrl
(
doctor
.
getAvatarImageUrl
()
!=
null
?
properties
.
getFileUrl
()
+
doctor
.
getAvatarImageUrl
().
trim
()
:
properties
.
getFileUrl
()
+
"/File/doctor_default.png"
);
return
doctorDto
;
}
@Override
public
boolean
isAuth
(
Integer
doctorId
)
{
return
doctorMapper
.
selectAuthByDoctorId
(
doctorId
)
>
0
||
...
...
server/src/main/resources/mybatis/ReplyMapper.xml
浏览文件 @
246c607a
...
...
@@ -82,6 +82,34 @@
limit 5
</select>
<select
id=
"selectElectedStarCountByExamTitleIdList"
resultType=
"java.lang.Integer"
>
select
sum(star_count) as star
from p_reply
where analysis_round_exam_title_id in
<foreach
item=
"item"
index=
"index"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and is_deleted = 0
group by user_id
order by star desc, created_time
limit 1
</select>
<select
id=
"selectElectedDoctorIdByExamTitleIdList"
resultType=
"java.lang.Integer"
>
select
user_id
from p_reply
where analysis_round_exam_title_id in
<foreach
item=
"item"
index=
"index"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and is_deleted = 0
group by user_id
order by sum(star_count) desc, created_time
limit 1
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_reply
where id = #{id,jdbcType=INTEGER}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录