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
提交
1c1c4ab7
提交
1c1c4ab7
编写于
9月 06, 2018
作者:
minghao.wu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev_phase3' into release
上级
e580df71
91fa63f2
变更
25
显示空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
1420 行增加
和
76 行删除
+1420
-76
pom.xml
common/pom.xml
+1
-1
CHCAnalysisDto.java
...cloud/online/exam/analysis.common/dto/CHCAnalysisDto.java
+13
-0
DoctorDto.java
...pica/cloud/online/exam/analysis.common/dto/DoctorDto.java
+57
-0
MyStarDto.java
...pica/cloud/online/exam/analysis.common/dto/MyStarDto.java
+127
-0
RoundExamTitleV2Dto.java
.../online/exam/analysis.common/dto/RoundExamTitleV2Dto.java
+138
-0
UserExamTitleDto.java
...oud/online/exam/analysis.common/dto/UserExamTitleDto.java
+58
-0
pom.xml
server/pom.xml
+1
-1
AnalysisController.java
...e/exam/analysis/server/controller/AnalysisController.java
+200
-23
AntiSpamController.java
...e/exam/analysis/server/controller/AntiSpamController.java
+58
-0
AntiSpamRecord.java
...ud/online/exam/analysis/server/entity/AntiSpamRecord.java
+125
-0
AnalysisRoundMapper.java
...line/exam/analysis/server/mapper/AnalysisRoundMapper.java
+2
-0
AntiSpamRecordMapper.java
...ine/exam/analysis/server/mapper/AntiSpamRecordMapper.java
+17
-0
ReplyMapper.java
...cloud/online/exam/analysis/server/mapper/ReplyMapper.java
+29
-0
AntiSpamService.java
.../online/exam/analysis/server/service/AntiSpamService.java
+5
-3
CHCAnalysisService.java
...line/exam/analysis/server/service/CHCAnalysisService.java
+46
-1
DoctorService.java
...ud/online/exam/analysis/server/service/DoctorService.java
+7
-0
AntiSpamServiceImpl.java
...xam/analysis/server/service/impl/AntiSpamServiceImpl.java
+48
-10
CHCAnalysisServiceImpl.java
.../analysis/server/service/impl/CHCAnalysisServiceImpl.java
+147
-35
CHCRankingListServiceImpl.java
...alysis/server/service/impl/CHCRankingListServiceImpl.java
+4
-0
DoctorServiceImpl.java
.../exam/analysis/server/service/impl/DoctorServiceImpl.java
+21
-0
DateUtils.java
...ca/cloud/online/exam/analysis/server/utils/DateUtils.java
+60
-0
mybatis-generator.xml
server/src/main/resources/mybatis-generator.xml
+2
-1
AnalysisRoundMapper.xml
server/src/main/resources/mybatis/AnalysisRoundMapper.xml
+24
-1
AntiSpamRecordMapper.xml
server/src/main/resources/mybatis/AntiSpamRecordMapper.xml
+177
-0
ReplyMapper.xml
server/src/main/resources/mybatis/ReplyMapper.xml
+53
-0
未找到文件。
common/pom.xml
浏览文件 @
1c1c4ab7
...
...
@@ -12,7 +12,7 @@
<groupId>
com.pica.cloud.online.exam
</groupId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<name>
pica-cloud-analysis-common
</name>
<version>
1.0.
2
</version>
<version>
1.0.
8
</version>
<packaging>
jar
</packaging>
<properties>
...
...
common/src/main/java/com/pica/cloud/online/exam/analysis.common/dto/CHCAnalysisDto.java
浏览文件 @
1c1c4ab7
...
...
@@ -42,6 +42,11 @@ public class CHCAnalysisDto {
*/
private
String
rule
;
/**
* 是否在范围内 控制显示我的赞 0: 不能解析 1: 我的赞
*/
private
Integer
isJoinIn
;
private
List
<
AnalysisRoundDto
>
roundList
;
public
Integer
getId
()
{
...
...
@@ -139,4 +144,12 @@ public class CHCAnalysisDto {
public
void
setRule
(
String
rule
)
{
this
.
rule
=
rule
;
}
public
Integer
getIsJoinIn
()
{
return
isJoinIn
;
}
public
void
setIsJoinIn
(
Integer
isJoinIn
)
{
this
.
isJoinIn
=
isJoinIn
;
}
}
common/src/main/java/com/pica/cloud/online/exam/analysis.common/dto/DoctorDto.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
common
.
dto
;
/**
* @author wuminghao
* @date 2018/9/4 9:19
*/
public
class
DoctorDto
{
private
Integer
id
;
private
String
name
;
private
String
hospital
;
private
String
title
;
private
String
avatarImageUrl
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getHospital
()
{
return
hospital
;
}
public
void
setHospital
(
String
hospital
)
{
this
.
hospital
=
hospital
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getAvatarImageUrl
()
{
return
avatarImageUrl
;
}
public
void
setAvatarImageUrl
(
String
avatarImageUrl
)
{
this
.
avatarImageUrl
=
avatarImageUrl
;
}
}
common/src/main/java/com/pica/cloud/online/exam/analysis.common/dto/MyStarDto.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
common
.
dto
;
import
java.util.List
;
/**
* @author wuminghao
* @date 2018/9/4 9:14
*/
public
class
MyStarDto
{
/**
* 剩余时间
*/
String
remainingTime
;
/**
* 当前轮的开始时间
*/
String
startTime
;
/**
* 当前轮的结束时间
*/
String
endTime
;
/**
* 我的集赞数
*/
Integer
myStarCount
;
/**
* 活动状态 0: 集赞未结束 1: 集赞已结束
*/
Integer
isFinished
;
/**
* 当选状态: 0: 未当选 1: 已当选
*/
Integer
isElected
;
/**
* 医生信息
*/
private
DoctorDto
doctor
;
/**
* 轮列表
*/
private
List
<
AnalysisRoundDto
>
roundList
;
/**
* 解析信息
*/
private
List
<
UserExamTitleDto
>
myExamTitleList
;
public
String
getRemainingTime
()
{
return
remainingTime
;
}
public
void
setRemainingTime
(
String
remainingTime
)
{
this
.
remainingTime
=
remainingTime
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getMyStarCount
()
{
return
myStarCount
;
}
public
void
setMyStarCount
(
Integer
myStarCount
)
{
this
.
myStarCount
=
myStarCount
;
}
public
Integer
getIsFinished
()
{
return
isFinished
;
}
public
void
setIsFinished
(
Integer
isFinished
)
{
this
.
isFinished
=
isFinished
;
}
public
Integer
getIsElected
()
{
return
isElected
;
}
public
void
setIsElected
(
Integer
isElected
)
{
this
.
isElected
=
isElected
;
}
public
DoctorDto
getDoctor
()
{
return
doctor
;
}
public
void
setDoctor
(
DoctorDto
doctor
)
{
this
.
doctor
=
doctor
;
}
public
List
<
AnalysisRoundDto
>
getRoundList
()
{
return
roundList
;
}
public
void
setRoundList
(
List
<
AnalysisRoundDto
>
roundList
)
{
this
.
roundList
=
roundList
;
}
public
List
<
UserExamTitleDto
>
getMyExamTitleList
()
{
return
myExamTitleList
;
}
public
void
setMyExamTitleList
(
List
<
UserExamTitleDto
>
myExamTitleList
)
{
this
.
myExamTitleList
=
myExamTitleList
;
}
}
common/src/main/java/com/pica/cloud/online/exam/analysis.common/dto/RoundExamTitleV2Dto.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
common
.
dto
;
import
java.util.List
;
/**
* @author wuminghao
* @date 2018/9/4 10:11
*/
public
class
RoundExamTitleV2Dto
{
private
Integer
analysisId
;
private
Integer
roundId
;
private
String
remainingTime
;
private
String
startTime
;
private
String
endTime
;
private
Integer
totalCount
;
private
Integer
published
;
/**
* 本轮是否已结束
*/
private
Integer
isFinished
;
/**
* 当选人的点赞数
*/
private
Integer
electedStarCount
;
/**
* 当选的医生
*/
private
DoctorDto
electedDoctor
;
private
List
<
AnalysisRoundDto
>
roundList
;
private
List
<
ExamTitleDto
>
examTitleList
;
public
Integer
getAnalysisId
()
{
return
analysisId
;
}
public
void
setAnalysisId
(
Integer
analysisId
)
{
this
.
analysisId
=
analysisId
;
}
public
Integer
getRoundId
()
{
return
roundId
;
}
public
void
setRoundId
(
Integer
roundId
)
{
this
.
roundId
=
roundId
;
}
public
String
getRemainingTime
()
{
return
remainingTime
;
}
public
void
setRemainingTime
(
String
remainingTime
)
{
this
.
remainingTime
=
remainingTime
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getTotalCount
()
{
return
totalCount
;
}
public
void
setTotalCount
(
Integer
totalCount
)
{
this
.
totalCount
=
totalCount
;
}
public
Integer
getPublished
()
{
return
published
;
}
public
void
setPublished
(
Integer
published
)
{
this
.
published
=
published
;
}
public
Integer
getIsFinished
()
{
return
isFinished
;
}
public
void
setIsFinished
(
Integer
isFinished
)
{
this
.
isFinished
=
isFinished
;
}
public
Integer
getElectedStarCount
()
{
return
electedStarCount
;
}
public
void
setElectedStarCount
(
Integer
electedStarCount
)
{
this
.
electedStarCount
=
electedStarCount
;
}
public
DoctorDto
getElectedDoctor
()
{
return
electedDoctor
;
}
public
void
setElectedDoctor
(
DoctorDto
electedDoctor
)
{
this
.
electedDoctor
=
electedDoctor
;
}
public
List
<
AnalysisRoundDto
>
getRoundList
()
{
return
roundList
;
}
public
void
setRoundList
(
List
<
AnalysisRoundDto
>
roundList
)
{
this
.
roundList
=
roundList
;
}
public
List
<
ExamTitleDto
>
getExamTitleList
()
{
return
examTitleList
;
}
public
void
setExamTitleList
(
List
<
ExamTitleDto
>
examTitleList
)
{
this
.
examTitleList
=
examTitleList
;
}
}
common/src/main/java/com/pica/cloud/online/exam/analysis.common/dto/UserExamTitleDto.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
common
.
dto
;
import
java.net.Inet4Address
;
/**
* @author wuminghao
* @date 2018/9/4 9:30
*/
public
class
UserExamTitleDto
{
/**
* 题目id
*/
Integer
examTitleId
;
/**
* 题目序号
*/
Integer
seqNo
;
/**
* 我是否解析: 0: 未解析 1: 已解析
*/
Integer
isReplied
;
/**
* 获赞数
*/
Integer
starCount
;
public
Integer
getExamTitleId
()
{
return
examTitleId
;
}
public
void
setExamTitleId
(
Integer
examTitleId
)
{
this
.
examTitleId
=
examTitleId
;
}
public
Integer
getSeqNo
()
{
return
seqNo
;
}
public
void
setSeqNo
(
Integer
seqNo
)
{
this
.
seqNo
=
seqNo
;
}
public
Integer
getIsReplied
()
{
return
isReplied
;
}
public
void
setIsReplied
(
Integer
isReplied
)
{
this
.
isReplied
=
isReplied
;
}
public
Integer
getStarCount
()
{
return
starCount
;
}
public
void
setStarCount
(
Integer
starCount
)
{
this
.
starCount
=
starCount
;
}
}
server/pom.xml
浏览文件 @
1c1c4ab7
...
...
@@ -138,7 +138,7 @@
<dependency>
<groupId>
com.pica.cloud.online.exam
</groupId>
<artifactId>
pica-cloud-analysis-common
</artifactId>
<version>
1.0.
2
</version>
<version>
1.0.
8
</version>
<scope>
compile
</scope>
</dependency>
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AnalysisController.java
浏览文件 @
1c1c4ab7
...
...
@@ -16,13 +16,18 @@ import com.pica.cloud.online.exam.analysis.server.service.AntiSpamService;
import
com.pica.cloud.online.exam.analysis.server.service.CHCAnalysisService
;
import
com.pica.cloud.online.exam.analysis.server.service.CHCRankingListService
;
import
com.pica.cloud.online.exam.analysis.server.service.DoctorService
;
import
com.pica.cloud.online.exam.analysis.server.utils.DateUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javassist.bytecode.ExceptionsAttribute
;
import
org.omg.CORBA.INTERNAL
;
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
;
/**
...
...
@@ -56,7 +61,8 @@ public class AnalysisController {
@ApiOperation
(
value
=
"获取活动详情"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/activityDetail"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
CHCAnalysisDto
>
getActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
)
{
public
PicaResponse
<
CHCAnalysisDto
>
getActivityDetail
(
@RequestParam
(
required
=
false
)
Integer
id
,
@RequestHeader
(
required
=
false
)
String
token
)
{
PicaResponse
.
Builder
<
CHCAnalysisDto
>
builder
=
new
PicaResponse
.
Builder
<>();
/**
...
...
@@ -66,8 +72,27 @@ public class AnalysisController {
try
{
CHCAnalysisDto
analysisDto
=
analysisService
.
getCHCAnalysisDtoById
(
id
);
PICAUser
user
=
null
;
if
(
token
!=
null
)
{
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
}
if
(
rankingListService
.
isRankingInTop200
(
user
!=
null
?
user
.
getId
()
:
0
))
{
analysisDto
.
setIsJoinIn
(
1
);
}
else
{
analysisDto
.
setIsJoinIn
(
0
);
}
List
<
AnalysisRoundDto
>
roundList
=
analysisService
.
getRoundListByAnalysisId
(
id
);
/**
* chc活动固定返回两轮, 将第一轮设置为所有
*/
if
(
roundList
.
size
()
==
2
)
{
roundList
.
get
(
0
).
setRoundId
(-
1
);
}
analysisDto
.
setRoundList
(
roundList
);
builder
.
setData
(
analysisDto
);
}
catch
(
Exception
e
)
{
...
...
@@ -110,7 +135,7 @@ public class AnalysisController {
PicaResponse
.
Builder
<
RoundExamTitleDto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
RoundExamTitleDto
roundExamTitleDto
=
analysisService
.
getRoundById
(
roundId
);
RoundExamTitleDto
roundExamTitleDto
=
analysisService
.
getRound
ExamTitleDto
ById
(
roundId
);
List
<
ExamTitleDto
>
examTitleDtoList
=
analysisService
.
getExamTitleListByRoundId
(
roundId
);
roundExamTitleDto
.
setExamTitleList
(
examTitleDtoList
);
...
...
@@ -156,16 +181,20 @@ public class AnalysisController {
examTitleReplyDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDto
.
setReplyList
(
replyDtoList
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
analysisRoundExamTitle
.
getRoundId
());
/**
* 设置回复状态
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
examTitleReplyDto
.
setReplyStatus
(
2
);
}
else
{
examTitleReplyDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
examTitleId
,
user
.
getId
()));
}
}
/**
* 设置类型
*/
...
...
@@ -207,16 +236,22 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
analysisRoundExamTitle
.
getRoundId
());
/**
* 设置回复状态
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
examTitleReplyDetailDto
.
setReplyStatus
(
2
);
}
{
examTitleReplyDetailDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDetailDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
reply
.
getAnalysisRoundExamTitleId
(),
user
.
getId
()));
}
}
/**
* 设置类型
*/
...
...
@@ -305,6 +340,11 @@ public class AnalysisController {
System
.
out
.
println
(
"starrecord: replyid="
+
replyId
.
toString
()
+
" token="
+
token
+
" roundId="
+
roundId
+
" examTitleId="
+
examTitleId
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
return
ReturnUtil
.
getPicaResponse
(
"500002"
,
"本期活动已结束"
);
}
if
(
0
!=
analysisService
.
insertStarRecord
(
analysisId
,
roundId
,
examTitleId
,
replyId
,
user
.
getId
()))
{
/**
* 已经点过赞
...
...
@@ -363,15 +403,19 @@ public class AnalysisController {
examTitleReplyDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDto
.
setReplyList
(
replyDtoList
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
analysisRoundExamTitle
.
getRoundId
());
/**
* 设置回复状态
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
examTitleReplyDto
.
setReplyStatus
(
2
);
}
else
{
examTitleReplyDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
examTitleId
,
user
.
getId
()));
}
}
/**
* 设置类型
*/
...
...
@@ -414,16 +458,20 @@ public class AnalysisController {
examTitleReplyDetailDto
.
setExamTitle
(
examTitleDto
);
examTitleReplyDetailDto
.
setReply
(
replyDto
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
analysisRoundExamTitle
.
getRoundId
());
/**
* 设置回复状态
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
examTitleReplyDetailDto
.
setReplyStatus
(
2
);
}
else
{
examTitleReplyDetailDto
.
setReplyStatus
(
0
);
if
(
user
!=
null
&&
user
.
getId
()
!=
0
)
{
examTitleReplyDetailDto
.
setReplyStatus
(
getReplyStatus
(
analysisRoundExamTitle
.
getAnalysisId
(),
reply
.
getAnalysisRoundExamTitleId
(),
user
.
getId
()));
}
}
/**
* 设置类型
*/
...
...
@@ -443,6 +491,7 @@ public class AnalysisController {
@RequestMapping
(
value
=
"/reply/{examTitleId}"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
reply
(
@PathVariable
(
"examTitleId"
)
Integer
examTitleId
,
@RequestBody
String
content
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
if
(
token
==
null
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
...
...
@@ -469,7 +518,7 @@ public class AnalysisController {
/**
* 如果判断检测的数据中有垃圾 直接返回
*/
PicaResponse
response
=
antiSpamService
.
processString
(
content
);
PicaResponse
response
=
antiSpamService
.
processString
(
user
!=
null
?
user
.
getId
()
:
0
,
sysCode
,
content
);
if
(!
response
.
getCode
().
equals
(
PicaResultCode
.
SUCCESS
.
code
()))
{
response
.
setData
(
""
);
return
response
;
...
...
@@ -524,4 +573,132 @@ public class AnalysisController {
return
0
;
}
@ApiOperation
(
value
=
"获取某一轮的题目V2"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/roundDetail/v2/{roundId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
RoundExamTitleV2Dto
>
getRoundDetailV2
(
@PathVariable
(
value
=
"roundId"
)
Integer
roundId
)
{
System
.
out
.
println
(
"roundDetail: roundId"
+
roundId
);
PicaResponse
.
Builder
<
RoundExamTitleV2Dto
>
builder
=
new
PicaResponse
.
Builder
<>();
try
{
RoundExamTitleV2Dto
roundExamTitleV2Dto
=
new
RoundExamTitleV2Dto
();
if
(
roundId
>
0
)
{
/**
* 有rounfid传入时设置roundList为空
*/
roundExamTitleV2Dto
.
setRoundList
(
new
ArrayList
<>());
}
else
{
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
();
/**
* 获取list中第一个的roundId
*/
roundId
=
roundDtoList
.
get
(
0
).
getRoundId
();
roundExamTitleV2Dto
.
setRoundList
(
roundDtoList
);
}
RoundExamTitleDto
roundExamTitleDto
=
analysisService
.
getRoundExamTitleDtoById
(
roundId
);
/**
* 转换格式
*/
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
outFormat
=
new
SimpleDateFormat
(
"yyyy-M-d"
);
roundExamTitleV2Dto
.
setAnalysisId
(
roundExamTitleDto
.
getAnalysisId
());
roundExamTitleV2Dto
.
setRoundId
(
roundExamTitleDto
.
getRoundId
());
roundExamTitleV2Dto
.
setStartTime
(
outFormat
.
format
(
sdf
.
parse
(
roundExamTitleDto
.
getStartTime
())));
roundExamTitleV2Dto
.
setEndTime
(
outFormat
.
format
(
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
())));
roundExamTitleV2Dto
.
setTotalCount
(
roundExamTitleDto
.
getTotalCount
());
roundExamTitleV2Dto
.
setPublished
(
roundExamTitleDto
.
getPublished
());
if
((
new
Date
()).
getTime
()
>
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
()).
getTime
())
{
roundExamTitleV2Dto
.
setRemainingTime
(
""
);
roundExamTitleV2Dto
.
setIsFinished
(
1
);
roundExamTitleV2Dto
.
setElectedStarCount
(
analysisService
.
getElectedStarCountByRoundId
(
roundId
));
Integer
doctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setElectedDoctor
(
doctorService
.
getDoctorDtoById
(
doctorId
));
}
else
{
roundExamTitleV2Dto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
sdf
.
parse
(
roundExamTitleDto
.
getEndTime
())));
roundExamTitleV2Dto
.
setIsFinished
(
0
);
roundExamTitleV2Dto
.
setElectedDoctor
(
new
DoctorDto
());
}
List
<
ExamTitleDto
>
examTitleDtoList
=
analysisService
.
getExamTitleListByRoundId
(
roundId
);
roundExamTitleV2Dto
.
setExamTitleList
(
examTitleDtoList
);
builder
.
setData
(
roundExamTitleV2Dto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_INNER_ERROR
);
}
return
builder
.
build
();
}
@ApiOperation
(
value
=
"我的赞"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
{
"/myStar/{roundId}"
,
"/myStar/"
},
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
<
MyStarDto
>
myStar
(
@PathVariable
(
value
=
"roundId"
,
required
=
false
)
Integer
roundId
,
@RequestHeader
(
required
=
false
)
String
token
)
{
if
(
token
==
null
)
{
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
}
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
System
.
out
.
println
(
"myStar: user == null, token="
+
token
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
}
/*if (!rankingListService.isRankingInTop200(user.getId())) {
return ReturnUtil.getPicaResponse(PicaResultCode.PERMISSION_NO_ACCESS);
}
*/
if
(
roundId
!=
null
)
System
.
out
.
println
(
"myStar: roundId="
+
roundId
.
toString
()
+
" token="
+
token
);
PicaResponse
.
Builder
<
MyStarDto
>
builder
=
new
PicaResponse
.
Builder
<>();
MyStarDto
myStarDto
=
new
MyStarDto
();
myStarDto
.
setDoctor
(
doctorService
.
getDoctorDtoById
(
user
.
getId
()));
myStarDto
.
setRoundList
(
new
ArrayList
<>());
if
(
roundId
==
null
)
{
List
<
AnalysisRoundDto
>
roundDtoList
=
analysisService
.
getCHCHistoryRound
();
roundId
=
roundDtoList
.
get
(
0
).
getRoundId
();
myStarDto
.
setRoundList
(
roundDtoList
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy.M.d"
);
AnalysisRound
analysisRound
=
analysisService
.
getRoundInfoById
(
roundId
);
myStarDto
.
setStartTime
(
sdf
.
format
(
analysisRound
.
getStartTime
()));
myStarDto
.
setEndTime
(
sdf
.
format
(
analysisRound
.
getEndTime
()));
myStarDto
.
setRemainingTime
(
DateUtils
.
remainingTime
(
analysisRound
.
getEndTime
()));
/**
* 设置结束状态
*/
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
myStarDto
.
setIsFinished
(
1
);
/**
* 设置我是否当选
*/
Integer
electedDoctorId
=
analysisService
.
getElectedDoctorIdByRoundId
(
roundId
);
myStarDto
.
setIsElected
(
electedDoctorId
.
intValue
()
==
user
.
getId
().
intValue
()
?
1
:
0
);
}
else
{
myStarDto
.
setIsFinished
(
0
);
myStarDto
.
setIsElected
(
0
);
}
/**
* 设置我的得赞数
*/
myStarDto
.
setMyStarCount
(
analysisService
.
getStarCountByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
/**
* 我的解析得赞记录
*/
myStarDto
.
setMyExamTitleList
(
analysisService
.
getMyStarRecordByRoundIdAndDoctorId
(
roundId
,
user
.
getId
()));
builder
.
setData
(
myStarDto
);
return
builder
.
build
();
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/controller/AntiSpamController.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.redis.RedisClient
;
import
com.pica.cloud.foundation.utils.entity.PICAUser
;
import
com.pica.cloud.online.exam.analysis.common.CommonUtils
;
import
com.pica.cloud.online.exam.analysis.common.util.ReturnUtil
;
import
com.pica.cloud.online.exam.analysis.server.service.AntiSpamService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author wuminghao
* @date 2018/9/3 9:35
*/
@RestController
@RequestMapping
(
"/antispam"
)
@Api
(
value
=
"内容甄别解析"
,
description
=
"检测文本、图片内容"
)
public
class
AntiSpamController
{
@Autowired
private
RedisClient
redisClient
;
@Autowired
AntiSpamService
antiSpamService
;
@ApiOperation
(
value
=
"回复"
,
response
=
PicaResponse
.
class
)
@RequestMapping
(
value
=
"/"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json;charset=UTF-8"
)
public
PicaResponse
process
(
@RequestBody
String
content
,
@RequestHeader
String
sysCode
,
@RequestHeader
String
token
)
{
if
(
token
==
null
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
SYSTEM_NO_TOKEN
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
}
PICAUser
user
=
CommonUtils
.
getUserByToken
(
redisClient
,
token
);
if
(
user
==
null
||
user
.
getId
().
intValue
()
==
0
)
{
PicaResponse
picaResponse
=
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
LOGIN_FAILE
);
picaResponse
.
setData
(
""
);
return
picaResponse
;
}
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
content
=
jsonObject
.
get
(
"content"
).
toString
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"parse error: "
+
content
);
return
ReturnUtil
.
getPicaResponse
(
PicaResultCode
.
PARAM_IS_INVALID
);
}
return
antiSpamService
.
processString
(
user
!=
null
?
user
.
getId
()
:
0
,
sysCode
,
content
);
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/entity/AntiSpamRecord.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
entity
;
import
java.util.Date
;
public
class
AntiSpamRecord
{
private
Integer
id
;
private
String
sysCode
;
private
String
content
;
private
String
result
;
private
Byte
action
;
private
String
label
;
private
String
hint
;
private
Integer
createdId
;
private
Date
createdTime
;
private
Integer
modifiedId
;
private
Date
modifiedTime
;
private
Boolean
isDeleted
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getSysCode
()
{
return
sysCode
;
}
public
void
setSysCode
(
String
sysCode
)
{
this
.
sysCode
=
sysCode
==
null
?
null
:
sysCode
.
trim
();
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
==
null
?
null
:
content
.
trim
();
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
==
null
?
null
:
result
.
trim
();
}
public
Byte
getAction
()
{
return
action
;
}
public
void
setAction
(
Byte
action
)
{
this
.
action
=
action
;
}
public
String
getLabel
()
{
return
label
;
}
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
==
null
?
null
:
label
.
trim
();
}
public
String
getHint
()
{
return
hint
;
}
public
void
setHint
(
String
hint
)
{
this
.
hint
=
hint
==
null
?
null
:
hint
.
trim
();
}
public
Integer
getCreatedId
()
{
return
createdId
;
}
public
void
setCreatedId
(
Integer
createdId
)
{
this
.
createdId
=
createdId
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
Integer
getModifiedId
()
{
return
modifiedId
;
}
public
void
setModifiedId
(
Integer
modifiedId
)
{
this
.
modifiedId
=
modifiedId
;
}
public
Date
getModifiedTime
()
{
return
modifiedTime
;
}
public
void
setModifiedTime
(
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
}
public
Boolean
getIsDeleted
()
{
return
isDeleted
;
}
public
void
setIsDeleted
(
Boolean
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/mapper/AnalysisRoundMapper.java
浏览文件 @
1c1c4ab7
...
...
@@ -20,4 +20,6 @@ public interface AnalysisRoundMapper {
List
<
AnalysisRound
>
selectRoundListById
(
Integer
id
);
List
<
AnalysisRound
>
selectPSARoundListById
(
Integer
id
);
List
<
AnalysisRound
>
selectHistoryRoundListById
(
Integer
id
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/mapper/AntiSpamRecordMapper.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
mapper
;
import
com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord
;
public
interface
AntiSpamRecordMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
AntiSpamRecord
record
);
int
insertSelective
(
AntiSpamRecord
record
);
AntiSpamRecord
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
AntiSpamRecord
record
);
int
updateByPrimaryKey
(
AntiSpamRecord
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/mapper/ReplyMapper.java
浏览文件 @
1c1c4ab7
...
...
@@ -3,6 +3,7 @@ package com.pica.cloud.online.exam.analysis.server.mapper;
import
com.pica.cloud.online.exam.analysis.server.entity.Reply
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ReplyMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
...
...
@@ -38,4 +39,32 @@ 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
);
/**
* 获取某人某轮的获赞数
* @param param
* @return
*/
Integer
selectStarCountByParam
(
Map
param
);
/**
* 获取某人某轮的获赞记录
* @param param
* @return
*/
List
<
Reply
>
selectStarRecordByParam
(
Map
param
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/AntiSpamService.java
浏览文件 @
1c1c4ab7
...
...
@@ -7,9 +7,11 @@ import com.pica.cloud.foundation.entity.PicaResponse;
* @date 2018/8/27 14:38
*/
public
interface
AntiSpamService
{
PicaResponse
processString
(
String
content
);
PicaResponse
processString
(
Integer
userId
,
String
sysCode
,
String
content
);
boolean
processImageContent
(
String
content
);
boolean
processImageContent
(
Integer
userId
,
String
sysCode
,
String
content
);
boolean
processImage
(
String
url
);
boolean
processImage
(
Integer
userId
,
String
sysCode
,
String
url
);
int
insertRecord
(
Integer
userId
,
String
sysCode
,
String
content
,
String
result
,
Byte
action
,
int
label
,
String
hint
);
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/CHCAnalysisService.java
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
service
;
import
com.pica.cloud.online.exam.analysis.common.dto.*
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRound
;
import
com.pica.cloud.online.exam.analysis.server.entity.AnalysisRoundExamTitle
;
import
com.pica.cloud.online.exam.analysis.server.entity.CHCAnalysis
;
import
com.pica.cloud.online.exam.analysis.server.entity.Reply
;
import
org.omg.CORBA.INTERNAL
;
import
java.util.List
;
...
...
@@ -45,7 +47,14 @@ public interface CHCAnalysisService {
* @param roundId
* @return
*/
RoundExamTitleDto
getRoundById
(
Integer
roundId
);
RoundExamTitleDto
getRoundExamTitleDtoById
(
Integer
roundId
);
/**
* 根据轮的id获取信息
* @param roundId
* @return
*/
AnalysisRound
getRoundInfoById
(
Integer
roundId
);
/**
* 根据轮的id获取题目信息
...
...
@@ -156,4 +165,40 @@ public interface CHCAnalysisService {
* @return
*/
List
<
Reply
>
getReplyList
(
Integer
examTitleId
);
/**
* 获取所有的历史轮详情
* @return
*/
List
<
AnalysisRoundDto
>
getCHCHistoryRound
();
/**
* 获取某一轮的最多得票数
* @param roundId
* @return
*/
Integer
getElectedStarCountByRoundId
(
Integer
roundId
);
/**
* 获取被选中的医生id
* @param roundId
* @return
*/
Integer
getElectedDoctorIdByRoundId
(
Integer
roundId
);
/**
* 根据医生id和轮id获取得赞数
* @param roundId
* @param doctorId
* @return
*/
Integer
getStarCountByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctorId
);
/**
* 根据医生id和轮id获取得赞记录
* @param roundId
* @param doctorId
* @return
*/
List
<
UserExamTitleDto
>
getMyStarRecordByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctorId
);
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/DoctorService.java
浏览文件 @
1c1c4ab7
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/AntiSpamServiceImpl.java
浏览文件 @
1c1c4ab7
...
...
@@ -8,6 +8,8 @@ import com.pica.cloud.foundation.entity.PicaResponse;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.online.exam.analysis.common.util.ReturnUtil
;
import
com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfiguration
;
import
com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord
;
import
com.pica.cloud.online.exam.analysis.server.mapper.AntiSpamRecordMapper
;
import
com.pica.cloud.online.exam.analysis.server.service.AntiSpamService
;
import
com.pica.cloud.online.exam.analysis.server.utils.HttpClient4Utils
;
import
com.pica.cloud.online.exam.analysis.server.utils.SignatureUtils
;
...
...
@@ -29,15 +31,18 @@ public class AntiSpamServiceImpl implements AntiSpamService {
@Autowired
private
PropertiesConfiguration
properties
;
@Autowired
private
AntiSpamRecordMapper
antiSpamRecordMapper
;
private
static
HttpClient
httpClient
=
HttpClient4Utils
.
createHttpClient
(
100
,
20
,
2000
,
2000
,
2000
);
private
static
HttpClient
httpClientImage
=
HttpClient4Utils
.
createHttpClient
(
100
,
20
,
10000
,
2000
,
2000
);
@Override
public
PicaResponse
processString
(
String
content
)
{
public
PicaResponse
processString
(
Integer
userId
,
String
sysCode
,
String
content
)
{
/**
* 过滤图片
*/
if
(!
processImageContent
(
content
))
{
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
"图片包含违禁内容,请修改后重新输入"
);
if
(!
processImageContent
(
userId
,
sysCode
,
content
))
{
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
"图片包含违禁内容,请修改后重新输入"
,
""
);
}
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
...
...
@@ -100,7 +105,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
* action: 2 不通过
*/
if
(
action
==
0
)
{
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
0
,
""
);
}
else
{
for
(
JsonElement
labelElement
:
labelArray
)
{
JsonObject
lObject
=
labelElement
.
getAsJsonObject
();
...
...
@@ -116,7 +121,8 @@ public class AntiSpamServiceImpl implements AntiSpamService {
else
if
(
label
==
600
)
msg
=
"输入内容包含谩骂词汇,请修改后重新输入"
;
else
if
(
label
==
700
)
msg
=
"输入内容包含灌水词汇,请修改后重新输入"
;
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
msg
);
insertRecord
(
userId
,
sysCode
,
content
,
response
,
(
byte
)
action
,
label
,
detailsObject
.
getAsString
());
return
ReturnUtil
.
getPicaResponse
(
"400002"
,
msg
,
""
);
}
}
...
...
@@ -129,7 +135,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
@Override
public
boolean
processImageContent
(
String
content
)
{
public
boolean
processImageContent
(
Integer
userId
,
String
sysCode
,
String
content
)
{
List
<
String
>
imageUrlList
=
new
ArrayList
<>();
/**
...
...
@@ -150,7 +156,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
/**
* 检测出某张图片失败 则返回
*/
if
(!
processImage
(
url
))
{
if
(!
processImage
(
u
serId
,
sysCode
,
u
rl
))
{
return
false
;
}
}
...
...
@@ -158,7 +164,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
@Override
public
boolean
processImage
(
String
url
)
{
public
boolean
processImage
(
Integer
userId
,
String
sysCode
,
String
url
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
/**
...
...
@@ -226,6 +232,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
*/
int
maxLevel
=
-
1
;
double
maxRate
=
0.0
;
int
maxLable
=
0
;
// 产品需根据自身需求,自行解析处理,本示例只是简单判断分类级别
for
(
JsonElement
labelElement
:
labelArray
)
{
JsonObject
lObject
=
labelElement
.
getAsJsonObject
();
...
...
@@ -234,18 +241,49 @@ public class AntiSpamServiceImpl implements AntiSpamService {
double
rate
=
lObject
.
get
(
"rate"
).
getAsDouble
();
if
(
label
==
100
||
label
==
110
||
label
==
210
)
{
System
.
out
.
println
(
String
.
format
(
"label:%s, level=%s, rate=%s"
,
label
,
level
,
rate
));
maxLevel
=
level
>
maxLevel
?
level
:
maxLevel
;
if
(
level
>
maxLevel
)
{
maxLevel
=
level
;
maxLable
=
label
;
}
maxRate
=
rate
>
maxRate
?
rate
:
maxRate
;
}
}
if
(
maxLevel
==
2
)
{
insertRecord
(
userId
,
sysCode
,
url
,
response
,
(
byte
)
maxLevel
,
maxLable
,
""
);
return
false
;
}
}
}
else
{
System
.
out
.
println
(
String
.
format
(
"ERROR: code=%s, msg=%s"
,
code
,
msg
));
}
/**
* 成功
*/
insertRecord
(
userId
,
sysCode
,
url
,
response
,
(
byte
)
0
,
0
,
""
);
return
true
;
}
@Override
public
int
insertRecord
(
Integer
userId
,
String
sysCode
,
String
content
,
String
result
,
Byte
action
,
int
label
,
String
hint
)
{
AntiSpamRecord
antiSpamRecord
=
new
AntiSpamRecord
();
antiSpamRecord
.
setSysCode
(
sysCode
);
antiSpamRecord
.
setContent
(
content
);
antiSpamRecord
.
setResult
(
result
);
antiSpamRecord
.
setAction
(
action
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
label
);
antiSpamRecord
.
setLabel
(
sb
.
toString
());
antiSpamRecord
.
setHint
(
hint
);
antiSpamRecord
.
setCreatedId
(
userId
);
antiSpamRecord
.
setCreatedTime
(
new
Date
());
antiSpamRecord
.
setModifiedId
(
userId
);
antiSpamRecord
.
setModifiedTime
(
new
Date
());
antiSpamRecord
.
setIsDeleted
(
false
);
return
antiSpamRecordMapper
.
insert
(
antiSpamRecord
);
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/CHCAnalysisServiceImpl.java
浏览文件 @
1c1c4ab7
...
...
@@ -7,14 +7,13 @@ import com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfig
import
com.pica.cloud.online.exam.analysis.server.entity.*
;
import
com.pica.cloud.online.exam.analysis.server.mapper.*
;
import
com.pica.cloud.online.exam.analysis.server.service.CHCAnalysisService
;
import
com.pica.cloud.online.exam.analysis.server.utils.DateUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
/**
* @author wuminghao
...
...
@@ -58,7 +57,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
());
...
...
@@ -83,7 +82,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
());
...
...
@@ -117,7 +116,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
();
...
...
@@ -129,8 +128,15 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
roundDto
.
setStartTime
(
sdf
.
format
(
round
.
getStartTime
()));
roundDto
.
setEndTime
(
sdf
.
format
(
round
.
getEndTime
()));
roundDto
.
setSeqNo
(
round
.
getSeqNo
());
roundDto
.
setPublished
(
round
.
getIsPublished
()
?
1
:
0
);
/**
* 如果时间过期 设置超时
*/
if
((
new
Date
()).
getTime
()
>
round
.
getEndTime
().
getTime
())
{
roundDto
.
setPublished
(
2
);
}
else
{
roundDto
.
setPublished
(
round
.
getIsPublished
()
?
1
:
0
);
}
roundDtoList
.
add
(
roundDto
);
}
...
...
@@ -138,14 +144,14 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
}
@Override
public
RoundExamTitleDto
getRoundById
(
Integer
roundId
)
{
public
RoundExamTitleDto
getRound
ExamTitleDto
ById
(
Integer
roundId
)
{
AnalysisRound
round
=
analysisRoundMapper
.
selectByPrimaryKey
(
roundId
);
if
(
null
==
round
)
{
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd
HH:mm:ss
"
);
RoundExamTitleDto
roundExamTitleDto
=
new
RoundExamTitleDto
();
...
...
@@ -154,23 +160,27 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
roundExamTitleDto
.
setStartTime
(
sdf
.
format
(
round
.
getStartTime
()));
roundExamTitleDto
.
setEndTime
(
sdf
.
format
(
round
.
getEndTime
()));
roundExamTitleDto
.
setTotalCount
(
analysisRoundExamTitleMapper
.
selectExamTitleCountByRoundId
(
roundId
));
roundExamTitleDto
.
setPublished
(
round
.
getIsPublished
()
?
1
:
0
);
/**
* 如果时间过期 设置超时
*/
if
((
new
Date
()).
getTime
()
>
round
.
getEndTime
().
getTime
())
{
roundExamTitleDto
.
setPublished
(
2
);
}
else
{
roundExamTitleDto
.
setPublished
(
round
.
getIsPublished
()
?
1
:
0
);
}
return
roundExamTitleDto
;
}
@Override
public
AnalysisRound
getRoundInfoById
(
Integer
roundId
)
{
return
analysisRoundMapper
.
selectByPrimaryKey
(
roundId
);
}
@Override
public
List
<
ExamTitleDto
>
getExamTitleListByRoundId
(
Integer
roundId
)
{
List
<
AnalysisRoundExamTitle
>
roundExamTitleList
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
roundId
);
/**
* TODO: 上一轮的id 测试用
*/
if
(
roundId
==
2
)
{
List
<
AnalysisRoundExamTitle
>
roundExamTitleList1
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
1
);
roundExamTitleList
.
addAll
(
roundExamTitleList1
);
}
if
(
null
==
roundExamTitleList
)
{
return
null
;
}
...
...
@@ -201,15 +211,6 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
examTitleDto
.
setType
(
analysisRoundExamTitle
.
getExamTitleType
());
examTitleDto
.
setQuestion
(
analysisRoundExamTitle
.
getSeqNo
().
toString
()
+
"."
+
analysisRoundExamTitle
.
getQuestion
());
/**
* TODO: 删除 临时使用
*/
if
(
analysisRoundExamTitle
.
getRoundId
().
intValue
()
==
1
)
{
examTitleDto
.
setQuestion
(
"[第一期]"
+
examTitleDto
.
getQuestion
());
}
else
if
(
analysisRoundExamTitle
.
getRoundId
().
intValue
()
==
2
)
{
examTitleDto
.
setQuestion
(
"[第二期]"
+
examTitleDto
.
getQuestion
());
}
/**
* 设置选项
*/
...
...
@@ -252,7 +253,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
{
...
...
@@ -300,8 +300,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
());
...
...
@@ -315,15 +313,21 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
replyDto
.
setPostTitle
(
doctor
.
getTitle
());
replyDto
.
setHospital
(
doctor
.
getHospital
());
replyDto
.
setContent
(
reply
.
getContent
());
replyDto
.
setReplayTime
(
sdf
.
format
(
reply
.
getCreat
edTime
()));
replyDto
.
setReplayTime
(
DateUtils
.
fromNow
(
reply
.
getModifi
edTime
()));
replyDto
.
setStarCount
(
starRecordMapper
.
selectStarCountByReplyId
(
reply
.
getId
()));
AnalysisRoundExamTitle
analysisRoundExamTitle
=
analysisRoundExamTitleMapper
.
selectByPrimaryKey
(
reply
.
getAnalysisRoundExamTitleId
());
AnalysisRound
analysisRound
=
analysisRoundMapper
.
selectByPrimaryKey
(
analysisRoundExamTitle
.
getRoundId
());
if
((
new
Date
()).
getTime
()
>
analysisRound
.
getEndTime
().
getTime
())
{
replyDto
.
setStatus
(
2
);
}
else
{
StarRecord
starRecord
=
new
StarRecord
();
starRecord
.
setReplyId
(
reply
.
getId
());
starRecord
.
setCreatedId
(
userId
);
replyDto
.
setStatus
(
starRecordMapper
.
selectStarCountByRecord
(
starRecord
)
>
0
?
1
:
0
);
replyDto
.
setStatus
(
starRecordMapper
.
selectStarCountByRecord
(
starRecord
)
>
0
?
1
:
0
);
}
return
replyDto
;
}
...
...
@@ -513,4 +517,112 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return
replyListOther
;
}
@Override
public
List
<
AnalysisRoundDto
>
getCHCHistoryRound
()
{
List
<
AnalysisRound
>
roundList
=
new
ArrayList
<>();
/**
* TODO: 需要前端传入id
*/
roundList
=
analysisRoundMapper
.
selectHistoryRoundListById
(
1
);
List
<
AnalysisRoundDto
>
roundDtoList
=
new
ArrayList
<>();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
for
(
AnalysisRound
round
:
roundList
)
{
AnalysisRoundDto
roundDto
=
new
AnalysisRoundDto
();
roundDto
.
setRoundId
(
round
.
getId
());
roundDto
.
setAnalysisId
(
round
.
getAnalysisId
());
roundDto
.
setName
(
round
.
getRoundName
());
roundDto
.
setIntro
(
round
.
getIntro
());
roundDto
.
setStartTime
(
sdf
.
format
(
round
.
getStartTime
()));
roundDto
.
setEndTime
(
sdf
.
format
(
round
.
getEndTime
()));
roundDto
.
setSeqNo
(
round
.
getSeqNo
());
/**
* 如果时间过期 设置超时
*/
if
((
new
Date
()).
getTime
()
>
round
.
getEndTime
().
getTime
())
{
roundDto
.
setPublished
(
2
);
}
else
{
roundDto
.
setPublished
(
round
.
getIsPublished
()
?
1
:
0
);
}
roundDtoList
.
add
(
roundDto
);
}
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
);
}
@Override
public
Integer
getStarCountByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctorId
)
{
Map
param
=
new
HashMap
<>();
List
<
AnalysisRoundExamTitle
>
examTitleList
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
roundId
);
List
<
Integer
>
examTitleIdList
=
new
ArrayList
<>();
for
(
AnalysisRoundExamTitle
examTitle
:
examTitleList
)
{
examTitleIdList
.
add
(
examTitle
.
getId
());
}
param
.
put
(
"examTitleList"
,
examTitleIdList
);
param
.
put
(
"doctorId"
,
doctorId
);
return
replyMapper
.
selectStarCountByParam
(
param
);
}
@Override
public
List
<
UserExamTitleDto
>
getMyStarRecordByRoundIdAndDoctorId
(
Integer
roundId
,
Integer
doctorId
)
{
Map
param
=
new
HashMap
<>();
List
<
AnalysisRoundExamTitle
>
examTitleList
=
analysisRoundExamTitleMapper
.
selectExamTitleListByRoundId
(
roundId
);
List
<
Integer
>
examTitleIdList
=
new
ArrayList
<>();
for
(
AnalysisRoundExamTitle
examTitle
:
examTitleList
)
{
examTitleIdList
.
add
(
examTitle
.
getId
());
}
param
.
put
(
"examTitleList"
,
examTitleIdList
);
param
.
put
(
"doctorId"
,
doctorId
);
List
<
Reply
>
replyList
=
replyMapper
.
selectStarRecordByParam
(
param
);
List
<
UserExamTitleDto
>
userExamTitleDtos
=
new
ArrayList
<>();
for
(
int
idx
=
0
;
idx
<
examTitleIdList
.
size
();
++
idx
)
{
UserExamTitleDto
userExamTitleDto
=
new
UserExamTitleDto
();
userExamTitleDto
.
setExamTitleId
(
examTitleIdList
.
get
(
idx
));
userExamTitleDto
.
setSeqNo
(
idx
+
1
);
boolean
isReplied
=
false
;
Integer
starCount
=
0
;
for
(
Reply
reply
:
replyList
)
{
if
(
reply
.
getAnalysisRoundExamTitleId
().
intValue
()
==
examTitleIdList
.
get
(
idx
).
intValue
())
{
isReplied
=
true
;
starCount
=
reply
.
getStarCount
();
break
;
}
}
userExamTitleDto
.
setIsReplied
(
isReplied
?
1
:
0
);
userExamTitleDto
.
setStarCount
(
starCount
);
userExamTitleDtos
.
add
(
userExamTitleDto
);
}
return
userExamTitleDtos
;
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/CHCRankingListServiceImpl.java
浏览文件 @
1c1c4ab7
...
...
@@ -16,6 +16,10 @@ public class CHCRankingListServiceImpl implements CHCRankingListService {
@Override
public
boolean
isRankingInTop200
(
Integer
doctorId
)
{
if
(
doctorId
==
0
)
{
return
false
;
}
return
rankingListMapper
.
selectRecordExistTop200
(
doctorId
)
>
0
;
}
}
server/src/main/java/com/pica/cloud/online/exam/analysis/server/service/impl/DoctorServiceImpl.java
浏览文件 @
1c1c4ab7
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/java/com/pica/cloud/online/exam/analysis/server/utils/DateUtils.java
0 → 100644
浏览文件 @
1c1c4ab7
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* @author wuminghao
* @date 2018/9/1 10:54
*/
public
class
DateUtils
{
private
static
final
long
ONE_MINITE
=
60
;
private
static
final
long
ONE_HOUR
=
3600
;
private
static
final
long
ONE_DAY
=
86400
;
private
static
final
long
THREE_DAY
=
259200
;
public
static
Calendar
calendar
=
Calendar
.
getInstance
();
public
static
String
fromNow
(
Date
date
)
{
calendar
.
setTime
(
date
);
long
time
=
date
.
getTime
()
/
1000
;
long
now
=
(
new
Date
()).
getTime
()
/
1000
;
long
interval
=
now
-
time
;
if
(
interval
<=
ONE_MINITE
)
{
return
"刚刚发布"
;
}
else
if
(
interval
<=
ONE_HOUR
)
{
return
interval
/
ONE_MINITE
+
"分钟前"
;
}
else
if
(
interval
<=
ONE_DAY
)
{
return
interval
/
ONE_HOUR
+
"小时前"
;
}
else
if
(
interval
<
THREE_DAY
)
{
return
interval
/
ONE_DAY
+
"天前"
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
sdf
.
format
(
date
);
}
public
static
String
remainingTime
(
Date
date
)
{
long
time
=
date
.
getTime
()
/
1000
;
long
now
=
(
new
Date
()).
getTime
()
/
1000
;
long
interval
=
time
-
now
;
if
(
interval
<
0
)
return
""
;
if
(
interval
<=
ONE_MINITE
)
{
return
"1分钟"
;
}
else
if
(
interval
<=
ONE_HOUR
)
{
return
interval
/
ONE_MINITE
+
"分钟"
;
}
else
if
(
interval
<=
ONE_DAY
)
{
return
interval
/
ONE_HOUR
+
"小时"
+
(
interval
%
ONE_HOUR
)
/
ONE_MINITE
+
"分钟"
;
}
else
{
return
interval
/
ONE_DAY
+
"天"
+
(
interval
%
ONE_DAY
)
/
ONE_HOUR
+
"小时"
+
((
interval
%
ONE_DAY
)
%
ONE_HOUR
)
/
ONE_MINITE
+
"分钟"
;
}
}
}
server/src/main/resources/mybatis-generator.xml
浏览文件 @
1c1c4ab7
...
...
@@ -44,8 +44,9 @@
<table tableName="pica_online_exam.p_analysis_round_exam_title" domainObjectName="AnalysisRoundExamTitle" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="pica_online_exam.p_reply" domainObjectName="Reply" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="pica_online_exam.p_reply_image" domainObjectName="ReplyImage" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
-->
<table tableName="pica_online_exam.p_star_record" domainObjectName="StarRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
-->
<table
tableName=
"pica_online_exam.p_anti_spam_record"
domainObjectName=
"AntiSpamRecord"
enableCountByExample=
"false"
enableUpdateByExample=
"false"
enableDeleteByExample=
"false"
enableSelectByExample=
"false"
selectByExampleQueryId=
"false"
></table>
</context>
</generatorConfiguration>
...
...
server/src/main/resources/mybatis/AnalysisRoundMapper.xml
浏览文件 @
1c1c4ab7
...
...
@@ -33,7 +33,14 @@
from p_analysis_round
where analysis_id = #{id,jdbcType=INTEGER}
and is_deleted = 0
and seq_no >= (select seq_no from p_analysis_round where is_published = 1 and is_deleted = 0 limit 1)
and seq_no >=
(select
seq_no from p_analysis_round
where is_published = 1
and is_deleted = 0
order by seq_no desc
limit 1)
order by seq_no
limit 2
</select>
...
...
@@ -47,6 +54,22 @@
limit 1
</select>
<select
id=
"selectHistoryRoundListById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from p_analysis_round
where analysis_id = #{id,jdbcType=INTEGER}
and is_deleted = 0
and seq_no
<
=
(select
seq_no from p_analysis_round
where is_published = 1
and is_deleted = 0
order by seq_no desc
limit 1)
order by seq_no
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_analysis_round
where id = #{id,jdbcType=INTEGER}
...
...
server/src/main/resources/mybatis/AntiSpamRecordMapper.xml
0 → 100644
浏览文件 @
1c1c4ab7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pica.cloud.online.exam.analysis.server.mapper.AntiSpamRecordMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"sys_code"
jdbcType=
"VARCHAR"
property=
"sysCode"
/>
<result
column=
"content"
jdbcType=
"VARCHAR"
property=
"content"
/>
<result
column=
"result"
jdbcType=
"VARCHAR"
property=
"result"
/>
<result
column=
"action"
jdbcType=
"TINYINT"
property=
"action"
/>
<result
column=
"label"
jdbcType=
"VARCHAR"
property=
"label"
/>
<result
column=
"hint"
jdbcType=
"VARCHAR"
property=
"hint"
/>
<result
column=
"created_id"
jdbcType=
"INTEGER"
property=
"createdId"
/>
<result
column=
"created_time"
jdbcType=
"TIMESTAMP"
property=
"createdTime"
/>
<result
column=
"modified_id"
jdbcType=
"INTEGER"
property=
"modifiedId"
/>
<result
column=
"modified_time"
jdbcType=
"TIMESTAMP"
property=
"modifiedTime"
/>
<result
column=
"is_deleted"
jdbcType=
"BIT"
property=
"isDeleted"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, sys_code, content, result, action, label, hint, created_id, created_time, modified_id,
modified_time, is_deleted
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from p_anti_spam_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_anti_spam_record
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord"
>
insert into p_anti_spam_record (id, sys_code, content,
result, action, label,
hint, created_id, created_time,
modified_id, modified_time, is_deleted
)
values (#{id,jdbcType=INTEGER}, #{sysCode,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{result,jdbcType=VARCHAR}, #{action,jdbcType=TINYINT}, #{label,jdbcType=VARCHAR},
#{hint,jdbcType=VARCHAR}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord"
>
insert into p_anti_spam_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"sysCode != null"
>
sys_code,
</if>
<if
test=
"content != null"
>
content,
</if>
<if
test=
"result != null"
>
result,
</if>
<if
test=
"action != null"
>
action,
</if>
<if
test=
"label != null"
>
label,
</if>
<if
test=
"hint != null"
>
hint,
</if>
<if
test=
"createdId != null"
>
created_id,
</if>
<if
test=
"createdTime != null"
>
created_time,
</if>
<if
test=
"modifiedId != null"
>
modified_id,
</if>
<if
test=
"modifiedTime != null"
>
modified_time,
</if>
<if
test=
"isDeleted != null"
>
is_deleted,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"sysCode != null"
>
#{sysCode,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=VARCHAR},
</if>
<if
test=
"result != null"
>
#{result,jdbcType=VARCHAR},
</if>
<if
test=
"action != null"
>
#{action,jdbcType=TINYINT},
</if>
<if
test=
"label != null"
>
#{label,jdbcType=VARCHAR},
</if>
<if
test=
"hint != null"
>
#{hint,jdbcType=VARCHAR},
</if>
<if
test=
"createdId != null"
>
#{createdId,jdbcType=INTEGER},
</if>
<if
test=
"createdTime != null"
>
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
#{modifiedId,jdbcType=INTEGER},
</if>
<if
test=
"modifiedTime != null"
>
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"isDeleted != null"
>
#{isDeleted,jdbcType=BIT},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord"
>
update p_anti_spam_record
<set>
<if
test=
"sysCode != null"
>
sys_code = #{sysCode,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
content = #{content,jdbcType=VARCHAR},
</if>
<if
test=
"result != null"
>
result = #{result,jdbcType=VARCHAR},
</if>
<if
test=
"action != null"
>
action = #{action,jdbcType=TINYINT},
</if>
<if
test=
"label != null"
>
label = #{label,jdbcType=VARCHAR},
</if>
<if
test=
"hint != null"
>
hint = #{hint,jdbcType=VARCHAR},
</if>
<if
test=
"createdId != null"
>
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if
test=
"modifiedTime != null"
>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"isDeleted != null"
>
is_deleted = #{isDeleted,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.online.exam.analysis.server.entity.AntiSpamRecord"
>
update p_anti_spam_record
set sys_code = #{sysCode,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
result = #{result,jdbcType=VARCHAR},
action = #{action,jdbcType=TINYINT},
label = #{label,jdbcType=VARCHAR},
hint = #{hint,jdbcType=VARCHAR},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
is_deleted = #{isDeleted,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/ReplyMapper.xml
浏览文件 @
1c1c4ab7
...
...
@@ -82,6 +82,59 @@
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
ifnull(user_id,0)
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>
<select
id=
"selectStarCountByParam"
resultType=
"java.lang.Integer"
>
select
ifnull(sum(star_count),0)
from p_reply
where analysis_round_exam_title_id in
<foreach
item=
"item"
index=
"index"
collection=
"examTitleList"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and is_deleted = 0
and user_id = #{doctorId,jdbcType=INTEGER}
</select>
<select
id=
"selectStarRecordByParam"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from p_reply
where analysis_round_exam_title_id in
<foreach
item=
"item"
index=
"index"
collection=
"examTitleList"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and is_deleted = 0
and user_id = #{doctorId,jdbcType=INTEGER}
order by analysis_round_exam_title_id
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from p_reply
where id = #{id,jdbcType=INTEGER}
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录